The client: an authenticated HttpClient for the Bedrock Runtime
operations it does not model, and the Converse calls. make builds
it; Service(client, converse, converse_stream) makes one of two
functions (a test double, say).
Attributes#
| Attribute | Type | Description |
|---|---|---|
client | HttpClientService[HttpClientError | AiError] = client | The underlying client with the base URL and authentication; resolving
the credentials can fail with an |
Functions#
__init__#
__init__(client, converse, converse_stream) -> None| Parameter | Type | Description |
|---|---|---|
client | HttpClientService[HttpClientError | AiError] | |
converse | Callable[[W.ConverseRequest], Effect[W.ConverseResponse, AiError]] | |
converse_stream | Callable[[W.ConverseRequest], Stream[W.ConverseStreamEvent, AiError]] |
def __init__(
self,
client: HttpClientService[HttpClientError | AiError],
converse: Callable[[W.ConverseRequest], Effect[W.ConverseResponse, AiError]],
converse_stream: Callable[[W.ConverseRequest], Stream[W.ConverseStreamEvent, AiError]],
) -> None:
self.client = client
self._converse = converse
self._converse_stream = converse_streamconverse#
converse(request) -> Effect[W.ConverseResponse, AiError]The Converse operation: modelId names the model in the URL,
the other fields are the body; an AmazonBedrockConfig in context
transforms the client for this call.
| Parameter | Type | Description |
|---|---|---|
request | W.ConverseRequest |
Returns Effect[W.ConverseResponse, AiError]
def converse(self, request: W.ConverseRequest) -> Effect[W.ConverseResponse, AiError]:
"""The Converse operation: ``modelId`` names the model in the URL,
the other fields are the body; an ``AmazonBedrockConfig`` in context
transforms the client for this call."""
return self._converse(request)converse_stream#
converse_stream(request) -> Stream[W.ConverseStreamEvent, AiError]The ConverseStream operation's decoded events.
| Parameter | Type | Description |
|---|---|---|
request | W.ConverseRequest |
Returns Stream[W.ConverseStreamEvent, AiError]
def converse_stream(self, request: W.ConverseRequest) -> Stream[W.ConverseStreamEvent, AiError]:
"""The ConverseStream operation's decoded events."""
return self._converse_stream(request)