aip_sdk.Connection
aip_sdk.Connection(data: dict[str, Any], client: APIClient)
A connection to a SUT (specific environment).
Attributes
idstr: Connection IDsut_idstr: Parent SUT IDlabelstr: Environment label (e.g., "staging", "prod")base_urlstr: SUT endpoint base URLauth_typestr: Authentication method ("none", "bearer", "api_key", "basic")auth_header_namestr | None: Header name for auth (e.g., "Authorization")model_paramsdict[str, Any]: Static parameters passed to the selected SUT protocolsut_protocolstr | None: Invocation protocol, e.g. "openai_chat", "huggingface_object_detection", or "rag_api"gdi_schemastr | None: GDI dataset schema this connection produces (e.g. "gdi_text_v1")task_typestr | None: Task discriminator for task-scoped schemas, e.g. "detection" for gdi_image_v1sut_streamingbool: 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_atdatetime | 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
Adapter: Adapter instance
Raises
NotFoundError: If no adapter is configured for this connection
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_configdict[str, str]: JSONPath mappings from SUT response to GDI schema Example: {"sut_response": "$.choices[0].message.content"}template_namestr | None: Optional built-in template to use as base ("openai_chat", "cv_detection", "cv_classification", "rag_api")
Returns
Adapter: Adapter instance
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
ConnectionTestResult: ConnectionTestResult with success status and raw SUT response
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
labelstr | None: New environment label; unique among this SUT's connectionsbase_urlstr | None: New endpoint URLauth_typestr | None: New auth methodauth_header_namestr | None: New auth header nameauth_header_valuestr | None: New credential (plaintext, encrypted at rest)model_paramsdict[str, Any] | None: New static protocol parameterssut_protocolstr | None: New invocation protocolgdi_schemastr | None: New compatible dataset format (e.g. "gdi_text_v1")task_typestr | None: New task discriminator for task-scoped schemassut_streamingbool | None: Toggle response streaming for true time-to-first-byte capture. None leaves the current setting unchanged.
Returns
Connection: Updated Connection instance
Raises
DuplicateConnectionError: If another connection on this SUT is already labelledlabel.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.