Skip to main content

aip_sdk.register_judge_connection

aip_sdk.register_judge_connection(name: str, model: str, *, base_url: str | None = None, api_key: str | None = None, project_id: str | None = None, workspace_id: str | None = None, client: APIClient | None = None) -> JudgeConnection

Register a judge connection so metrics can reference it by name.

Stores a named judge — model, optional OpenAI-compatible base URL, and API key — server-side. The key is encrypted at rest and never returned. Only name and model are required; omit api_key for an endpoint that authenticates by network rather than a token.

Parameters

  • name str: Connection name, unique within the workspace.
  • model str: Judge model id, e.g. "gpt-4o-mini".
  • base_url str | None: OpenAI-compatible base URL; omit to use the platform default judge. A trailing slash and a trailing /chat/completions are stripped before storage.
  • api_key str | None: Plaintext API key, encrypted at rest by the platform.
  • project_id str | None: Project to scope the connection to.
  • workspace_id str | None: Workspace to scope the connection to. Pass this or project_id, not both — a project-scoped connection inherits its workspace from the project. Falls back to the client's configured workspace.
  • client APIClient | None: Optional pre-configured API client.

Returns

  • JudgeConnection JudgeConnection: the registered connection, with its generated id.

Raises

Example:

import aip_sdk as aip

aip.init("https://aip.example.com", api_key="...")
judge = aip.register_judge_connection(
name="approved-gpt4o",
model="gpt-4o-mini",
base_url="https://llm.internal.example.com/v1",
api_key="sk-...",
project_id="proj-abc123",
)
print(judge.id, judge.name)