chroma-core / chroma

the AI-native open-source embedding database
https://www.trychroma.com/
Apache License 2.0
15.42k stars 1.3k forks source link

[Feature Request]: Switch to row-oriented dictionary for GetResult and QueryResult #420

Open HammadB opened 1 year ago

HammadB commented 1 year ago

Describe the problem

The return objects for GetResult and QueryResult are confusing to many users right now as they require you to match data up to your input ordering as well as internally in the result.

Describe the proposed solution

We should change GetResult and QueryResult to be row oriented dicts with id keys, or similar.

{"id" : {"embeddings", "distances", "metadata", "documents"}}

Alternatives considered

Sorting the results based on input ids. This doesn't always work (the case of ids and a where clause) and also doesn't solve all the problems

Importance

would make my life easier

Additional Information

No response

naynaly10 commented 1 year ago

What about a QueryResult and GetResult Object in Python. What about a QueryResult and GetResult Interface in Typescript.

"Skate to where the puck is going" On another note, as Chroma adds more features and complexity grows, simple objects intuitively fitting in a simple model will be the best approach to reduce complexity. Requires forward planning.

renxida commented 1 year ago

can confirm the column oriented query results are very disorienting.

if api compatibility is a concern, at least add documentation examples to mark it as column oriented, and add builtins to convert to row oriented