🔧 fix: Update maxContextTokens calculation to use correct model identifier for Azure (#5035)

This commit is contained in:
Danny Avila 2024-12-18 11:11:38 -05:00 committed by GitHub
parent e8bde332c2
commit 22a87b6162
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -122,13 +122,16 @@ const initializeAgentOptions = async ({
agent.model_parameters.model = agent.model; agent.model_parameters.model = agent.model;
} }
const tokensModel =
agent.provider === EModelEndpoint.azureOpenAI ? agent.model : agent.model_parameters.model;
return { return {
...agent, ...agent,
tools, tools,
toolContextMap, toolContextMap,
maxContextTokens: maxContextTokens:
agent.max_context_tokens ?? agent.max_context_tokens ??
getModelMaxTokens(agent.model_parameters.model, providerEndpointMap[provider]) ?? getModelMaxTokens(tokensModel, providerEndpointMap[provider]) ??
4000, 4000,
}; };
}; };