-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
langchain[patch]: Miscellaneous test fixes #3497
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,7 +87,7 @@ test("Test traced chain with tags", async () => { | |
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey team, just a heads up that I've flagged the change in the test file for the |
||
test("Test Traced Agent with concurrency", async () => { | ||
process.env.LANGCHAIN_TRACING_V2 = "true"; | ||
const model = new OpenAI({ temperature: 0 }); | ||
const model = new ChatOpenAI({ temperature: 0 }); | ||
const tools = [ | ||
new SerpAPI(process.env.SERPAPI_API_KEY, { | ||
location: "Austin,Texas,United States", | ||
|
@@ -98,7 +98,7 @@ test("Test Traced Agent with concurrency", async () => { | |
]; | ||
|
||
const executor = await initializeAgentExecutorWithOptions(tools, model, { | ||
agentType: "zero-shot-react-description", | ||
agentType: "openai-functions", | ||
verbose: true, | ||
}); | ||
|
||
|
@@ -130,7 +130,7 @@ test("Test Traced Agent with chat model", async () => { | |
]; | ||
|
||
const executor = await initializeAgentExecutorWithOptions(tools, model, { | ||
agentType: "chat-zero-shot-react-description", | ||
agentType: "openai-functions", | ||
verbose: true, | ||
metadata: { c: "d" }, | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1 @@ | ||
import { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey team, just a heads up that this PR introduces a new fetch request for an external HTTP resource. This comment is to flag the change for maintainers to review the addition of this new request. |
||
Tiktoken, | ||
TiktokenBPE, | ||
TiktokenEncoding, | ||
TiktokenModel, | ||
getEncodingNameForModel, | ||
} from "js-tiktoken/lite"; | ||
import { AsyncCaller } from "./async_caller.js"; | ||
|
||
const cache: Record<string, Promise<TiktokenBPE>> = {}; | ||
|
||
const caller = /* #__PURE__ */ new AsyncCaller({}); | ||
|
||
export async function getEncoding( | ||
encoding: TiktokenEncoding, | ||
options?: { | ||
signal?: AbortSignal; | ||
extendedSpecialTokens?: Record<string, number>; | ||
} | ||
) { | ||
if (!(encoding in cache)) { | ||
cache[encoding] = caller | ||
.fetch(`https://tiktoken.pages.dev/js/${encoding}.json`, { | ||
signal: options?.signal, | ||
}) | ||
.then((res) => res.json()) | ||
.catch((e) => { | ||
delete cache[encoding]; | ||
throw e; | ||
}); | ||
} | ||
|
||
return new Tiktoken(await cache[encoding], options?.extendedSpecialTokens); | ||
} | ||
|
||
export async function encodingForModel( | ||
model: TiktokenModel, | ||
options?: { | ||
signal?: AbortSignal; | ||
extendedSpecialTokens?: Record<string, number>; | ||
} | ||
) { | ||
return getEncoding(getEncodingNameForModel(model), options); | ||
} | ||
export * from "@langchain/core/utils/tiktoken"; |
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.
Hey there! 👋 I noticed the update to the "@langchain/core" dependency from "~0.0.5" to "~0.0.6" in the package.json. This change may impact peer/dev/hard dependencies, so I'm flagging it for the maintainers to review. Great work on the PR! 🚀