mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 19:43:15 +00:00
feat: Add model utils, move to websockets and responses api, add gpt-5.3-codex (#998)
* feat: Add model utils, move to websockets and responses api, add gpt-5.3-codex * cr
This commit is contained in:
parent
484465c399
commit
336a163924
2 changed files with 15 additions and 2 deletions
|
|
@ -23,7 +23,6 @@ warnings.filterwarnings("ignore", message=".*Pydantic V1.*", category=UserWarnin
|
|||
# Now safe to import agent (which imports LangChain modules)
|
||||
from deepagents import create_deep_agent
|
||||
from deepagents.backends.protocol import SandboxBackendProtocol
|
||||
from langchain_openai import ChatOpenAI
|
||||
from langsmith.sandbox import SandboxClientError
|
||||
|
||||
from .encryption import decrypt_token
|
||||
|
|
@ -36,6 +35,7 @@ from .middleware import (
|
|||
)
|
||||
from .prompt import construct_system_prompt
|
||||
from .tools import commit_and_open_pr, fetch_url, http_request
|
||||
from .utils.model import make_model
|
||||
|
||||
client = get_client()
|
||||
|
||||
|
|
@ -361,7 +361,7 @@ 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=ChatOpenAI(model="gpt-5.2-codex", temperature=0, max_tokens=20_000),
|
||||
model=make_model("openai:gpt-5.3-codex", temperature=0, max_tokens=20_000),
|
||||
system_prompt=construct_system_prompt(
|
||||
repo_dir,
|
||||
linear_project_id=linear_project_id,
|
||||
|
|
|
|||
13
apps/agent/agent/utils/model.py
Normal file
13
apps/agent/agent/utils/model.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
from langchain.chat_models import init_chat_model
|
||||
|
||||
OPENAI_RESPONSES_WS_BASE_URL = "wss://api.openai.com/v1"
|
||||
|
||||
|
||||
def make_model(model_id: str, **kwargs: dict):
|
||||
model_kwargs = kwargs.copy()
|
||||
|
||||
if model_id.startswith("openai:"):
|
||||
model_kwargs["base_url"] = OPENAI_RESPONSES_WS_BASE_URL
|
||||
model_kwargs["use_responses_api"] = True
|
||||
|
||||
return init_chat_model(model=model_id, **model_kwargs)
|
||||
Loading…
Add table
Reference in a new issue