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

Added OpenRouter support and model testing #1058

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

CoreyJness
Copy link

@CoreyJness CoreyJness commented Oct 26, 2024

In response to Issue #991:
This PR adds support for OpenRouter integration to enable testing across multiple visual models. By implementing this, users can now configure and use OpenRouter models to handle various tasks and evaluate model performance on different difficulty levels.
Key Changes:
OpenRouter API Integration:
Added functions to handle requests to OpenRouter’s /chat/completions endpoint.
Updated configuration to support API key input for OpenRouter during setup.
Included environment variable handling for OPENROUTER_API_KEY and default model options.
Model Testing Support:
Implemented test_openrouter_model() function, which tests OpenRouter’s visual models by sending sample payloads and returning structured responses.
Enhanced configuration to allow users to select specific OpenRouter models (e.g., ANTHROPIC/CLAUDE-3.5-SONNET, meta-llama/llama-3.2-90b-vision-instruct, google/gemini-flash-1.5-8b) during setup.

Pre-commit Checks:
    Ensured code passes linting, typing, and formatting pre-commit checks (ruff, mypy).

Testing and Validation:
Functional Testing: Successfully tested the get_openrouter_response() and test_openrouter_model() functions to verify model response and error handling.
Pre-commit Hooks: Code was tested to ensure it complies with pre-commit requirements. Please review for MyPy and Alembic issues.


Important

Added OpenRouter support with API integration, model testing, and setup configuration.

  • OpenRouter API Integration:
    • Added get_openrouter_response() in openrouter.py to handle requests to OpenRouter's /chat/completions endpoint.
    • Updated setup.sh to include OpenRouter API key configuration and model options.
  • Model Testing:
    • Implemented test_openrouter_model() in model_testing.py to test OpenRouter models with sample payloads.
  • Configuration:
    • Modified setup.sh to support OpenRouter API key input and model selection during setup.
  • Testing and Validation:
    • Verified functionality of get_openrouter_response() and test_openrouter_model().
    • Ensured code passes pre-commit checks (ruff, mypy).

This description was created by Ellipsis for 8ddd110. It will automatically update as commits are pushed.

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.

❌ Changes requested. Reviewed everything up to 8ddd110 in 36 seconds

More details
  • Looked at 132 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. docs/integrations/openrouter.py:11
  • Draft comment:
    The environment variable for the OpenRouter API key should be accessed using 'OPENROUTER_API_KEY' to maintain consistency with the rest of the codebase.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The comment is suggesting a change to maintain consistency, which is a valid code quality improvement. If the rest of the codebase uses uppercase for environment variables, this change would be beneficial. However, without seeing the rest of the codebase, it's speculative. The comment is about a change that could be made to the new code, so it is relevant to the diff.
    I might be assuming too much about the rest of the codebase without evidence. The comment could be speculative if there's no established convention for environment variable names.
    Even if speculative, the suggestion aligns with common practices for environment variable naming, which often use uppercase. This could be a reasonable assumption unless proven otherwise.
    Keep the comment as it suggests a reasonable code quality improvement that aligns with common practices for environment variable naming.
2. setup.sh:333
  • Draft comment:
    Missing closing parenthesis for the python3 command. Add a closing parenthesis to complete the command.
  • Reason this comment was not posted:
    Based on historical feedback, this comment is too similar to comments previously marked by users as bad.

Workflow ID: wflow_mbe1eHDXtBb1UAkP


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

docs/api-reference/Model Testing/model_testing.py Outdated Show resolved Hide resolved
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
setup.sh Show resolved Hide resolved
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.

1 participant