Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

Add tool choice type

Akarshan6b86baaa2f16
diff --git a/core/src/browser/extensions/engines/AIEngine.ts b/core/src/browser/extensions/engines/AIEngine.ts
index 90d78a97a..2d75dea8f 100644
--- a/core/src/browser/extensions/engines/AIEngine.ts
+++ b/core/src/browser/extensions/engines/AIEngine.ts
@@ -38,10 +38,22 @@ export interface ToolCallOptions {
tools?: Tool[];
}
+// A specific tool choice to force the model to call
+export interface ToolCallSpec {
+ type: 'function';
+ function: {
+ name: string;
+ };
+}
+
+// tool_choice may be one of several modes or a specific call
+export type ToolChoice = 'none' | 'auto' | 'required' | ToolCallSpec;
+
export interface chatCompletionRequest {
model: string; // Model ID, though for local it might be implicit via sessionInfo
messages: chatCompletionRequestMessage[];
tools?: Tool[];
+ tool_choice?: ToolChoice;
// Core sampling parameters
temperature?: number | null
dynatemp_range?: number | null