Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Singular Convenience Methods/Interfaces for Chroma Clients #2492

Open
AlabasterAxe opened this issue Jul 10, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@AlabasterAxe
Copy link
Contributor

AlabasterAxe commented Jul 10, 2024

Describe the problem

Currently, the clients allow some flexibility for accepting single values or multiple values in a few different contexts. For example, the method to add records supports supplying an single string or an array of strings for the ids field. This is nice but it can lead to unintuitive code IMO:

addRecords(collection, {
  ids: "record_id", // <= this looks surprising since this field is called "ids"
  embeddings: [1, 2, 3],
})

Describe the proposed solution

One potential solution would be to allow the request params object to be one of a couple of different flavors:

interface SingleAddRecordParams {
  id: string;
  embedding: number[];
  // ...
}

interface MultiAddRecordParams {
  ids: string[],
  embeddings: number[][];
  // ...
}

This would give clients more structure so they would get type errors if they attempted to pass in, for example an array of ids, but a single embedding. It also just leads to more readable code IMO.

This change would apply to both the add/update/upsert methods as well as the query methods.

Alternatives considered

One alternative here would be to add singular convenience methods, e.g. addRecord() which only accepts the single record add variant.

Importance

nice to have

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant