mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 08:03:15 +00:00
feat: read LLM model ID from LLM_MODEL_ID env var, defaulting to anthropic:claude-opus-4-6 (#1128)
Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
This commit is contained in:
parent
267b2fd011
commit
3fea3c8709
2 changed files with 14 additions and 5 deletions
|
|
@ -5,7 +5,7 @@ Open SWE is designed to be forked and customized for your org. The core agent is
|
|||
```python
|
||||
# agent/server.py — the key lines
|
||||
return create_deep_agent(
|
||||
model=make_model("anthropic:claude-opus-4-6", temperature=0, max_tokens=20_000),
|
||||
model=make_model(os.environ.get("LLM_MODEL_ID", DEFAULT_LLM_MODEL_ID), temperature=0, max_tokens=20_000),
|
||||
system_prompt=construct_system_prompt(repo_dir, ...),
|
||||
tools=[http_request, fetch_url, commit_and_open_pr, linear_comment, slack_thread_reply],
|
||||
backend=sandbox_backend,
|
||||
|
|
@ -117,12 +117,15 @@ See `agent/integrations/langsmith.py` (`LangSmithBackend` class) for a full refe
|
|||
|
||||
## 2. Model
|
||||
|
||||
The model is configured in the `get_agent()` function in `agent/server.py`:
|
||||
The model is configured in the `get_agent()` function in `agent/server.py`. By default it uses `anthropic:claude-opus-4-6`, but you can override it with the `LLM_MODEL_ID` environment variable:
|
||||
|
||||
```python
|
||||
model=make_model("anthropic:claude-opus-4-6", temperature=0, max_tokens=20_000)
|
||||
```bash
|
||||
# Set the model via environment variable (uses provider:model format)
|
||||
LLM_MODEL_ID="anthropic:claude-sonnet-4-6"
|
||||
```
|
||||
|
||||
If `LLM_MODEL_ID` is not set, the default model (`anthropic:claude-opus-4-6`) is used.
|
||||
|
||||
### Switching models
|
||||
|
||||
Use the `provider:model` format:
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
# Suppress deprecation warnings from langchain_core (e.g., Pydantic V1 on Python 3.14+)
|
||||
# ruff: noqa: E402
|
||||
import logging
|
||||
import os
|
||||
import shlex
|
||||
import warnings
|
||||
|
||||
|
|
@ -244,6 +245,7 @@ def graph_loaded_for_execution(config: RunnableConfig) -> bool:
|
|||
)
|
||||
|
||||
|
||||
DEFAULT_LLM_MODEL_ID = "anthropic:claude-opus-4-6"
|
||||
DEFAULT_RECURSION_LIMIT = 1_000
|
||||
|
||||
|
||||
|
|
@ -400,7 +402,11 @@ async def get_agent(config: RunnableConfig) -> Pregel: # noqa: PLR0915
|
|||
|
||||
logger.info("Returning agent with sandbox for thread %s", thread_id)
|
||||
return create_deep_agent(
|
||||
model=make_model("anthropic:claude-opus-4-6", temperature=0, max_tokens=20_000),
|
||||
model=make_model(
|
||||
os.environ.get("LLM_MODEL_ID", DEFAULT_LLM_MODEL_ID),
|
||||
temperature=0,
|
||||
max_tokens=20_000,
|
||||
),
|
||||
system_prompt=construct_system_prompt(
|
||||
repo_dir,
|
||||
linear_project_id=linear_project_id,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue