----------------------
It seems you are encountering deprecation warnings when trying to access the
source_text
and
doc_id
attributes of the
SourceNode
objects. To resolve these warnings, you should use the recommended methods instead:
- Replace
.source_text
with .node.get_text()
- Replace
.doc_id
with .node.ref_doc_id
Here's an example of how to get the sources and their document IDs using the recommended methods:
# Assuming you have a response object after querying the index
response = index.query("<query_str>")
# Get sources
sources = response.source_nodes
# Iterate through the sources and get the source text and document ID
for source in sources:
source_text = source.node.get_text()
doc_id = source.node.ref_doc_id
print(f"Source Text: {source_text}\nDocument ID: {doc_id}\n")
Please note that the code above is based on the information provided in the warning messages and not directly from the information extracts.
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------