-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: Validate response of embedding function to be in the expected format during runtime #1615
ENH: Validate response of embedding function to be in the expected format during runtime #1615
Conversation
…rmat during runtime
Reviewer ChecklistPlease leverage this checklist to ensure your code review is thorough before approving Testing, Bugs, Errors, Logs, Documentation
System Compatibility
Quality
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an elegant way to solve this problem. I have a couple minor requests then I'll be very happy to check this in. Thank you!
chromadb/test/api/test_types.py
Outdated
return [str(random_image()) for _ in range(10)] | ||
|
||
|
||
def test_embedding_function_with_valid_response() -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could we change these to start with test_embedding_function_results_format_...
so it's more immediately clear what they're testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
chromadb/test/api/test_types.py
Outdated
ef = TestEmbeddingFunction() | ||
with pytest.raises(ValueError) as e: | ||
ef(random_documents()) | ||
assert "Expected embeddings to be a list, got {'error': 'test'}" == str(e.value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I don't want us to be locked on this error string -- mind removing this line? I'm happy with us simply verifying that we raise a ValueError.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Description of changes
Requested in #1488
Test plan
pytest
for python,yarn test
for jsDocumentation Changes
Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs repository?