milwright commited on
Commit
78a1f73
·
1 Parent(s): 09d70c8

fix: correct tool-calling format and contextualization truncation

Browse files

- Fix tool_choice format for OpenRouter/Gemma compatibility (use string instead of object)
- Increase max_tokens for contextualization from 50 to 80 to prevent sentence truncation
- Ensure complete sentences in metadata field

Files changed (1) hide show
  1. src/aiService.js +2 -5
src/aiService.js CHANGED
@@ -118,10 +118,7 @@ Use the ${tool.name} tool to provide an appropriate educational hint.`;
118
  type: 'function',
119
  function: tool
120
  }],
121
- tool_choice: {
122
- type: 'function',
123
- function: { name: tool.name }
124
- },
125
  max_tokens: 200,
126
  temperature: 0.3
127
  })
@@ -311,7 +308,7 @@ Passage: "${passage}"`
311
  role: 'user',
312
  content: `Describe "${title}" by ${author} in one factual sentence.`
313
  }],
314
- max_tokens: 50,
315
  temperature: 0.2
316
  })
317
  });
 
118
  type: 'function',
119
  function: tool
120
  }],
121
+ tool_choice: tool.name,
 
 
 
122
  max_tokens: 200,
123
  temperature: 0.3
124
  })
 
308
  role: 'user',
309
  content: `Describe "${title}" by ${author} in one factual sentence.`
310
  }],
311
+ max_tokens: 80,
312
  temperature: 0.2
313
  })
314
  });