Skip to content

Commit 73b2c8a

Browse files
committed
refactor(BA-5528): drop --endpoint-url from chat-config set
The deployment endpoint URL is server-derived; users should never have to provide it manually. ./bai deployment chat-config set now always resolves the endpoint via the manager and rejects the request when the deployment cannot be reached, leaving --token (and optional --default-model) as the only user-supplied inputs.
1 parent b2df404 commit 73b2c8a

1 file changed

Lines changed: 23 additions & 27 deletions

File tree

src/ai/backend/client/cli/v2/deployment/chat_config.py

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ def _run_async(coro_fn: Callable[[], Awaitable[None]]) -> None:
4343

4444
@click.group(name="chat-config")
4545
def chat_config() -> None:
46-
"""Manage local chat cache for deployment chat (vLLM API keys, endpoints)."""
46+
"""Manage stored vLLM API keys for deployment chat.
47+
48+
The deployment's ``endpoint_url`` is always resolved from the manager
49+
automatically; only the API key is registered through this command.
50+
"""
4751

4852

4953
@chat_config.command(name="set")
@@ -55,12 +59,6 @@ def chat_config() -> None:
5559
type=str,
5660
help="The vLLM API key the deployment was started with (--api-key).",
5761
)
58-
@click.option(
59-
"--endpoint-url",
60-
default=None,
61-
type=str,
62-
help="Override the deployment's endpoint_url (otherwise auto-resolved).",
63-
)
6462
@click.option(
6563
"--default-model",
6664
default=None,
@@ -70,10 +68,14 @@ def chat_config() -> None:
7068
def set_(
7169
deployment_id: UUID,
7270
vllm_api_key: str,
73-
endpoint_url: str | None,
7471
default_model: str | None,
7572
) -> None:
76-
"""Register or update the chat cache entry for a deployment."""
73+
"""Register or update the vLLM API key for a deployment.
74+
75+
The deployment's endpoint URL is resolved from the manager and stored
76+
alongside the key so the next ``chat`` invocation does not need to
77+
re-query.
78+
"""
7779
config = load_v2_config()
7880
try:
7981
cache = load_chat_cache()
@@ -83,28 +85,22 @@ def set_(
8385
existing = cache.get(deployment_id)
8486

8587
async def _run() -> None:
86-
if endpoint_url:
87-
final_endpoint = endpoint_url
88-
elif existing is not None and existing.endpoint_url:
89-
final_endpoint = existing.endpoint_url
90-
else:
91-
registry = await create_v2_registry(config)
92-
try:
93-
deployment = await registry.deployment.get(deployment_id)
94-
finally:
95-
await registry.close()
96-
resolved = deployment.network_access.endpoint_url
97-
if not resolved:
98-
raise click.ClickException(
99-
f"Deployment {deployment_id} has no endpoint_url yet "
100-
"(it may still be provisioning). Provide --endpoint-url explicitly."
101-
)
102-
final_endpoint = resolved
88+
registry = await create_v2_registry(config)
89+
try:
90+
deployment = await registry.deployment.get(deployment_id)
91+
finally:
92+
await registry.close()
93+
resolved = deployment.network_access.endpoint_url
94+
if not resolved:
95+
raise click.ClickException(
96+
f"Deployment {deployment_id} has no endpoint_url yet "
97+
"(it may still be provisioning). Wait until the deployment is READY."
98+
)
10399

104100
cache.upsert(
105101
deployment_id,
106102
DeploymentChatCacheEntry(
107-
endpoint_url=final_endpoint,
103+
endpoint_url=resolved,
108104
vllm_api_key=vllm_api_key,
109105
default_model=(
110106
default_model

0 commit comments

Comments
 (0)