mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 13:52:43 +08:00
parent
b1b96df8a8
commit
2def49e794
@ -15,6 +15,8 @@ from opendevin.controller import AgentController
|
||||
from opendevin.llm.llm import LLM
|
||||
from opendevin.observation import Observation, UserMessageObservation
|
||||
|
||||
DEFAULT_API_KEY = config.get_or_none("LLM_API_KEY")
|
||||
DEFAULT_BASE_URL = config.get_or_none("LLM_BASE_URL")
|
||||
DEFAULT_WORKSPACE_DIR = config.get_or_default("WORKSPACE_DIR", os.path.join(os.getcwd(), "workspace"))
|
||||
LLM_MODEL = config.get_or_default("LLM_MODEL", "gpt-4-0125-preview")
|
||||
|
||||
@ -85,11 +87,17 @@ class Session:
|
||||
model = LLM_MODEL
|
||||
if start_event and "model" in start_event["args"]:
|
||||
model = start_event["args"]["model"]
|
||||
api_key = DEFAULT_API_KEY
|
||||
if start_event and "api_key" in start_event["args"]:
|
||||
api_key = start_event["args"]["api_key"]
|
||||
api_base = DEFAULT_BASE_URL
|
||||
if start_event and "api_base" in start_event["args"]:
|
||||
api_base = start_event["args"]["api_base"]
|
||||
if not os.path.exists(directory):
|
||||
print(f"Workspace directory {directory} does not exist. Creating it...")
|
||||
os.makedirs(directory)
|
||||
directory = os.path.relpath(directory, os.getcwd())
|
||||
llm = LLM(model)
|
||||
llm = LLM(model=model, api_key=api_key, base_url=api_base)
|
||||
AgentCls = Agent.get_cls(agent_cls)
|
||||
self.agent = AgentCls(llm)
|
||||
try:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user