OpenAI dependency
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.5k
- Forks
- 433
- PR merge metrics
- No merged PRs in 30d
Description
Hello, I am facing this issue:
` File "/app/app/src/router/__init__.py", line 5, in
from .gateway.router import router as gateway_router
File "/app/app/src/router/gateway/router.py", line 4, in
from routellm.controller import Controller
File "/usr/local/lib/python3.12/site-packages/routellm/controller.py", line 10, in
from routellm.routers.routers import ROUTER_CLS
File "/usr/local/lib/python3.12/site-packages/routellm/routers/routers.py", line 17, in
from routellm.routers.matrix_factorization.model import MODEL_IDS, MFModel
File "/usr/local/lib/python3.12/site-packages/routellm/routers/matrix_factorization/model.py", line 4, in
from routellm.routers.similarity_weighted.utils import OPENAI_CLIENT
File "/usr/local/lib/python3.12/site-packages/routellm/routers/similarity_weighted/utils.py", line 11, in
OPENAI_CLIENT = OpenAI()
^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/openai/_client.py", line 104, in __init__
raise OpenAIError(
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable`
Of course, I can set the environment variable, but I don't want to depend on it. It would be preferable to have a way to set the base_url, model, and api_key for this client as well.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at app/src/router/gateway/router.py and follow the RouteLLM Controller import shown in the traceback. Trace where the OpenAI client is initialized and determine how configuration could reach it without requiring OPENAI_API_KEY. Done should allow the base URL, model, and API key to be supplied through the application rather than only the environment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100