feat: add optional llm extra with OpenRouter client - #25
Open
m-messer wants to merge 1 commit into
Open
Conversation
New in2lambda.llm package behind a Poetry `llm` extra (pip install 'in2lambda[llm]' -> openai, python-dotenv, pydantic): - client.get_client() returns an openai.OpenAI pointed at https://openrouter.ai/api/v1, keyed by $OPENROUTER_API_KEY (loaded from a .env file if present). Raises a clear RuntimeError when the extra is missing or the key is unset. - client.resolve_model() picks the model slug: --model value, else $IN2LAMBDA_MODEL, else DEFAULT_MODEL (openai/gpt-4o-mini). The package imports cleanly without the extra (openai/dotenv guarded), so --doctest-modules still works on a bare install. CI now installs --all-extras so the llm code is covered. Tests are fully offline. openai floor is ^1.55 - older releases resolve against a too-new httpx and break with a `proxies` TypeError. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017VXb8aZqgFBjoeuuddjW6r
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.
New
in2lambda.llmpackage behind a Poetryllmextra (pip install 'in2lambda[llm]'→openai,python-dotenv,pydantic):client.get_client()returns anopenai.OpenAIpointed athttps://openrouter.ai/api/v1, keyed by$OPENROUTER_API_KEY(loaded from a.envfile if present). ClearRuntimeErrorwhen the extra is missing or the key is unset.client.resolve_model()picks the model slug:--modelvalue, else$IN2LAMBDA_MODEL, elseDEFAULT_MODEL(openai/gpt-4o-mini).The package imports cleanly without the extra (openai/dotenv guarded), so
--doctest-modulesstill works on a bare install. CI now installs--all-extras. Tests are fully offline.openaifloor is^1.55— older releases resolve against a too-new httpx and break with aproxiesTypeError.Stack: cli-group ← llm-client ← mathpix ← wizard-command
Base:
cli-group— #24.🤖 Generated with Claude Code