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

[ENH] VoyageAI embedding function #1871

Closed
wants to merge 27 commits into from
Closed

Conversation

fzowl
Copy link

@fzowl fzowl commented Mar 14, 2024

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • ...
  • New functionality
    • ...

Test plan

How are these changes tested?

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Documentation Changes

Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs repository?

Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

self._client.embed(
input[i : i + self._batch_size],
model=self._model_name,
input_type="document",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a separate input_type for queries? https://docs.voyageai.com/docs/embeddings#python-api

can you expand on how this needs to work?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeffchuber, reading the API docs, I help but notice that there is special prompt that gets prepended to each document. We don't have semantics to represent what the embedding will be used for, and I think we should not default to anything else than None to avoid skewing results.

body: JSON.stringify({
input: texts.slice(index, index + this.batch_size),
model: this.model_name,
truncation: this.truncation,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this take a document/query param like python?

Copy link
Contributor

@tazarov tazarov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nits on the JS implementation and let's drop the python functionality in favor of #1327

chromadb/utils/embedding_functions.py Outdated Show resolved Hide resolved
clients/js/src/embeddings/VoyageAIEmbeddingFunction.ts Outdated Show resolved Hide resolved
clients/js/src/embeddings/VoyageAIEmbeddingFunction.ts Outdated Show resolved Hide resolved
clients/js/test/add.collections.test.ts Outdated Show resolved Hide resolved
clients/js/src/embeddings/VoyageAIEmbeddingFunction.ts Outdated Show resolved Hide resolved
@fzowl fzowl changed the title VoyageAI embedding function [ENH] VoyageAI embedding function Apr 10, 2024
@fzowl fzowl requested a review from tazarov April 11, 2024 18:24
@fzowl
Copy link
Author

fzowl commented Apr 15, 2024

@tazarov Can you please recheck this PR?

Copy link
Contributor

@tazarov tazarov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. Thank you so much for sticking with this @fzowl.

small nit: I think we recently added prettier support did you try to run that (I see some formatting changes in index.ts

@fzowl
Copy link
Author

fzowl commented Apr 18, 2024

@tazarov I just tried, but Prettier modified lots of files for me.
I applied the changes for the files i added/modified only.
Please check and merge if you are fine with the changes.

Copy link
Contributor

@tazarov tazarov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tazarov
Copy link
Contributor

tazarov commented Apr 18, 2024

@tazarov I just tried, but Prettier modified lots of files for me. I applied the changes for the files i added/modified only. Please check and merge if you are fine with the changes.

I know. We recently added prettier to pre-commit hooks and it gets messy if you try to lint it all :). The merge looks good. Thanks for sticking with this for such an extended period

@tazarov
Copy link
Contributor

tazarov commented Jun 21, 2024

@fzowl, I've rebased and redid the python EF (#1327) after a recent refactor of EFs (#2034). I have also taken the docs PR chroma-core/docs#226 and merged it into #1327.

Can you rebase this PR so we can merge together with #1327.

@jeffchuber
Copy link
Contributor

Our underlying impl has changed and so this PR is not landable as is.

That being said - we'd still like to add this functionality and that is now tracked in this issue.

@jeffchuber jeffchuber closed this Sep 15, 2024
@jeffchuber jeffchuber mentioned this pull request Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants