fix(llms): pass configured anthropic_base_url to the Anthropic client (#5626)

This commit is contained in:
Yash Singh
2026-06-23 16:26:22 +05:30
committed by GitHub
parent fa9abc77a6
commit 15a930dac2
2 changed files with 38 additions and 1 deletions
+5 -1
View File
@@ -38,7 +38,11 @@ class AnthropicLLM(LLMBase):
self.config.model = "claude-sonnet-4-6"
api_key = self.config.api_key or os.getenv("ANTHROPIC_API_KEY")
self.client = anthropic.Anthropic(api_key=api_key)
base_url = self.config.anthropic_base_url or os.getenv("ANTHROPIC_BASE_URL")
client_kwargs = {"api_key": api_key}
if base_url:
client_kwargs["base_url"] = base_url
self.client = anthropic.Anthropic(**client_kwargs)
def _get_common_params(self, **kwargs) -> Dict:
"""Get common parameters, avoiding sending both temperature and top_p together.