Conversation
… done so far and provide feedback for Jules to continue.
This commit introduces support for using language models via OpenRouter.ai.
Key changes include:
1. **Core LLM Handlers (`LLMHandler`, `AsyncLLMHandler`):**
* Modified to recognize "openrouter" as an `api_type`.
* Can automatically detect OpenRouter usage if the model name is prefixed with "openrouter/".
* Handle OpenRouter API key retrieval (from `OPENROUTER_API_KEY` env var or direct `api_keys` param).
* Set the correct API base URL (`https://openrouter.ai/api/v1` by default, configurable via `api_base` param).
* Initialize OpenAI/AsyncOpenAI clients appropriately for OpenRouter.
* Support API key rotation for OpenRouter keys.
2. **API Key Utilities (`utils/api.py`):**
* Added `get_openrouter_api_key()` function to fetch keys from the environment.
3. **Examples (`examples/e2e.py`, `examples/async_e2e.py`):**
* Added command-line arguments (`--api_type`, `--api_base`, `--api_key`) to allow easy configuration and testing of different API providers, including OpenRouter.
* Updated example instantiation of `Nuggetizer`/`AsyncNuggetizer` to pass these through.
4. **Testing (`tests/core/test_llm.py`):**
* Created new test suite for `LLMHandler` and `AsyncLLMHandler`.
* Added comprehensive unit tests for OpenRouter integration, covering various initialization scenarios (model prefix, `api_type` parameter, custom base URL, direct API key), API key error handling, and API key rotation.
5. **Documentation (`README.md`):**
* Updated to include instructions on configuring and using OpenRouter models.
* Added details on setting the `OPENROUTER_API_KEY` environment variable.
* Provided examples of initializing `Nuggetizer` with OpenRouter models.
* Updated example command lines to show OpenRouter usage.
This integration allows you to leverage a wider range of models available through OpenRouter, enhancing the flexibility of the nuggetizer library.
Member
Author
|
PR Comment Addressing Summary Round: 1 Addressed comments
CI failures fixed
Verdict totals
Deferred items / TODOs
Open NEEDS HUMAN INPUT items
|
Member
Author
|
PR Comment Addressing Summary Round: 2 Addressed comments
CI failures fixed
Verdict totals
Deferred items / TODOs
Open NEEDS HUMAN INPUT items
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.