The client: the configured HttpClient and its calls. make
builds it; Service(http_client, system_one, list_models) makes one
of two functions (a test double, say).
Attributes#
| Attribute | Type | Description |
|---|---|---|
http_client | HttpClientService[HttpClientError] = http_client |
Functions#
__init__#
__init__(http_client, system_one, list_models) -> None| Parameter | Type | Description |
|---|---|---|
http_client | HttpClientService[HttpClientError] | |
system_one | Callable[[W.SystemOneRequest], Effect[W.SystemOneResponse, AiError]] | |
list_models | Callable[[], Effect[W.ListModelsResponse, AiError]] |
def __init__(
self,
http_client: HttpClientService[HttpClientError],
system_one: Callable[[W.SystemOneRequest], Effect[W.SystemOneResponse, AiError]],
list_models: Callable[[], Effect[W.ListModelsResponse, AiError]],
) -> None:
self.http_client = http_client
self._system_one = system_one
self._list_models = list_modelssystem_one#
system_one(request) -> Effect[W.SystemOneResponse, AiError]Ask System One request 's questions: POST /systemone,
sending TypeSafe-Danger-Zone-Images: true when the request has
assets or a box question; a TypeSafeConfig in context transforms
the client for this call. Every failure is an AiError: an error
status maps to its reason, an undecodable body to an
InvalidOutputError or InvalidResponseError, a transport
failure to a NetworkError. Nothing is retried.
| Parameter | Type | Description |
|---|---|---|
request | W.SystemOneRequest |
Returns Effect[W.SystemOneResponse, AiError]
def system_one(self, request: W.SystemOneRequest) -> Effect[W.SystemOneResponse, AiError]:
"""Ask System One ``request`` 's questions: ``POST /systemone``,
sending ``TypeSafe-Danger-Zone-Images: true`` when the request has
assets or a box question; a ``TypeSafeConfig`` in context transforms
the client for this call. Every failure is an ``AiError``: an error
status maps to its reason, an undecodable body to an
``InvalidOutputError`` or ``InvalidResponseError``, a transport
failure to a ``NetworkError``. Nothing is retried."""
return self._system_one(request)list_models#
list_models() -> Effect[W.ListModelsResponse, AiError]The available models: GET /models. Fails as system_one.
Returns Effect[W.ListModelsResponse, AiError]
def list_models(self) -> Effect[W.ListModelsResponse, AiError]:
"""The available models: ``GET /models``. Fails as ``system_one``."""
return self._list_models()