Compare commits
2 Commits
22f10cd8e9
...
25fa7dc82b
| Author | SHA1 | Date | |
|---|---|---|---|
| 25fa7dc82b | |||
| 220c6613e4 |
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
from pydantic import BaseModel, Field, model_validator
|
from pydantic import BaseModel, Field, model_validator
|
||||||
@@ -19,6 +20,10 @@ class LLMConfig(BaseModel):
|
|||||||
max_retries: int = Field(default=3, description="Max retry attempts on transient errors")
|
max_retries: int = Field(default=3, description="Max retry attempts on transient errors")
|
||||||
retry_backoff_base: float = Field(default=1.0, description="Base seconds for exponential backoff")
|
retry_backoff_base: float = Field(default=1.0, description="Base seconds for exponential backoff")
|
||||||
retry_backoff_max: float = Field(default=30.0, description="Maximum backoff seconds")
|
retry_backoff_max: float = Field(default=30.0, description="Maximum backoff seconds")
|
||||||
|
extra_body: dict[str, Any] = Field(
|
||||||
|
default_factory=dict,
|
||||||
|
description="Extra parameters merged into the API request body (model-specific)",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AgentConfig(BaseModel):
|
class AgentConfig(BaseModel):
|
||||||
|
|||||||
@@ -151,6 +151,10 @@ class LLMClient:
|
|||||||
if tools:
|
if tools:
|
||||||
payload["tools"] = tools
|
payload["tools"] = tools
|
||||||
|
|
||||||
|
# Merge model-specific extra parameters (e.g., enable_thinking, reasoning_effort)
|
||||||
|
if self._config.extra_body:
|
||||||
|
payload.update(self._config.extra_body)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
async with self._client.stream(
|
async with self._client.stream(
|
||||||
"POST", self._config.api_path, json=payload
|
"POST", self._config.api_path, json=payload
|
||||||
|
|||||||
@@ -10,6 +10,13 @@ llm:
|
|||||||
max_retries: 3
|
max_retries: 3
|
||||||
retry_backoff_base: 1.0
|
retry_backoff_base: 1.0
|
||||||
retry_backoff_max: 30.0
|
retry_backoff_max: 30.0
|
||||||
|
# Extra parameters merged into the API request body (model-specific).
|
||||||
|
# Examples:
|
||||||
|
# Qwen 3.x: enable_thinking: false
|
||||||
|
# DeepSeek: enable_thinking: false
|
||||||
|
# OpenAI: reasoning_effort: "low"
|
||||||
|
extra_body:
|
||||||
|
enable_thinking: false
|
||||||
|
|
||||||
agent:
|
agent:
|
||||||
max_iterations: 25
|
max_iterations: 25
|
||||||
|
|||||||
Reference in New Issue
Block a user