Skip to content
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]: Fix ImagePromptTemplate deserialization, export RemoteRunnable directly from @langchain/core #4308

Merged
merged 3 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions langchain/langchain.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,13 @@ export const config = {
alias: ["prompts", "chat"],
path: "@langchain/core/prompts",
},
{
modules: [
"ImagePromptTemplate",
],
alias: ["prompts", "image"],
path: "@langchain/core/prompts",
},
{
modules: ["PipelinePromptTemplate"],
alias: ["prompts", "pipeline"],
Expand Down
2 changes: 1 addition & 1 deletion langchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1499,7 +1499,7 @@
"dependencies": {
"@anthropic-ai/sdk": "^0.9.1",
"@langchain/community": "~0.0.20",
"@langchain/core": "~0.1.16",
"@langchain/core": "~0.1.24",
"@langchain/openai": "~0.0.12",
"binary-extensions": "^2.2.0",
"expr-eval": "^2.0.2",
Expand Down
5 changes: 5 additions & 0 deletions langchain/src/load/import_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import {
HumanMessagePromptTemplate,
MessagesPlaceholder,
SystemMessagePromptTemplate,
ImagePromptTemplate,
PipelinePromptTemplate
} from "@langchain/core/prompts";
import {
Expand Down Expand Up @@ -188,6 +189,10 @@ const prompts__chat = {
SystemMessagePromptTemplate
};
export { prompts__chat };
const prompts__image = {
ImagePromptTemplate
};
export { prompts__image };
const prompts__pipeline = {
PipelinePromptTemplate
};
Expand Down
1 change: 1 addition & 0 deletions langchain/src/load/tests/data/important_imports.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"langchain/prompts/chat/ChatPromptTemplate": "langchain_core/prompts/chat/ChatPromptTemplate",
"langchain/prompts/chat/HumanMessagePromptTemplate": "langchain_core/prompts/chat/HumanMessagePromptTemplate",
"langchain/prompts/chat/SystemMessagePromptTemplate": "langchain_core/prompts/chat/SystemMessagePromptTemplate",
"langchain/prompts/image/ImagePromptTemplate": "langchain_core/prompts/image/ImagePromptTemplate",
"langchain/schema/agent/AgentActionMessageLog": "langchain_core/agents/AgentActionMessageLog",
"langchain/schema/agent/OpenAIToolAgentAction": "langchain/agents/output_parsers/openai_tools/OpenAIToolAgentAction",
"langchain/prompts/chat/BaseMessagePromptTemplate": "langchain_core/prompts/chat/BaseMessagePromptTemplate",
Expand Down
12 changes: 12 additions & 0 deletions langchain/src/retrievers/tests/vectorstores.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ test("Test Memory Retriever with Callback", async () => {
const queryStr = "testing testing";
let startRun = 0;
let endRun = 0;
let startPromiseResolve: (v?: unknown) => void;
const startPromise = new Promise((resolve) => {
startPromiseResolve = resolve;
});
let endPromiseResolve: (v?: unknown) => void;
const endPromise = new Promise((resolve) => {
endPromiseResolve = resolve;
});

const retriever = vectorStore.asRetriever({
k: 1,
Expand All @@ -29,10 +37,12 @@ test("Test Memory Retriever with Callback", async () => {
handleRetrieverStart: async (_, query) => {
expect(query).toBe(queryStr);
startRun += 1;
startPromiseResolve();
},
handleRetrieverEnd: async (documents) => {
expect(documents[0].pageContent).toBe(pageContent);
endRun += 1;
endPromiseResolve();
},
},
],
Expand All @@ -41,6 +51,8 @@ test("Test Memory Retriever with Callback", async () => {
const results = await retriever.getRelevantDocuments(queryStr);

expect(results).toEqual([new Document({ metadata: { a: 1 }, pageContent })]);
await startPromise;
await endPromise;
expect(startRun).toBe(1);
expect(endRun).toBe(1);
});
Loading
Loading