From 121628173f31ddd6587a13b3586ced725fa2b73d Mon Sep 17 00:00:00 2001 From: you-n-g Date: Fri, 4 Apr 2025 19:37:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20add=20reasoning=5Feffort=20parameter=20?= =?UTF-8?q?to=20LiteLLMAPIBackend=20and=20LLMSett=E2=80=A6=20(#754)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Add reasoning_effort parameter to LiteLLMAPIBackend and LLMSettings * style: Use consistent quotation marks for reasoning_effort literals --- rdagent/oai/backend/litellm.py | 1 + rdagent/oai/llm_conf.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/rdagent/oai/backend/litellm.py b/rdagent/oai/backend/litellm.py index 252ab0ac..250aa88a 100644 --- a/rdagent/oai/backend/litellm.py +++ b/rdagent/oai/backend/litellm.py @@ -88,6 +88,7 @@ class LiteLLMAPIBackend(APIBackend): stream=LITELLM_SETTINGS.chat_stream, temperature=LITELLM_SETTINGS.chat_temperature, max_tokens=LITELLM_SETTINGS.chat_max_tokens, + reasoning_effort=LITELLM_SETTINGS.reasoning_effort, **kwargs, ) logger.info( diff --git a/rdagent/oai/llm_conf.py b/rdagent/oai/llm_conf.py index fcd6e350..474e8025 100644 --- a/rdagent/oai/llm_conf.py +++ b/rdagent/oai/llm_conf.py @@ -1,6 +1,7 @@ from __future__ import annotations from pathlib import Path +from typing import Literal from pydantic import Field @@ -14,6 +15,8 @@ class LLMSettings(ExtendedBaseSettings): chat_model: str = "gpt-4-turbo" embedding_model: str = "text-embedding-3-small" + reasoning_effort: Literal["low", "medium", "high"] | None = None + # TODO: most of the settings are only used on deprec.DeprecBackend. # So they should move the settings to that folder.