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

Another fix on embeddings #34

Merged
merged 5 commits into from
Dec 18, 2023
Merged

Another fix on embeddings #34

merged 5 commits into from
Dec 18, 2023

Conversation

italianconcerto
Copy link
Contributor

The tests were working but when I tried the library externally there was a bug.
I found out the tests needed to be rewritten

Copy link

PR Analysis

  • 🎯 Main theme: Fixing the handling of embeddings in the OpenAI encoder and updating the corresponding tests.
  • 📝 PR summary: This PR addresses a bug in the handling of embeddings in the OpenAI encoder. The changes involve using the correct response object from the OpenAI library and updating the tests to reflect these changes. The PR also includes a minor change in the function_calling.ipynb notebook.
  • 📌 Type of PR: Bug fix
  • 🧪 Relevant tests added: Yes
  • ⏱️ Estimated effort to review [1-5]: 2, because the changes are limited to a specific part of the code and the logic is straightforward. The changes are well reflected in the tests.
  • 🔒 Security concerns: No security concerns found

PR Feedback

  • 💡 General suggestions: The changes in the PR seem to be well thought out and correctly implemented. The use of the correct response object from the OpenAI library is a good catch. The tests have been updated to reflect these changes which is good practice. However, it would be beneficial to add a comment explaining why the CreateEmbeddingResponse object is used instead of a dictionary.

  • 🤖 Code feedback:
    relevant filesemantic_router/encoders/openai.py
    suggestion      Consider adding a comment explaining why the CreateEmbeddingResponse object is used instead of a dictionary. This will help future developers understand the reasoning behind this change. [medium]
    relevant lineif (

    relevant filetests/unit/encoders/test_openai.py
    suggestion      It would be beneficial to add more tests to cover different edge cases, such as when the OpenAI API returns an unexpected response. [medium]
    relevant lineresponses = [OpenAIError("OpenAI error"), mock_response]

How to use

Instructions

To invoke the PR-Agent, add a comment using one of the following commands:
/review: Request a review of your Pull Request.
/describe: Update the PR title and description based on the contents of the PR.
/improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
/ask <QUESTION>: Ask a question about the PR.
/update_changelog: Update the changelog based on the PR's contents.
/add_docs: Generate docstring for new components introduced in the PR.
/generate_labels: Generate labels for the PR based on the PR's contents.
see the tools guide for more details.

To edit any configuration parameter from the configuration.toml, add --config_path=new_value.
For example: /review --pr_reviewer.extra_instructions="focus on the file: ..."
To list the possible configuration parameters, add a /config comment.

Copy link

codecov bot commented Dec 18, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (da1596a) 100.00% compared to head (2e9ccdc) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #34   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           11        11           
  Lines          345       345           
=========================================
  Hits           345       345           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@simjak simjak merged commit 9a2a4b8 into main Dec 18, 2023
5 checks passed
@simjak simjak deleted the luca/fix-on-embeddings-check branch December 18, 2023 10:24
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.

2 participants