mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-04-07 00:15:23 +02:00
Merge 4b83411ac3 into 8ed0bcf5ca
This commit is contained in:
commit
9a5c3dd723
3 changed files with 23 additions and 1 deletions
|
|
@ -80,7 +80,12 @@ export async function initializeAnthropic({
|
|||
const anthropicConfig = appConfig?.endpoints?.[EModelEndpoint.anthropic];
|
||||
const allConfig = appConfig?.endpoints?.all;
|
||||
|
||||
const result = getLLMConfig(credentials, clientOptions);
|
||||
const result = getLLMConfig(credentials, {
|
||||
...clientOptions,
|
||||
...(anthropicConfig?.addParams != null && { addParams: anthropicConfig.addParams }),
|
||||
...(anthropicConfig?.dropParams != null && { dropParams: anthropicConfig.dropParams }),
|
||||
...(anthropicConfig?.defaultParams != null && { defaultParams: anthropicConfig.defaultParams }),
|
||||
});
|
||||
|
||||
if (anthropicConfig?.streamRate) {
|
||||
(result.llmConfig as Record<string, unknown>)._lc_stream_delay = anthropicConfig.streamRate;
|
||||
|
|
|
|||
|
|
@ -1535,6 +1535,17 @@ describe('getLLMConfig', () => {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should omit native web_search tool when dropParams includes web_search', () => {
|
||||
const result = getLLMConfig('test-key', {
|
||||
modelOptions: {
|
||||
model: 'claude-3-opus',
|
||||
web_search: true,
|
||||
},
|
||||
dropParams: ['web_search'],
|
||||
});
|
||||
expect(result.tools).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Parameter Precedence and Override Logic', () => {
|
||||
|
|
|
|||
|
|
@ -493,6 +493,12 @@ export const anthropicEndpointSchema = baseEndpointSchema.merge(
|
|||
vertex: vertexAISchema.optional(),
|
||||
/** Optional: List of available models */
|
||||
models: z.array(z.string()).optional(),
|
||||
/** Additional parameters passed to getLLMConfig (same pattern as custom endpoints) */
|
||||
addParams: z.record(z.union([z.string(), z.number(), z.boolean(), z.null()])).optional(),
|
||||
/** Parameters excluded from the Anthropic client; e.g. web_search when using LibreChat search tools */
|
||||
dropParams: z.array(z.string()).optional(),
|
||||
/** Default parameters applied when model options omit a value */
|
||||
defaultParams: z.record(z.union([z.string(), z.number(), z.boolean(), z.null()])).optional(),
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue