From 7fa51f611c09b18b62a84047f0569af0a3578293 Mon Sep 17 00:00:00 2001 From: bracesproul Date: Mon, 8 Apr 2024 13:57:11 -0700 Subject: [PATCH] fix build issues --- examples/src/chat/overview.ts | 5 +---- examples/src/models/chat/chat.ts | 4 ---- .../src/models/chat/integration_openai_generation_info.ts | 2 +- examples/src/models/llm/openai-batch.ts | 2 +- langchain/src/agents/agent.ts | 2 +- 5 files changed, 4 insertions(+), 11 deletions(-) diff --git a/examples/src/chat/overview.ts b/examples/src/chat/overview.ts index ab3ec8d6068c..e8ecd6581393 100644 --- a/examples/src/chat/overview.ts +++ b/examples/src/chat/overview.ts @@ -38,22 +38,19 @@ export const run = async () => { // Sending two separate prompts in parallel, receiving two responses back const responseA = await chat.invoke([ - [ + new SystemMessage( "You are a helpful assistant that translates English to French." ), new HumanMessage( "Translate this sentence from English to French. I love programming." ), - ], - [ new SystemMessage( "You are a helpful assistant that translates English to French." ), new HumanMessage( "Translate this sentence from English to French. I love artificial intelligence." ), - ], ]); console.log(responseA); diff --git a/examples/src/models/chat/chat.ts b/examples/src/models/chat/chat.ts index 399c9aebabf0..516a2c092fbb 100644 --- a/examples/src/models/chat/chat.ts +++ b/examples/src/models/chat/chat.ts @@ -26,22 +26,18 @@ export const run = async () => { // Similar to LLMs, you can also use `generate` to generate chat completions for multiple sets of messages. const responseC = await chat.invoke([ - [ new SystemMessage( "You are a helpful assistant that translates English to French." ), new HumanMessage( "Translate this sentence from English to French. I love programming." ), - ], - [ new SystemMessage( "You are a helpful assistant that translates English to French." ), new HumanMessage( "Translate this sentence from English to French. I love artificial intelligence." ), - ], ]); console.log(responseC); /* diff --git a/examples/src/models/chat/integration_openai_generation_info.ts b/examples/src/models/chat/integration_openai_generation_info.ts index 35c658738bb6..780c6430fa21 100644 --- a/examples/src/models/chat/integration_openai_generation_info.ts +++ b/examples/src/models/chat/integration_openai_generation_info.ts @@ -7,7 +7,7 @@ const model = new ChatOpenAI({ // topLogprobs: 5, }); -const generations = await model.invoke([[new HumanMessage("Hi there!")]]); +const generations = await model.invoke([new HumanMessage("Hi there!")]); console.log(JSON.stringify(generations, null, 2)); diff --git a/examples/src/models/llm/openai-batch.ts b/examples/src/models/llm/openai-batch.ts index a32791e8fe95..6b0efb0eb526 100644 --- a/examples/src/models/llm/openai-batch.ts +++ b/examples/src/models/llm/openai-batch.ts @@ -20,7 +20,7 @@ const chat = new ChatOpenAI({ modelName: "gpt-3.5-turbo", }); -const messages = prompts.map((prompt) => [new HumanMessage(prompt)]); +const messages = prompts.map((prompt) => new HumanMessage(prompt)); const res2 = await chat.invoke(messages); console.log({ res2 }); diff --git a/langchain/src/agents/agent.ts b/langchain/src/agents/agent.ts index a910883c6913..f040c69aa126 100644 --- a/langchain/src/agents/agent.ts +++ b/langchain/src/agents/agent.ts @@ -603,7 +603,7 @@ export abstract class Agent extends BaseSingleActionAgent { newInputs.stop = this._stop(); } - const output = await this.llmChain.invoke(newInputs, callbackManager); + const output = await this.llmChain.predict(newInputs, callbackManager); if (!this.outputParser) { throw new Error("Output parser not set"); }