Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

Auto-update documentation after merge [skip ci]

camel-docs-bot78f0006dd5b6
diff --git a/docs/mintlify/docs.json b/docs/mintlify/docs.json
index f4dcbb2c0..3521c33c6 100644
--- a/docs/mintlify/docs.json
+++ b/docs/mintlify/docs.json
@@ -256,6 +256,7 @@
"reference/camel.configs.siliconflow_config",
"reference/camel.configs.togetherai_config",
"reference/camel.configs.vllm_config",
+ "reference/camel.configs.volcano_config",
"reference/camel.configs.watsonx_config",
"reference/camel.configs.yi_config",
"reference/camel.configs.zhipuai_config"
@@ -303,6 +304,7 @@
{
"group": "Models",
"pages": [
+ "reference/camel.models._interleaved_thinking_mixin",
"reference/camel.models._utils",
"reference/camel.models.aihubmix_model",
"reference/camel.models.aiml_model",
diff --git a/docs/mintlify/reference/camel.configs.minimax_config.mdx b/docs/mintlify/reference/camel.configs.minimax_config.mdx
index e46836ae8..840f1bb3c 100644
--- a/docs/mintlify/reference/camel.configs.minimax_config.mdx
+++ b/docs/mintlify/reference/camel.configs.minimax_config.mdx
@@ -24,6 +24,7 @@ Reference: https://api.minimax.chat/document/guides/chat-model
- **max_tokens** (int, optional): The maximum number of tokens to generate in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length. (default: :obj:`None`)
- **user** (str, optional): A unique identifier representing your end-user, which can help to monitor and detect abuse. (default: :obj:`None`)
- **tool_choice** (Union[dict[str, str], str], optional): Controls which (if any) tool is called by the model. :obj:`"none"` means the model will not call any tool and instead generates a message. :obj:`"auto"` means the model can pick between generating a message or calling one or more tools. :obj:`"required"` means the model must call one or more tools. Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. :obj:`"none"` is the default when no tools are present. :obj:`"auto"` is the default if tools are present.
+- **interleaved_thinking** (Optional[bool], optional): Whether to enable interleaved thinking mode. When enabled, the model performs step-by-step reasoning while dynamically invoking tools. This sets `reasoning_split=True` in the API request, which separates reasoning into a `reasoning_details` field. (default: :obj:`None`)
**Note:**
diff --git a/docs/mintlify/reference/camel.configs.moonshot_config.mdx b/docs/mintlify/reference/camel.configs.moonshot_config.mdx
index b9e49f16a..3390b4aa2 100644
--- a/docs/mintlify/reference/camel.configs.moonshot_config.mdx
+++ b/docs/mintlify/reference/camel.configs.moonshot_config.mdx
@@ -23,3 +23,4 @@ https://platform.moonshot.cn/docs/api-reference
- **presence_penalty** (float, optional): Penalty for new tokens based on whether they appear in the text so far. (default: :obj:`None`)
- **frequency_penalty** (float, optional): Penalty for new tokens based on their frequency in the text so far. (default: :obj:`None`)
- **stop** (Optional[Union[str, List[str]]], optional): Up to 4 sequences where the API will stop generating further tokens. (default: :obj:`None`)
+- **interleaved_thinking** (Optional[bool], optional): Whether to enable interleaved thinking mode. When enabled, the model performs step-by-step reasoning while dynamically invoking tools. (default: :obj:`None`)
diff --git a/docs/mintlify/reference/camel.configs.volcano_config.mdx b/docs/mintlify/reference/camel.configs.volcano_config.mdx
new file mode 100644
index 000000000..9fc81dac2
--- /dev/null
+++ b/docs/mintlify/reference/camel.configs.volcano_config.mdx
@@ -0,0 +1,19 @@
+<a id="camel.configs.volcano_config"></a>
+
+<a id="camel.configs.volcano_config.VolcanoConfig"></a>
+
+## VolcanoConfig
+
+```python
+class VolcanoConfig(BaseConfig):
+```
+
+Defines the parameters for generating chat completions using the
+Volcano Engine API.
+
+**Parameters:**
+
+- **temperature** (Optional[float], optional): Sampling temperature to use. (default: :obj:`None`)
+- **max_tokens** (Optional[int], optional): The maximum number of tokens to generate in the chat completion. (default: :obj:`None`)
+- **stream** (Optional[bool], optional): Whether to stream the response. (default: :obj:`None`)
+- **interleaved_thinking** (Optional[bool], optional): Whether to enable interleaved thinking mode for doubao-seed models. When enabled, the model performs step-by-step reasoning while dynamically invoking tools. (default: :obj:`None`)
diff --git a/docs/mintlify/reference/camel.configs.zhipuai_config.mdx b/docs/mintlify/reference/camel.configs.zhipuai_config.mdx
index 4c1b1f157..4adc83b29 100644
--- a/docs/mintlify/reference/camel.configs.zhipuai_config.mdx
+++ b/docs/mintlify/reference/camel.configs.zhipuai_config.mdx
@@ -22,3 +22,4 @@ Reference: https://open.bigmodel.cn/dev/api#glm-4v
- **max_tokens** (int, optional): The maximum number of tokens to generate in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length. (default: :obj:`None`)
- **tools** (list[FunctionTool], optional): A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
- **tool_choice** (Union[dict[str, str], str], optional): Controls which (if any) tool is called by the model. :obj:`"none"` means the model will not call any tool and instead generates a message. :obj:`"auto"` means the model can pick between generating a message or calling one or more tools. :obj:`"required"` means the model must call one or more tools. Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. :obj:`"none"` is the default when no tools are present. :obj:`"auto"` is the default if tools are present.
+- **interleaved_thinking** (Optional[bool], optional): Whether to enable interleaved thinking mode for GLM-4.5+ models. When enabled, the model reasons before each response and tool call. (default: :obj:`None`)
diff --git a/docs/mintlify/reference/camel.models._interleaved_thinking_mixin.mdx b/docs/mintlify/reference/camel.models._interleaved_thinking_mixin.mdx
new file mode 100644
index 000000000..f409dfa3f
--- /dev/null
+++ b/docs/mintlify/reference/camel.models._interleaved_thinking_mixin.mdx
@@ -0,0 +1,136 @@
+<a id="camel.models._interleaved_thinking_mixin"></a>
+
+<a id="camel.models._interleaved_thinking_mixin.InterleavedThinkingMixin"></a>
+
+## InterleavedThinkingMixin
+
+```python
+class InterleavedThinkingMixin:
+```
+
+Mixin class for models that support interleaved thinking.
+
+This mixin provides shared functionality for handling reasoning content
+in multi-turn conversations with tool calls. Models like ZhipuAI,
+Moonshot, Minimax, and Volcano require the reasoning content from a
+model response to be passed back in subsequent requests for proper
+context management.
+
+Class attributes:
+_reasoning_field (str): The field name used for reasoning content.
+Defaults to "reasoning_content". Subclasses can override this
+(e.g., Minimax uses "reasoning_details").
+
+Instance attributes:
+_last_reasoning (Optional[Any]): Stores the reasoning content from
+the last model response to be injected into the next request.
+
+<a id="camel.models._interleaved_thinking_mixin.InterleavedThinkingMixin._init_thinking_state"></a>
+
+### _init_thinking_state
+
+```python
+def _init_thinking_state(self):
+```
+
+Initialize the thinking state.
+
+Should be called in the subclass's __init__ method after
+super().__init__().
+
+<a id="camel.models._interleaved_thinking_mixin.InterleavedThinkingMixin._is_thinking_enabled"></a>
+
+### _is_thinking_enabled
+
+```python
+def _is_thinking_enabled(self):
+```
+
+**Returns:**
+
+ bool: True if interleaved_thinking is enabled in the model config.
+
+<a id="camel.models._interleaved_thinking_mixin.InterleavedThinkingMixin._extract_reasoning"></a>
+
+### _extract_reasoning
+
+```python
+def _extract_reasoning(self, response: ChatCompletion):
+```
+
+Extract reasoning content from the model response.
+
+**Parameters:**
+
+- **response**: The model response.
+
+**Returns:**
+
+ The reasoning content if available, None otherwise.
+
+<a id="camel.models._interleaved_thinking_mixin.InterleavedThinkingMixin._inject_reasoning"></a>
+
+### _inject_reasoning
+
+```python
+def _inject_reasoning(self, messages: List[OpenAIMessage]):
+```
+
+Inject the last reasoning content into assistant messages.
+
+For models with interleaved thinking enabled, the reasoning content
+from the model response needs to be passed back in subsequent requests
+for proper context management. This is especially important when using
+tools with interleaved thinking.
+
+**Parameters:**
+
+- **messages**: The original messages list.
+
+**Returns:**
+
+ Messages with reasoning content added to the last assistant
+message that has tool_calls.
+
+<a id="camel.models._interleaved_thinking_mixin.InterleavedThinkingMixin._prepare_thinking_config"></a>
+
+### _prepare_thinking_config
+
+```python
+def _prepare_thinking_config(self, config: Dict[str, Any]):
+```
+
+Prepare the request config for thinking-enabled requests.
+
+Removes the interleaved_thinking parameter which is only used
+internally. Subclasses can override this to add model-specific
+configuration (e.g., Minimax adds reasoning_split=True).
+
+**Parameters:**
+
+- **config**: The request configuration dictionary.
+
+**Returns:**
+
+ The modified configuration dictionary.
+
+<a id="camel.models._interleaved_thinking_mixin.InterleavedThinkingMixin.run"></a>
+
+### run
+
+```python
+def run(
+ self,
+ messages: List[OpenAIMessage],
+ response_format: Optional[Type[BaseModel]] = None,
+ tools: Optional[List[Dict[str, Any]]] = None
+):
+```
+
+Run inference with interleaved thinking support.
+
+**Note:**
+
+Interleaved thinking is not supported with stream=True. When
+streaming is enabled, reasoning content cannot be captured and
+injected into subsequent requests.
diff --git a/docs/mintlify/reference/camel.models.minimax_model.mdx b/docs/mintlify/reference/camel.models.minimax_model.mdx
index 21ba96d9d..328086b75 100644
--- a/docs/mintlify/reference/camel.models.minimax_model.mdx
+++ b/docs/mintlify/reference/camel.models.minimax_model.mdx
@@ -5,7 +5,7 @@
## MinimaxModel
```python
-class MinimaxModel(OpenAICompatibleModel):
+class MinimaxModel(InterleavedThinkingMixin, OpenAICompatibleModel):
```
LLM API served by Minimax in a unified OpenAICompatibleModel
@@ -39,3 +39,38 @@ def __init__(
**kwargs: Any
):
```
+
+<a id="camel.models.minimax_model.MinimaxModel._prepare_thinking_config"></a>
+
+### _prepare_thinking_config
+
+```python
+def _prepare_thinking_config(self, config: Dict[str, Any]):
+```
+
+Prepare the request config for thinking-enabled requests.
+
+Overrides base method to add reasoning_split=True to extra_body
+when interleaved thinking is enabled.
+
+**Parameters:**
+
+- **config**: The request configuration dictionary.
+
+**Returns:**
+
+ The modified configuration dictionary.
+
+<a id="camel.models.minimax_model.MinimaxModel._prepare_request_config"></a>
+
+### _prepare_request_config
+
+```python
+def _prepare_request_config(self, tools: Optional[List[Dict[str, Any]]] = None):
+```
+
+Prepare the request configuration dictionary.
+
+Overrides the base method to:
+1. Remove interleaved_thinking parameter (internal use only)
+2. Add reasoning_split=True to extra_body when thinking is enabled
diff --git a/docs/mintlify/reference/camel.models.moonshot_model.mdx b/docs/mintlify/reference/camel.models.moonshot_model.mdx
index dbb6ec6e6..73ce2856d 100644
--- a/docs/mintlify/reference/camel.models.moonshot_model.mdx
+++ b/docs/mintlify/reference/camel.models.moonshot_model.mdx
@@ -5,7 +5,7 @@
## MoonshotModel
```python
-class MoonshotModel(OpenAICompatibleModel):
+class MoonshotModel(InterleavedThinkingMixin, OpenAICompatibleModel):
```
Moonshot API in a unified OpenAICompatibleModel interface.
@@ -83,3 +83,30 @@ This method removes null type definitions from parameters.
**Returns:**
List[Dict[str, Any]]: Cleaned tool schemas.
+
+<a id="camel.models.moonshot_model.MoonshotModel._run"></a>
+
+### _run
+
+```python
+def _run(
+ self,
+ messages: List[OpenAIMessage],
+ response_format: Optional[Type[BaseModel]] = None,
+ tools: Optional[List[Dict[str, Any]]] = None
+):
+```
+
+Runs inference of Moonshot chat completion.
+
+**Parameters:**
+
+- **messages** (List[OpenAIMessage]): Message list with the chat history in OpenAI API format.
+- **response_format** (Optional[Type[BaseModel]]): The format of the response.
+- **tools** (Optional[List[Dict[str, Any]]]): The schema of the tools to use for the request.
+
+**Returns:**
+
+ Union[ChatCompletion, Stream[ChatCompletionChunk]]:
+`ChatCompletion` in the non-stream mode, or
+`Stream[ChatCompletionChunk]` in the stream mode.
diff --git a/docs/mintlify/reference/camel.models.volcano_model.mdx b/docs/mintlify/reference/camel.models.volcano_model.mdx
index 7ba1112c5..42db51416 100644
--- a/docs/mintlify/reference/camel.models.volcano_model.mdx
+++ b/docs/mintlify/reference/camel.models.volcano_model.mdx
@@ -5,7 +5,7 @@
## VolcanoModel
```python
-class VolcanoModel(OpenAICompatibleModel):
+class VolcanoModel(InterleavedThinkingMixin, OpenAICompatibleModel):
```
Volcano Engine API in a unified OpenAICompatibleModel interface.
@@ -38,73 +38,15 @@ def __init__(
):
```
-<a id="camel.models.volcano_model.VolcanoModel._inject_reasoning_content"></a>
+<a id="camel.models.volcano_model.VolcanoModel._prepare_request_config"></a>
-### _inject_reasoning_content
+### _prepare_request_config
```python
-def _inject_reasoning_content(self, messages: List[OpenAIMessage]):
+def _prepare_request_config(self, tools: Optional[List[Dict[str, Any]]] = None):
```
-Inject the last reasoning_content into assistant messages.
+Prepare the request configuration dictionary.
-For Volcano Engine's doubao-seed models with deep thinking enabled,
-the reasoning_content from the model response needs to be passed back
-in subsequent requests for proper context management.
-
-**Parameters:**
-
-- **messages**: The original messages list.
-
-**Returns:**
-
- Messages with reasoning_content added to the last assistant
-message that has tool_calls.
-
-<a id="camel.models.volcano_model.VolcanoModel._extract_reasoning_content"></a>
-
-### _extract_reasoning_content
-
-```python
-def _extract_reasoning_content(self, response: ChatCompletion):
-```
-
-Extract reasoning_content from the model response.
-
-**Parameters:**
-
-- **response**: The model response.
-
-**Returns:**
-
- The reasoning_content if available, None otherwise.
-
-<a id="camel.models.volcano_model.VolcanoModel.run"></a>
-
-### run
-
-```python
-def run(
- self,
- messages: List[OpenAIMessage],
- response_format: Optional[Type[BaseModel]] = None,
- tools: Optional[List[Dict[str, Any]]] = None
-):
-```
-
-Runs inference of Volcano Engine chat completion.
-
-Overrides the base run method to inject reasoning_content from
-previous responses into subsequent requests, as required by
-Volcano Engine's doubao-seed models with deep thinking enabled.
-
-**Parameters:**
-
-- **messages**: Message list with the chat history in OpenAI API format.
-- **response_format**: The format of the response.
-- **tools**: The schema of the tools to use for the request.
-
-**Returns:**
-
- ChatCompletion in the non-stream mode, or
-Stream[ChatCompletionChunk] in the stream mode.
+Overrides the base method to remove interleaved_thinking parameter
+which is only used internally.
diff --git a/docs/mintlify/reference/camel.models.zhipuai_model.mdx b/docs/mintlify/reference/camel.models.zhipuai_model.mdx
index 10a9a2f3c..f87203ade 100644
--- a/docs/mintlify/reference/camel.models.zhipuai_model.mdx
+++ b/docs/mintlify/reference/camel.models.zhipuai_model.mdx
@@ -5,7 +5,7 @@
## ZhipuAIModel
```python
-class ZhipuAIModel(OpenAICompatibleModel):
+class ZhipuAIModel(InterleavedThinkingMixin, OpenAICompatibleModel):
```
ZhipuAI API in a unified OpenAICompatibleModel interface.
@@ -38,6 +38,19 @@ def __init__(
):
```
+<a id="camel.models.zhipuai_model.ZhipuAIModel._prepare_request_config"></a>
+
+### _prepare_request_config
+
+```python
+def _prepare_request_config(self, tools: Optional[List[Dict[str, Any]]] = None):
+```
+
+Prepare the request configuration dictionary.
+
+Overrides the base method to remove interleaved_thinking parameter
+which is only used internally.
+
<a id="camel.models.zhipuai_model.ZhipuAIModel._request_parse"></a>
### _request_parse