Skip to content

How to print the sources of vector search just like langchain? #212

Discussion options

You must be logged in to vote

Hi @abrahimzaman360,

After you get your response from the query engine:

response = query_engine.query(question)

you can get the source nodes via response.get_formatted_sources method.

print(response.get_formatted_sources(length=42000))

will probably return all the source text you have got. length parameter is for adjusting the size of the returned source context.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by fcakyon
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #208 on January 15, 2024 22:21.