Skip to main content

aip_sdk.Connection

aip_sdk.Connection(data: dict[str, Any], client: APIClient)

A connection to a SUT (specific environment).

Attributes

  • id str: Connection ID
  • sut_id str: Parent SUT ID
  • label str: Environment label (e.g., "staging", "prod")
  • base_url str: SUT endpoint base URL
  • auth_type str: Authentication method ("none", "bearer", "api_key", "basic")
  • auth_header_name str | None: Header name for auth (e.g., "Authorization")
  • model_params dict[str, Any]: Static parameters passed to the selected SUT protocol
  • sut_protocol str | None: Invocation protocol, e.g. "openai_chat", "huggingface_object_detection", or "rag_api"
  • gdi_schema str | None: GDI dataset schema this connection produces (e.g. "gdi_text_v1")
  • task_type str | None: Task discriminator for task-scoped schemas, e.g. "detection" for gdi_image_v1
  • sut_streaming bool: When True, responses are streamed so evaluation captures true time-to-first-byte rather than total round-trip. Recommended for long-running SUTs (video, agentic/trajectory, large RAG); off by default.
  • created_at datetime | None: When this connection was created

aip_sdk.Connection.auth_header_name​

aip_sdk.Connection.auth_header_name: str | None = data.get('auth_header_name')

No docstring is defined in the source.

aip_sdk.Connection.auth_type​

aip_sdk.Connection.auth_type: str = data['auth_type']

No docstring is defined in the source.

aip_sdk.Connection.base_url​

aip_sdk.Connection.base_url: str = data['base_url']

No docstring is defined in the source.

aip_sdk.Connection.created_at​

aip_sdk.Connection.created_at: datetime | None = parse_dt(data['created_at'])

No docstring is defined in the source.

aip_sdk.Connection.delete​

aip_sdk.Connection.delete() -> None

Remove this connection from the SUT.

Raises

  • NotFoundError: If the connection no longer exists, or the SUT belongs to a workspace the caller is not a member of.
  • ForbiddenError: If the caller is not an editor or admin of the SUT's workspace. A platform admin must be a member of that workspace too.

aip_sdk.Connection.gdi_schema​

aip_sdk.Connection.gdi_schema: str | None = data.get('gdi_schema')

No docstring is defined in the source.

aip_sdk.Connection.get_adapter​

aip_sdk.Connection.get_adapter() -> Adapter

Get the current response parser adapter for this connection.

Returns

Raises

aip_sdk.Connection.id​

aip_sdk.Connection.id: str = data['id']

No docstring is defined in the source.

aip_sdk.Connection.label​

aip_sdk.Connection.label: str = data['label']

No docstring is defined in the source.

aip_sdk.Connection.model_params​

aip_sdk.Connection.model_params: dict[str, Any] = data.get('model_params') or {}

No docstring is defined in the source.

aip_sdk.Connection.set_adapter​

aip_sdk.Connection.set_adapter(mapping_config: dict[str, str], template_name: str | None = None) -> Adapter

Set or replace the response parser adapter for this connection.

Parameters

  • mapping_config dict[str, str]: JSONPath mappings from SUT response to GDI schema Example: {"sut_response": "$.choices[0].message.content"}
  • template_name str | None: Optional built-in template to use as base ("openai_chat", "cv_detection", "cv_classification", "rag_api")

Returns

Raises

  • NotFoundError: If the connection no longer exists, or the SUT belongs to a workspace the caller is not a member of.
  • ForbiddenError: If the caller is not an editor or admin of the SUT's workspace. A platform admin must be a member of that workspace too.

Examples

>>> conn = sut.add_connection(...)
>>> adapter = conn.set_adapter(
... template_name="openai_chat",
... mapping_config={
... "sut_response": "$.choices[0].message.content",
... "usage_prompt_tokens": "$.usage.prompt_tokens",
... },
... )

aip_sdk.Connection.sut_id​

aip_sdk.Connection.sut_id: str = data['sut_id']

No docstring is defined in the source.

aip_sdk.Connection.sut_protocol​

aip_sdk.Connection.sut_protocol: str | None = data.get('sut_protocol')

No docstring is defined in the source.

aip_sdk.Connection.sut_streaming​

aip_sdk.Connection.sut_streaming: bool = data.get('sut_streaming', False)

No docstring is defined in the source.

aip_sdk.Connection.task_type​

aip_sdk.Connection.task_type: str | None = data.get('task_type')

No docstring is defined in the source.

aip_sdk.Connection.test​

aip_sdk.Connection.test() -> ConnectionTestResult

Test this connection by firing a request using the project's golden dataset.

Returns

Examples

>>> conn = sut.add_connection(...)
>>> result = conn.test()
>>> if result.success:
... print(f"SUT responded in {result.duration_ms}ms")
... print(f"Raw response: {result.raw_response}")

aip_sdk.Connection.update​

aip_sdk.Connection.update(label: str | None = None, base_url: str | None = None, auth_type: str | None = None, auth_header_name: str | None = None, auth_header_value: str | None = None, model_params: dict[str, Any] | None = None, sut_protocol: str | None = None, gdi_schema: str | None = None, task_type: str | None = None, sut_streaming: bool | None = None) -> Connection

Update this connection's configuration.

Parameters

  • label str | None: New environment label; unique among this SUT's connections
  • base_url str | None: New endpoint URL
  • auth_type str | None: New auth method
  • auth_header_name str | None: New auth header name
  • auth_header_value str | None: New credential (plaintext, encrypted at rest)
  • model_params dict[str, Any] | None: New static protocol parameters
  • sut_protocol str | None: New invocation protocol
  • gdi_schema str | None: New compatible dataset format (e.g. "gdi_text_v1")
  • task_type str | None: New task discriminator for task-scoped schemas
  • sut_streaming bool | None: Toggle response streaming for true time-to-first-byte capture. None leaves the current setting unchanged.

Returns

Raises

  • DuplicateConnectionError: If another connection on this SUT is already labelled label.
  • NotFoundError: If the connection no longer exists, or the SUT belongs to a workspace the caller is not a member of.
  • ForbiddenError: If the caller is not an editor or admin of the SUT's workspace. A platform admin must be a member of that workspace too.
  • AuthError: If credentials are missing or invalid.
  • APIError: If the update otherwise fails.