Find answers from the community

Updated 11 months ago

I have a quick question.

I have a quick question.
I have a few records in a json file as such:
Plain Text
[
  "id": "xxxx",
  "title": "some title",
  "text": "Main text for embeddings"
  "some_other_key": "some_other_value"
  "other_key_2": "other_value_2"
]


I want to make a Document() out of this dictionary where the text should be the key text and the metadata is all other keys from the dictionary except text. Is there a smart way to do this, or do I just have to loop all the keys of the record?
L
S
6 comments
Just have to loop

Document(text=record['text'], id_=record['id'], metadata={...})
the way you added id_ in the params, can we do that for as many keys as we want, or id_ is something particular?
It just has to be something unique. If it's not provided, it gets generated as a random UUID
Add a reply
Sign up and join the conversation on Discord