|
|
@ -72,15 +72,17 @@ class ModelFactory: |
|
|
|
|
|
|
|
|
elif provider_name == 'openrouter': |
|
|
elif provider_name == 'openrouter': |
|
|
return OpenRouter( |
|
|
return OpenRouter( |
|
|
id =model_config_data['id'], |
|
|
|
|
|
|
|
|
id=model_config_data['id'], |
|
|
api_key=api_key, |
|
|
api_key=api_key, |
|
|
base_url=base_url, |
|
|
base_url=base_url, |
|
|
collect_metrics_on_completion=True, |
|
|
collect_metrics_on_completion=True, |
|
|
max_tokens=model_config_data.get('max_tokens', 4096), |
|
|
max_tokens=model_config_data.get('max_tokens', 4096), |
|
|
default_headers={ |
|
|
default_headers={ |
|
|
"Authorization": f"Bearer {api_key}", |
|
|
|
|
|
"Content-Type": "application/json" |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
"Authorization": f"Bearer {api_key}", |
|
|
|
|
|
"Content-Type": "application/json", |
|
|
|
|
|
"HTTP-Referer": os.getenv("APP_URL", "https://imamreza.ir"), |
|
|
|
|
|
"X-Title": os.getenv("APP_TITLE", "Imam Reza Shrine Agent"), |
|
|
|
|
|
}, |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
raise ValueError(f"Model '{model_name}' not found in configuration") |
|
|
raise ValueError(f"Model '{model_name}' not found in configuration") |