Skip to content

Commit 951bb9d

Browse files
committed
🔧 fix: Anthropic Agent Model Assignment
1 parent b5232af commit 951bb9d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

api/server/services/Endpoints/anthropic/initialize.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { getUserKey, checkUserKeyExpiry } = require('~/server/services/UserServic
33
const { getLLMConfig } = require('~/server/services/Endpoints/anthropic/llm');
44
const { AnthropicClient } = require('~/app');
55

6-
const initializeClient = async ({ req, res, endpointOption, optionsOnly }) => {
6+
const initializeClient = async ({ req, res, endpointOption, overrideModel, optionsOnly }) => {
77
const { ANTHROPIC_API_KEY, ANTHROPIC_REVERSE_PROXY, PROXY } = process.env;
88
const expiresAt = req.body.key;
99
const isUserProvided = ANTHROPIC_API_KEY === 'user_provided';
@@ -40,10 +40,13 @@ const initializeClient = async ({ req, res, endpointOption, optionsOnly }) => {
4040
{
4141
reverseProxyUrl: ANTHROPIC_REVERSE_PROXY ?? null,
4242
proxy: PROXY ?? null,
43-
modelOptions: endpointOption.modelOptions,
43+
modelOptions: endpointOption.model_parameters,
4444
},
4545
clientOptions,
4646
);
47+
if (overrideModel) {
48+
requestOptions.modelOptions.model = overrideModel;
49+
}
4750
return getLLMConfig(anthropicApiKey, requestOptions);
4851
}
4952

0 commit comments

Comments
 (0)