Find answers from the community

Updated last year

Chroma

help I'm using llama_index on chroma ,but there is still a question.

According to the example:Chroma - LlamaIndex 🦙 0.7.22 (gpt-index.readthedocs.io)

Normally, we delete or modify a document based on our query, not based on the ID of a document, because the document id is an internal field that we cannot know in advance. But is now based on the code:
'''
query_engine = index.as_query_engine()
response = query_engine.query("What did the author do growing up?")
'''

Now according to the sample code, we can only get the text result of the query, but cannot get the corresponding id of the text, so we cannot delete or update the query result. How to query the corresponding id of the result text based on prompt, so as to delete or modify the operation later?
L
z
3 comments
You can set the doc_id of input documents to be something known, and you can delete using that ID later
The response also has the ID of each source node

response.source_nodes[0].node.ref_doc_id
@Logan M

dear Logan:
follow is my code.there are still 4 quetions :
1、query result id can not del ;
2、and how i can update the query result 。I need to base on query result del and update。help!
3、and how to add a new record.
4、when i delete by ids= response.source_nodes[0].node.ref_doc_id,i got a error such as:
'''
count before 334
Delete of nonexisting embedding ID: 531eee82-ad95-48f6-803a-f8117e0fbde9
Delete of nonexisting embedding ID: 531eee82-ad95-48f6-803a-f8117e0fbde9
count after 334
‘’‘
Add a reply
Sign up and join the conversation on Discord