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

Fix on encoder embeddings check #31

Closed
wants to merge 0 commits into from

Conversation

italianconcerto
Copy link
Contributor

No description provided.

Copy link

PR Analysis

  • 🎯 Main theme: This PR is about fixing a type check in the encoder function of the semantic router.
  • 📝 PR summary: The PR modifies the type check in the encoder function of the semantic router. Instead of checking if the response from the OpenAI API is a dictionary, it now checks if it's an instance of the CreateEmbeddingResponse class. This change ensures that the type check is more accurate and specific.
  • 📌 Type of PR: Bug fix
  • 🧪 Relevant tests added: No
  • ⏱️ Estimated effort to review [1-5]: 1, because the PR is small and straightforward, with only a minor change in type checking.
  • 🔒 Security concerns: No security concerns found

PR Feedback

  • 💡 General suggestions: The PR is concise and focuses on a specific issue, which is good. However, it would be beneficial to include tests that verify the new type check works as expected. Also, it would be helpful to provide more context in the PR description about why this change was necessary.

  • 🤖 Code feedback:
    relevant filesemantic_router/encoders/openai.py
    suggestion      Consider adding a comment explaining why the type check was changed from a dictionary to CreateEmbeddingResponse. This would help future contributors understand the reason behind this change. [medium]
    relevant lineif isinstance(embeds, CreateEmbeddingResponse) and "data" in embeds:

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.

@simjak
Copy link
Member

simjak commented Dec 15, 2023

@italianconcerto looks good, could you check lint and test

@italianconcerto italianconcerto force-pushed the luca/fix-on-embeddings-check branch from ccfed15 to 45ce599 Compare December 15, 2023 17:23
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