mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-24 15:43:54 +00:00
anthropic[patch]: update base_url of anthropic (#18634)
A small change ~ - [ ] **update base_url**: "package: langchain_anthropic" --------- Co-authored-by: yangenfeng <yangenfeng@xiaoniangao.com> Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
This commit is contained in:
parent
a9cda536ad
commit
b20c2640da
@ -201,11 +201,16 @@ class ChatAnthropic(BaseChatModel):
|
||||
values.get("anthropic_api_key") or os.environ.get("ANTHROPIC_API_KEY") or ""
|
||||
)
|
||||
values["anthropic_api_key"] = anthropic_api_key
|
||||
values["_client"] = anthropic.Client(
|
||||
api_key=anthropic_api_key.get_secret_value()
|
||||
api_key = anthropic_api_key.get_secret_value()
|
||||
api_url = (
|
||||
values.get("anthropic_api_url")
|
||||
or os.environ.get("ANTHROPIC_API_URL")
|
||||
or "https://api.anthropic.com"
|
||||
)
|
||||
values["anthropic_api_url"] = api_url
|
||||
values["_client"] = anthropic.Client(api_key=api_key, base_url=api_url)
|
||||
values["_async_client"] = anthropic.AsyncClient(
|
||||
api_key=anthropic_api_key.get_secret_value()
|
||||
api_key=api_key, base_url=api_url
|
||||
)
|
||||
return values
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user