anthropic[patch]: env ANTHROPIC_API_URL not work (#20507)

enviroment variable ANTHROPIC_API_URL will not work if anthropic_api_url
has default value

---------

Co-authored-by: Eugene Yurtsev <eugene@langchain.dev>
This commit is contained in:
Fayfox 2024-04-16 22:16:51 +08:00 committed by GitHub
parent b48add4353
commit 9fd36efdb5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -251,7 +251,7 @@ class ChatAnthropic(BaseChatModel):
max_retries: int = 2
"""Number of retries allowed for requests sent to the Anthropic Completion API."""
anthropic_api_url: str = "https://api.anthropic.com"
anthropic_api_url: Optional[str] = None
anthropic_api_key: Optional[SecretStr] = Field(None, alias="api_key")
"""Automatically read from env var `ANTHROPIC_API_KEY` if not provided."""