-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MRKL prompt fix, integration test (#1138)
* MRKL prompt fix, integration test * Lint and format --------- Co-authored-by: Jacob Lee <jacob@autocode.com>
- Loading branch information
1 parent
7c59816
commit 13a37bc
Showing
6 changed files
with
71 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* eslint-disable no-process-env */ | ||
import { ChatOpenAI } from "../../chat_models/openai.js"; | ||
import { SerpAPI } from "../../tools/serpapi.js"; | ||
import { Calculator } from "../../tools/calculator.js"; | ||
import { initializeAgentExecutorWithOptions } from "../initialize.js"; | ||
import { DynamicTool } from "../../tools/dynamic.js"; | ||
|
||
test("Run agent locally with GPT-3.5", async () => { | ||
const model = new ChatOpenAI({ temperature: 0, modelName: "gpt-3.5-turbo" }); | ||
const tools = [ | ||
new SerpAPI(undefined, { | ||
location: "Austin,Texas,United States", | ||
hl: "en", | ||
gl: "us", | ||
}), | ||
new Calculator(), | ||
new DynamicTool({ | ||
name: "foo", | ||
description: "Some other tool that does foo", | ||
func: async () => "bar", | ||
}), | ||
]; | ||
|
||
const executor = await initializeAgentExecutorWithOptions(tools, model, { | ||
agentType: "zero-shot-react-description", | ||
}); | ||
|
||
const input = `What is the weather like in Washington DC?`; | ||
console.log(`Executing with input "${input}"...`); | ||
|
||
const result = await executor.call({ input }); | ||
|
||
console.log(`Got output ${result.output}`); | ||
}); | ||
|
||
test("Run agent locally with GPT-4", async () => { | ||
const model = new ChatOpenAI({ temperature: 0, modelName: "gpt-4" }); | ||
const tools = [ | ||
new SerpAPI(undefined, { | ||
location: "Austin,Texas,United States", | ||
hl: "en", | ||
gl: "us", | ||
}), | ||
new Calculator(), | ||
new DynamicTool({ | ||
name: "foo", | ||
description: "Some other tool that does foo", | ||
func: async () => "bar", | ||
}), | ||
]; | ||
|
||
const executor = await initializeAgentExecutorWithOptions(tools, model, { | ||
agentType: "zero-shot-react-description", | ||
}); | ||
|
||
const input = `What is the weather like in Washington DC?`; | ||
console.log(`Executing with input "${input}"...`); | ||
|
||
const result = await executor.call({ input }); | ||
|
||
console.log(`Got output ${result.output}`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13a37bc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
langchainjs-docs – ./
langchainjs-docs-git-main-langchain.vercel.app
langchainjs-docs-langchain.vercel.app
langchainjs-docs-ruddy.vercel.app
js.langchain.com