fix chat describer tests

This commit is contained in:
Nate 2024-12-19 12:40:58 -08:00
parent 12f9a209f8
commit 24e2819acb
2 changed files with 6 additions and 5 deletions

View file

@ -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 () => {

View file

@ -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<ToCoreProtocol, FromCoreProtocol>;
@ -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(