🌐 feat: OpenRouter Web Search (#9853)

* 🌐 feat: OpenRouter Web Search

- Added tests for handling web_search parameter with OpenRouter in various scenarios.
- Implemented logic to manage web_search in modelOptions and addParams/dropParams.
- Ensured correct configuration of llmConfig and modelKwargs for OpenRouter, including handling of plugins.
- Improved overall integration of OpenRouter with OpenAI API, ensuring expected behavior across different configurations.

* chore: bump @librechat/agents to v2.4.81
This commit is contained in:
Danny Avila 2025-09-26 09:35:41 -04:00 committed by GitHub
parent 823015160c
commit 3d7eaf0fcc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 128 additions and 8 deletions

View file

@ -180,7 +180,12 @@ export function getOpenAILLMConfig({
enableWebSearch = false;
}
if (enableWebSearch) {
if (useOpenRouter && enableWebSearch) {
/** OpenRouter expects web search as a plugins parameter */
modelKwargs.plugins = [{ id: 'web' }];
hasModelKwargs = true;
} else if (enableWebSearch) {
/** Standard OpenAI web search uses tools API */
llmConfig.useResponsesApi = true;
tools.push({ type: 'web_search_preview' });
}