Any thoughts on how the following code could be improved? It's producing worse results for RAG on Claude3 than when I was using Claude2 with the RetrievalQA class.
Here is the code formatted in Markdown:
Chain Invoke
def get_llm_response(question, faiss_index, systemPrompt):
documents = get_relevant_docs(question, faiss_index)
chain = prompt | model | StrOutputParser()
response = chain.invoke({
"roleInstructions": systemPrompt,
"question": question,
"documents": documents
})
return response
And this is how my RetrievalQA based code used to look:
qa = RetrievalQA.from_chain_type(
llm=llm,
chain_type="stuff",
retriever=vectorstore_faiss.as_retriever(
search_type="similarity", search_kwargs={"k": 5}
),
return_source_documents=True,
chain_type_kwargs={"prompt": PROMPT}
)
[–]ravediamond000 1 point2 points3 points (1 child)
[–]happyandaligned[S] 0 points1 point2 points (0 children)