mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
Mistral: FC warnings
This commit is contained in:
@@ -59,7 +59,7 @@ export function aixToOpenAIChatCompletions(openAIDialect: OpenAIDialects, model:
|
||||
model: model.id,
|
||||
messages: chatMessages,
|
||||
tools: chatGenerate.tools && _toOpenAITools(chatGenerate.tools),
|
||||
tool_choice: chatGenerate.toolsPolicy && _toOpenAIToolChoice(chatGenerate.toolsPolicy),
|
||||
tool_choice: chatGenerate.toolsPolicy && _toOpenAIToolChoice(openAIDialect, chatGenerate.toolsPolicy),
|
||||
parallel_tool_calls: undefined,
|
||||
max_tokens: model.maxTokens !== undefined ? model.maxTokens : undefined,
|
||||
temperature: model.temperature !== undefined ? model.temperature : undefined,
|
||||
@@ -335,7 +335,14 @@ function _toOpenAITools(itds: AixTools_ToolDefinition[]): NonNullable<TRequest['
|
||||
});
|
||||
}
|
||||
|
||||
function _toOpenAIToolChoice(itp: AixTools_ToolsPolicy): NonNullable<TRequest['tool_choice']> {
|
||||
function _toOpenAIToolChoice(openAIDialect: OpenAIDialects, itp: AixTools_ToolsPolicy): NonNullable<TRequest['tool_choice']> {
|
||||
// [Mistral] - supports 'auto', 'none', 'any'
|
||||
if (openAIDialect === 'mistral' && itp.type !== 'auto') {
|
||||
// Note: we tried adding the 'any' model, but don't feel comfortable with altering our good parsers
|
||||
// to allow for Mistral's deviation from the de-facto norm set by the OpenAI protocol.
|
||||
throw new Error('We only support automatic tool selection for Mistral models');
|
||||
}
|
||||
|
||||
// NOTE: OpenAI has an additional policy 'none', which we don't have as it behaves like passing no tools at all.
|
||||
// Passing no tools is mandated instead of 'none'.
|
||||
switch (itp.type) {
|
||||
|
||||
@@ -170,6 +170,9 @@ export namespace OpenAIWire_Tools {
|
||||
type: z.literal('function'),
|
||||
function: z.object({ name: z.string() }),
|
||||
}),
|
||||
// [Mistral] Mistral only, requires an 'any' value
|
||||
// Commented because we'll disable Mistral function calling instead
|
||||
// z.literal('any'),
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user