Find answers from the community

Updated 4 months ago

Include sources in the response

At a glance

The post asks how to include sources in the response when using the GPT index. A community member responds with an example of how to use the get_formatted_sources() method to print the sources associated with the response in a formatted manner. The example is from the Simple Index Demo in the GPT index repository. The community member also notes that the user can ask a follow-up question by mentioning them again.

Useful resources
Include sources in the response
k
2 comments
Please stand by @cK5150 as I search the knowledge base. We are experiencing especially high traffic right now and might take longer than usual. :wave:
----------------------
To include sources in the response when using GPT index, you can use the get_formatted_sources() method. Here's an example from the Simple Index Demo (https://github.com/jerryjliu/gpt_index/tree/main/examples/vector_indices/SimpleIndexDemo.ipynb):

Plain Text
print(response.get_formatted_sources())


This method will print the sources associated with the response in a formatted manner.
----------------------
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