diff --git a/backend/src/agents/expert.py b/backend/src/agents/expert.py index 77cc3b2..dd35a59 100644 --- a/backend/src/agents/expert.py +++ b/backend/src/agents/expert.py @@ -16,6 +16,10 @@ class ExpertAgent(Agent): AgentField('model', 'model_id', default=None), AgentField('temperature', 'number', default=None), AgentField('repetition_penalty', 'number', default=None), + AgentField('reasoning_effort', { + "type": "string", + "enum": ["none", "minimal", "low", "medium", "high", "xhigh", "max"] + }, default=None), ] def __init__(self, *args): @@ -44,9 +48,12 @@ class ExpertAgent(Agent): if tools: run.input['tools'] = tools if self.config.get("temperature") is not None: - opts["temperature"] = self.config["temperature"] + run.input["temperature"] = self.config["temperature"] if self.config.get("repetition_penalty") is not None: - opts["repetition_penalty"] = self.config["repetition_penalty"] + run.input["repetition_penalty"] = self.config["repetition_penalty"] + if self.config.get("reasoning_effort") is not None: + run.input["reasoning_effort"] = self.config["reasoning_effort"] + # Build message list based on input messages = inference.build_messages( diff --git a/backend/src/inference.py b/backend/src/inference.py index b57829d..238c32c 100644 --- a/backend/src/inference.py +++ b/backend/src/inference.py @@ -353,6 +353,14 @@ async def openrouter_chat_completion(app, messages, model, tools=[], opts={}, ag if formatted_tools: kwargs['tools'] = formatted_tools + temp = agent_run.input.get("temperature") + if temp is not None: + kwargs['temperature'] = temp + + reasoning = agent_run.input.get("reasoning_effort") + if reasoning is not None: + kwargs['reasoning'] = {"effort": reasoning} + stream_response = await app.openrouter_client.chat.send_async(**kwargs) # OpenAI format streams tool calls in parts