feat(search-api): add optimizationMode

This commit is contained in:
ItzCrazyKns
2024-10-11 10:54:08 +05:30
parent 7cce853618
commit 0a7167eb04
3 changed files with 25 additions and 4 deletions

View File

@@ -25,6 +25,7 @@ interface embeddingModel {
}
interface ChatRequestBody {
optimizationMode: 'speed' | 'balanced';
focusMode: string;
chatModel?: chatModel;
embeddingModel?: embeddingModel;
@@ -41,6 +42,7 @@ router.post('/', async (req, res) => {
}
body.history = body.history || [];
body.optimizationMode = body.optimizationMode || 'balanced';
const history: BaseMessage[] = body.history.map((msg) => {
if (msg[0] === 'human') {
@@ -119,7 +121,7 @@ router.post('/', async (req, res) => {
return res.status(400).json({ message: 'Invalid focus mode' });
}
const emitter = searchHandler(body.query, history, llm, embeddings);
const emitter = searchHandler(body.query, history, llm, embeddings, body.optimizationMode);
let message = '';
let sources = [];