From 24e2819acbca1edc11a2ac514d87a07efbd87dee Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 19 Dec 2024 12:40:58 -0800 Subject: [PATCH] fix chat describer tests --- core/util/chatDescriber.test.ts | 8 ++++---- core/util/chatDescriber.ts | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/util/chatDescriber.test.ts b/core/util/chatDescriber.test.ts index 0b9e4aaf4..0e8851120 100644 --- a/core/util/chatDescriber.test.ts +++ b/core/util/chatDescriber.test.ts @@ -1,6 +1,6 @@ -import { ChatDescriber } from "./chatDescriber"; -import { testLLM } from "../test/fixtures"; import { LLMFullCompletionOptions } from ".."; +import { testLLM } from "../test/fixtures"; +import { ChatDescriber } from "./chatDescriber"; describe("ChatDescriber", () => { beforeEach(() => { @@ -30,7 +30,7 @@ describe("ChatDescriber", () => { expect(result).toBeUndefined(); }); - it("should set completionOptions.maxTokens to 6", async () => { + it("should set completionOptions.maxTokens to 12", async () => { const message = "Test message"; const completionOptions: LLMFullCompletionOptions = { temperature: 0.7 }; @@ -38,7 +38,7 @@ describe("ChatDescriber", () => { await ChatDescriber.describe(testLLM, completionOptions, message); - expect(completionOptions.maxTokens).toBe(6); + expect(completionOptions.maxTokens).toBe(ChatDescriber.maxTokens); }); it("should call model.chat with correct parameters", async () => { diff --git a/core/util/chatDescriber.ts b/core/util/chatDescriber.ts index 5b5ac5f4d..20eab20b7 100644 --- a/core/util/chatDescriber.ts +++ b/core/util/chatDescriber.ts @@ -6,6 +6,7 @@ import type { FromCoreProtocol, ToCoreProtocol } from "../protocol"; import type { IMessenger } from "../protocol/messenger"; export class ChatDescriber { + static maxTokens = 12; static prompt: string | undefined = "Given the following... please reply with a short summary that is 4-8 words in length, you should summarize what the user is asking for OR what the user is trying to accomplish. You should only respond with the summary, no additional text or explanation, you don't need ending punctuation.\n\n"; static messenger: IMessenger; @@ -26,7 +27,7 @@ export class ChatDescriber { return; } - completionOptions.maxTokens = 12; + completionOptions.maxTokens = ChatDescriber.maxTokens; // Prompt the user's current LLM for the title const titleResponse = await model.chat(