Fix Mistral API parameter naming issue
- Change maxTokens to max_tokens for Mistral API compatibility - Extract maxTokens from options before spreading to avoid parameter conflicts - Tested successfully with live API calls
This commit is contained in:
parent
d2894af925
commit
5b67cca5cb
@ -50,6 +50,8 @@ Output format: JSON with fields {proposal, justification, confidence (0-1), depe
|
|||||||
* Call Mistral AI API
|
* Call Mistral AI API
|
||||||
*/
|
*/
|
||||||
async function callMistralAPI(messages, options = {}) {
|
async function callMistralAPI(messages, options = {}) {
|
||||||
|
const { maxTokens, ...otherOptions } = options;
|
||||||
|
|
||||||
const response = await fetch(MISTRAL_API_URL, {
|
const response = await fetch(MISTRAL_API_URL, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -60,8 +62,8 @@ async function callMistralAPI(messages, options = {}) {
|
|||||||
model: options.model || 'mistral-small-latest',
|
model: options.model || 'mistral-small-latest',
|
||||||
messages,
|
messages,
|
||||||
temperature: options.temperature || 0.7,
|
temperature: options.temperature || 0.7,
|
||||||
max_tokens: options.maxTokens || 2048,
|
max_tokens: maxTokens || 2048,
|
||||||
...options
|
...otherOptions
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user