You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I included a link to the documentation page I am referring to (if applicable).
Issue with current documentation:
const getReply = async (messages, namespaceId) => {
const pinecone = new Pinecone({
apiKey: process.env.PINECONE_API_KEY,
});
const pineconeIndex = pinecone.Index(process.env.PINECONE_INDEX);
const vectorStore = await PineconeStore.fromExistingIndex(
new OpenAIEmbeddings(),
{ pineconeIndex, namespace: namespaceId }
);
const CONDENSE_PROMPT = `Given the following conversation and a follow up question, rephrase the follow up question to be a standalone question.
Chat History: {chat_history}
Follow Up Input: {question}
Standalone question:`;
const QA_PROMPT = `
${systemPrompt}
=========
{context}
=========
Question: {question}
Answer:`;
const chat = new ChatOpenAI({
modelName: "gpt-4",
temperature: 0.2,
apiKey: process.env.OPENAI_API_KEY,
});
const chain = ConversationalRetrievalQAChain.fromLLM(
chat,
vectorStore.asRetriever(),
{
qaTemplate: QA_PROMPT,
questionGeneratorTemplate: CONDENSE_PROMPT,
returnSourceDocuments: true,
}
);
const result = await chain.call({
chat_history: messages,
});
return result.text;
};
This is code for generating response from Pinecone by using Langchain v0.0.91.
But this code does not work in Langchain v0.1.36. How to update this code?
Idea or request for content:
No response
The text was updated successfully, but these errors were encountered:
Ensure your code includes try-catch blocks around asynchronous operations for error handling. The ConversationalRetrievalQAChain class initialization has changed, so refer to the ConversationalRetrievalQAChain class for configuring parameters and options.
This should make your code compatible with LangChain v0.1.36. If you need further assistance, feel free to ask.
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
Checklist
Issue with current documentation:
This is code for generating response from Pinecone by using Langchain v0.0.91.
But this code does not work in Langchain v0.1.36. How to update this code?
Idea or request for content:
No response
The text was updated successfully, but these errors were encountered: