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

Improve gemini model robustness #701

Merged
merged 1 commit into from
May 27, 2024
Merged

Conversation

ssonal
Copy link
Contributor

@ssonal ssonal commented May 24, 2024


🚀 This description was created by Ellipsis for commit 74975ae

Summary:

Enhances Gemini model handling by adding parameter checks, argument mappings, and error handling improvements.

Key points:

  • Add assertion to prevent passing model as a parameter in Gemini mode.
  • Map OpenAI arguments to Gemini generation_config.
  • Handle import errors for Gemini safety settings.

Generated with ❤️ by ellipsis.dev

- add assertion if model name is passed as a param to create method
- map openai args to gemini `generation_config` as per https://ai.google.dev/api/python/google/generativeai/GenerationConfig
- avoid import error while configuring gemini safety settings
Copy link

sweep-ai bot commented May 24, 2024

Sweep: PR Review

Sweep was unable to review your pull request due to the following reasons:

Sweep does not support reviewing PRs from forked repositories.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot 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 to me! Reviewed everything up to 74975ae in 34 seconds

More details
  • Looked at 53 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. instructor/process_response.py:360
  • Draft comment:
    The assertion to ensure the model name is not passed as a parameter for Gemini is correctly implemented. This aligns with the PR's intent to enforce correct usage patterns for the Gemini model.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The PR description mentions that the assertion is added to ensure the model name is not passed as a parameter to the create method for Gemini. This is correctly implemented in the code. The mapping of OpenAI arguments to Gemini's generation_config is also handled as described. The import for HarmCategory and HarmBlockThreshold is moved inside the Gemini condition to prevent import errors, which aligns with the PR description. Overall, the changes are consistent with the PR's intent and description.

Workflow ID: wflow_t1y9fpU9zd83wbBW


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@jxnl jxnl merged commit e495d96 into jxnl:main May 27, 2024
2 of 12 checks passed
@ssonal ssonal deleted the gemini-enhancements branch May 27, 2024 14:38
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