Skip to content

Commit

Permalink
fix(assistants): only enable websearch on assistants with RAG (huggin…
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarrazin authored Sep 9, 2024
1 parent 092b1d2 commit c53a4b5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/server/textGeneration/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,21 @@ import { collections } from "../database";
import { ObjectId } from "mongodb";
import type { Message } from "$lib/types/Message";
import type { Assistant } from "$lib/types/Assistant";
import { assistantHasWebSearch } from "./assistant";

export async function getTools(
toolsPreference: Array<string>,
assistant: Pick<Assistant, "tools"> | undefined
assistant: Pick<Assistant, "rag" | "tools"> | undefined
): Promise<Tool[]> {
let preferences = toolsPreference;

if (assistant) {
if (assistant?.tools?.length) {
preferences = assistant.tools;
} else {
} else if (assistantHasWebSearch(assistant)) {
return [directlyAnswer, websearch];
} else {
return [directlyAnswer];
}
}

Expand Down

0 comments on commit c53a4b5

Please sign in to comment.