Getting an LLMResult from RetrievalQA #4123
Unanswered
sommohapatra
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The great thing about using .generate() with LLMChain directly is that I'm able to include tracking tags (like those with Promptlayer) into my generation, with the function returning an LLMResult rather than plain text. With RetrievalQA, though, it seems that the default output is text. It looks like part of the underlying for the RetrievalQA chain is LLMChain
You can create a chain from an index like this:
With the above function returning a RetrievalQA() object. When digging into the object's structure, you can see:
retrievalqa_object.combine_documents_chain.llm_chain
which is an LLMChain object. You can then run something like
retrievalqa_object.combine_documents_chain.llm_chain.generate([{"question": "your question", "context": "document context"}])
And boom! Running this returns us an LLMResult that we can then do other fun stuff with.
This is something that I haven't seen a Github or other discussion on yet, so figure I'd add it to the community. Questions I have for folks that have more experience here:
Beta Was this translation helpful? Give feedback.
All reactions