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

[BUG]Type errors in embading function #1169 #1517

Merged

Conversation

DevMadhav13
Copy link
Contributor

Description of changes

Test plan

How are these changes tested?

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

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 (Readbility, Modularity, Intuitiveness)

Copy link
Contributor

@beggers beggers left a comment

Choose a reason for hiding this comment

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

This looks good! Please fix all the small indentation changes and then we're good to check this in.

model_name: str = "all-MiniLM-L6-v2",
device: str = "cpu",
normalize_embeddings: bool = False,
self,
Copy link
Contributor

Choose a reason for hiding this comment

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

Please unindent these -- we don't want them double-indented.

api_version: Optional[str] = None,
deployment_id: Optional[str] = None,
default_headers: Optional[Mapping[str, str]] = None,
self,
Copy link
Contributor

Choose a reason for hiding this comment

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

Please unindent these as well

@@ -220,7 +222,7 @@ class HuggingFaceEmbeddingFunction(EmbeddingFunction[Documents]):
"""

def __init__(
self, api_key: str, model_name: str = "sentence-transformers/all-MiniLM-L6-v2"
self, api_key: str, model_name: str = "sentence-transformers/all-MiniLM-L6-v2"
Copy link
Contributor

Choose a reason for hiding this comment

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

And here and everywhere below. I'll stop leaving comments about this :^)

@DevMadhav13
Copy link
Contributor Author

@beggers Double-indents are removed now.

Copy link
Contributor

@beggers beggers left a comment

Choose a reason for hiding this comment

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

Two more small nits and then we can check this in.

Sorry to be annoying -- I just want to keep the code as clean as possible. Thank you again for doing this!


# Return just the embeddings
return [result["embedding"] for result in sorted_embeddings]
embading = [result["embedding"] for result in sorted_embeddings]
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: embedding, not embading

@@ -36,7 +36,7 @@ class SentenceTransformerEmbeddingFunction(EmbeddingFunction[Documents]):
models: Dict[str, Any] = {}

# If you have a beefier machine, try "gtr-t5-large".
# for a full list of options: https://huggingface.co/sentence-transformers, https://www.sbert.net/docs/pretrained_models.html
# for a full list of options: https://huggingface.co/sentence-transformers, https://www.sbert.net/docs/pretrained_models.html
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we added an extra space here, can we remove?

@DevMadhav13
Copy link
Contributor Author

@beggers no Problem , corrections are done in new commit "Spell correction"

Copy link
Contributor

@beggers beggers left a comment

Choose a reason for hiding this comment

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

Two small things. We're almost there!

chromadb/utils/embedding_functions.py Outdated Show resolved Hide resolved
chromadb/utils/embedding_functions.py Outdated Show resolved Hide resolved
@beggers
Copy link
Contributor

beggers commented Jan 10, 2024

hey @DevMadhav13 if we can get my suggested minor changes into this PR then I'll merge it! Thank you for taking this work on -- makes our codebase more readable and easier to work in.

DevMadhav13 and others added 3 commits January 11, 2024 11:12
Co-authored-by: Ran <rccalman@gmail.com>
Co-authored-by: Ben Eggers <64657842+beggers@users.noreply.github.com>
Co-authored-by: Ben Eggers <64657842+beggers@users.noreply.github.com>
@DevMadhav13
Copy link
Contributor Author

@beggers Added suggested Commits which is missed to check.
Appreciate the patience.

@beggers beggers merged commit 28aa64c into chroma-core:main Jan 11, 2024
97 checks passed
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.

3 participants