Reapply "add app headers for openrouter"
This reverts commit 56ccd938f7.
This commit is contained in:
parent
56ccd938f7
commit
f9c83d496c
|
|
@ -122,6 +122,11 @@ def create_openrouter_client(
|
|||
is_expert: bool = False,
|
||||
) -> BaseChatModel:
|
||||
"""Create OpenRouter client with appropriate configuration."""
|
||||
default_headers = {
|
||||
"HTTP-Referer": "https://ra-aid.ai",
|
||||
"X-Title": "RA.Aid"
|
||||
}
|
||||
|
||||
if model_name.startswith("deepseek/") and "deepseek-r1" in model_name.lower():
|
||||
return ChatDeepseekReasoner(
|
||||
api_key=api_key,
|
||||
|
|
@ -132,6 +137,7 @@ def create_openrouter_client(
|
|||
model=model_name,
|
||||
timeout=LLM_REQUEST_TIMEOUT,
|
||||
max_retries=LLM_MAX_RETRIES,
|
||||
default_headers=default_headers,
|
||||
)
|
||||
|
||||
return ChatOpenAI(
|
||||
|
|
@ -140,6 +146,7 @@ def create_openrouter_client(
|
|||
model=model_name,
|
||||
timeout=LLM_REQUEST_TIMEOUT,
|
||||
max_retries=LLM_MAX_RETRIES,
|
||||
default_headers=default_headers,
|
||||
**({"temperature": temperature} if temperature is not None else {}),
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue