From b2b838b6bd07b631a0c238e587674411c6fab7b6 Mon Sep 17 00:00:00 2001 From: jacoblee93 Date: Wed, 8 Nov 2023 15:39:10 -0800 Subject: [PATCH 1/2] Make tests not create a new assistant each time --- .../tests/openai_assistant.int.test.ts | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/langchain/src/experimental/openai_assistant/tests/openai_assistant.int.test.ts b/langchain/src/experimental/openai_assistant/tests/openai_assistant.int.test.ts index 605cdee1ad6d..8f206ceba79f 100644 --- a/langchain/src/experimental/openai_assistant/tests/openai_assistant.int.test.ts +++ b/langchain/src/experimental/openai_assistant/tests/openai_assistant.int.test.ts @@ -1,3 +1,6 @@ +/* eslint-disable no-process-env */ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ + import { z } from "zod"; import { OpenAI as OpenAIClient } from "openai"; import { AgentExecutor } from "../../../agents/executor.js"; @@ -64,7 +67,7 @@ class HumanReadableChecker extends StructuredTool { } } -test("OpenAIAssistantRunnable can be passed as an agent", async () => { +test.skip("New OpenAIAssistantRunnable can be passed as an agent", async () => { const tools = [new WeatherTool(), new HumanReadableChecker()]; const agent = await OpenAIAssistantRunnable.createAssistant({ model: "gpt-3.5-turbo-1106", @@ -90,7 +93,29 @@ test("OpenAIAssistantRunnable can be passed as an agent", async () => { */ }); -test("OpenAIAssistantRunnable is invokeable", async () => { +test("OpenAIAssistantRunnable can be passed as an agent", async () => { + const tools = [new WeatherTool(), new HumanReadableChecker()]; + const agent = new OpenAIAssistantRunnable({ + assistantId: process.env.TEST_OPENAI_ASSISTANT_ID!, + asAgent: true, + }); + const agentExecutor = AgentExecutor.fromAgentAndTools({ + agent, + tools, + }); + const assistantResponse = await agentExecutor.invoke({ + content: + "What's the weather in San Francisco and Tokyo? And will it be warm or cold in those places?", + }); + console.log(assistantResponse); + /** + { + output: "The weather in San Francisco, CA is currently 72°F and it's warm. In Tokyo, Japan, the temperature is 10°C and it's also warm." + } + */ +}); + +test.skip("Created OpenAIAssistantRunnable is invokeable", async () => { const assistant = await OpenAIAssistantRunnable.createAssistant({ model: "gpt-4", instructions: From ab653c3ed5fa4e139bc10091ff4002b5af8fa5d0 Mon Sep 17 00:00:00 2001 From: jacoblee93 Date: Wed, 8 Nov 2023 15:56:32 -0800 Subject: [PATCH 2/2] Release 0.0.184 --- langchain/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain/package.json b/langchain/package.json index 1afddcdf4522..7b5c51898be8 100644 --- a/langchain/package.json +++ b/langchain/package.json @@ -1,6 +1,6 @@ { "name": "langchain", - "version": "0.0.183", + "version": "0.0.184", "description": "Typescript bindings for langchain", "type": "module", "engines": {