This commit is contained in:
@@ -47,11 +47,13 @@ class AnthropicToolCallingClient:
|
||||
transport: Any | None = None,
|
||||
max_tokens: int = 1024,
|
||||
api_key: str | None = None,
|
||||
base_url: str | None = None,
|
||||
) -> None:
|
||||
self.model = model
|
||||
self._transport = transport
|
||||
self.max_tokens = max_tokens
|
||||
self._api_key = api_key
|
||||
self._base_url = base_url
|
||||
|
||||
def decide(
|
||||
self,
|
||||
@@ -120,11 +122,12 @@ class AnthropicToolCallingClient:
|
||||
except Exception as exc:
|
||||
raise ToolCallUnavailable("anthropic SDK is unavailable") from exc
|
||||
|
||||
self._transport = (
|
||||
anthropic.Anthropic(api_key=self._api_key)
|
||||
if self._api_key is not None
|
||||
else anthropic.Anthropic()
|
||||
)
|
||||
client_kwargs: dict[str, str] = {}
|
||||
if self._api_key is not None:
|
||||
client_kwargs["api_key"] = self._api_key
|
||||
if self._base_url is not None:
|
||||
client_kwargs["base_url"] = self._base_url
|
||||
self._transport = anthropic.Anthropic(**client_kwargs)
|
||||
return self._transport
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user