-
Notifications
You must be signed in to change notification settings - Fork 9
Adding initial support for LLM Customisation #132
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
base: main
Are you sure you want to change the base?
Conversation
@@ -1,4 +1,4 @@ | |||
<div id="toc" align="center" style="margin-bottom: 0;"> | |||
from litellm.proxy.client.cli.commands.models import models<div id="toc" align="center" style="margin-bottom: 0;"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's revert the readme changes
@@ -19,7 +19,7 @@ class StagehandConfig(BaseModel): | |||
browserbase_session_create_params (Optional[BrowserbaseSessionCreateParams]): Browserbase session create params. | |||
browserbase_session_id (Optional[str]): Session ID for resuming Browserbase sessions. | |||
model_name (Optional[str]): Name of the model to use. | |||
model_api_key (Optional[str]): Model API key. | |||
model_client_options (Optional[dict[str, Any]]): Options for the model client. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than replace, lets add it as another option
|
||
# Handle model-related settings | ||
self.model_client_options = self.config.model_client_options or {} | ||
self.model_api_key = self.model_client_options.get("apiKey") or os.getenv("MODEL_API_KEY") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
model_api_key supersedes the model_client_options apiKey, if defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's address the comments, I made a branch contrib/132
that you can set as the target to merge to (to run full CI)
This pull request introduces support for custom language models (LLMs) by replacing the
model_api_key
parameter with a more flexiblemodel_client_options
parameter. It also updates the documentation, configuration, initialization logic, and tests to reflect this enhancement.Core Changes for Custom LLM Support:
Configuration Updates:
model_api_key
withmodel_client_options
in theStagehandConfig
class, allowing users to specify multiple options such asapiKey
andbaseUrl
for custom LLMs. (stagehand/config.py
, [1] [2]Initialization Logic:
stagehand/main.py
to handlemodel_client_options
and extractapiKey
from it, falling back to theMODEL_API_KEY
environment variable if necessary. (stagehand/main.py
, stagehand/main.pyL71-R74)model_client_options
dynamically. (stagehand/main.py
, stagehand/main.pyL92-L96)LLM Client Enhancements:
stagehand/llm/client.py
to supportbaseURL
in addition toapi_base
for custom LLM configurations. (stagehand/llm/client.py
, stagehand/llm/client.pyL57-R57)Documentation Updates:
StagehandConfig
withmodel_client_options
for a custom LLM. (README.md
, README.mdR163-R178)Test Coverage:
model_api_key
withmodel_client_options
. (tests/unit/llm/test_llm_integration.py
, [1];tests/unit/test_client_api.py
, [2];tests/unit/test_client_initialization.py
, [3]tests/unit/test_client_initialization.py
, tests/unit/test_client_initialization.pyR206-R234)