mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 01:10:14 +01:00
🌐 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:
parent
823015160c
commit
3d7eaf0fcc
5 changed files with 128 additions and 8 deletions
|
|
@ -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' });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue