Skip to content

Commit

Permalink
🔧 fix: Update maxContextTokens calculation to use correct model ident…
Browse files Browse the repository at this point in the history
…ifier for Azure (#5035)
  • Loading branch information
danny-avila authored Dec 18, 2024
1 parent e8bde33 commit 22a87b6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/server/services/Endpoints/agents/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,16 @@ const initializeAgentOptions = async ({
agent.model_parameters.model = agent.model;
}

const tokensModel =
agent.provider === EModelEndpoint.azureOpenAI ? agent.model : agent.model_parameters.model;

return {
...agent,
tools,
toolContextMap,
maxContextTokens:
agent.max_context_tokens ??
getModelMaxTokens(agent.model_parameters.model, providerEndpointMap[provider]) ??
getModelMaxTokens(tokensModel, providerEndpointMap[provider]) ??
4000,
};
};
Expand Down

0 comments on commit 22a87b6

Please sign in to comment.