Find answers from the community

Updated 5 months ago

how to get the source of the LLM response while quering over the text files ?

@kapa.ai how to get the source of the LLM response while quering over the text files ?
k
2 comments
Please stand by @praveenks30#120294 as I search the knowledge base. I normally take about 20 seconds or so. :wave:
----------------------
To get the source of the LLM response while querying over the text files, you can use the get_formatted_sources() method on the response object. Here is an example of how you can do it:

Plain Text
print(response.get_formatted_sources())


This method will return the sources of the response in a formatted manner.

You can also display the sources of the evaluation results using the display_eval_sources() function:

Plain Text
display_eval_sources(query_str, response_vector, eval_source_result)


This function will display the source and evaluation result in a tabular format.

For more detailed information, you can refer to the following sources:
  • SimpleIndexDemo.ipynb ()
  • relevancy_eval ()
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Add a reply
Sign up and join the conversation on Discord