PROMPT ISSUE #6083
Unanswered
LakshyaTambi
asked this question in
Q&A
PROMPT ISSUE
#6083
Replies: 2 comments
-
To resolve the
Here’s the updated code: import { MultiQueryRetriever } from "langchain/retrievers/multi_query";
import { PromptTemplate, ChatPromptTemplate } from "@langchain/core/prompts";
import { RunnablePassthrough } from "@langchain/core/runnables";
import { StrOutputParser } from "@langchain/core/output_parsers";
import { MemoryVectorStore } from "langchain/vectorstores/memory";
import { ChatOpenAI } from "@langchain/openai";
// Assuming db and llm are already defined
const retriever = MultiQueryRetriever.fromLLM({
retriever: db.asRetriever(),
llm,
prompt: new PromptTemplate({
inputVariables: ["question"],
template: (
"You are a resume evaluator. Your task is to calculate the total work experience of the person by summing the duration of each listed job or position. Extract experience from the resume and provide the person's name along with their total years of work experience. (Note - present month is July 2024). Please give only the desired output in JSON format. Question: {question}"
),
}),
});
const template = `You are provided with the following data from resumes: {docs}. Using this data, identify the user's question. Here is the question: {question}`;
const prompt = ChatPromptTemplate.fromTemplate(template);
const chain = {
docs: retriever,
question: new RunnablePassthrough(),
} | prompt | llm | new StrOutputParser();
chain.invoke(input("Enter your query:")); In this updated code:
This should resolve the |
Beta Was this translation helpful? Give feedback.
0 replies
-
@LakshyaTambi it seems this is python code. You're currently in the langchainjs forum. Do you mean to ask on the langchain python repo? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Checked other resources
Commit to Help
Example Code
Description
KeyError: "Input to PromptTemplate is missing variables {'query'}. Expected: ['query'] Received: ['question']"
System Info
OK
Beta Was this translation helpful? Give feedback.
All reactions