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

camel-docs-bot161dd74c0e13
diff --git a/docs/mintlify/reference/camel.agents.chat_agent.mdx b/docs/mintlify/reference/camel.agents.chat_agent.mdx
index ef98894bd..0d6f53318 100644
--- a/docs/mintlify/reference/camel.agents.chat_agent.mdx
+++ b/docs/mintlify/reference/camel.agents.chat_agent.mdx
@@ -1,5 +1,219 @@
<a id="camel.agents.chat_agent"></a>
+<a id="camel.agents.chat_agent.StreamContentAccumulator"></a>
+
+## StreamContentAccumulator
+
+```python
+class StreamContentAccumulator:
+```
+
+Manages content accumulation across streaming responses to ensure
+all responses contain complete cumulative content.
+
+<a id="camel.agents.chat_agent.StreamContentAccumulator.__init__"></a>
+
+### __init__
+
+```python
+def __init__(self):
+```
+
+<a id="camel.agents.chat_agent.StreamContentAccumulator.set_base_content"></a>
+
+### set_base_content
+
+```python
+def set_base_content(self, content: str):
+```
+
+Set the base content (usually empty or pre-tool content).
+
+<a id="camel.agents.chat_agent.StreamContentAccumulator.add_streaming_content"></a>
+
+### add_streaming_content
+
+```python
+def add_streaming_content(self, new_content: str):
+```
+
+Add new streaming content.
+
+<a id="camel.agents.chat_agent.StreamContentAccumulator.add_tool_status"></a>
+
+### add_tool_status
+
+```python
+def add_tool_status(self, status_message: str):
+```
+
+Add a tool status message.
+
+<a id="camel.agents.chat_agent.StreamContentAccumulator.get_full_content"></a>
+
+### get_full_content
+
+```python
+def get_full_content(self):
+```
+
+Get the complete accumulated content.
+
+<a id="camel.agents.chat_agent.StreamContentAccumulator.get_content_with_new_status"></a>
+
+### get_content_with_new_status
+
+```python
+def get_content_with_new_status(self, status_message: str):
+```
+
+Get content with a new status message appended.
+
+<a id="camel.agents.chat_agent.StreamContentAccumulator.reset_streaming_content"></a>
+
+### reset_streaming_content
+
+```python
+def reset_streaming_content(self):
+```
+
+Reset only the streaming content, keep base and tool status.
+
+<a id="camel.agents.chat_agent.StreamingChatAgentResponse"></a>
+
+## StreamingChatAgentResponse
+
+```python
+class StreamingChatAgentResponse:
+```
+
+A wrapper that makes streaming responses compatible with
+non-streaming code.
+
+This class wraps a Generator[ChatAgentResponse, None, None] and provides
+the same interface as ChatAgentResponse, so existing code doesn't need to
+change.
+
+<a id="camel.agents.chat_agent.StreamingChatAgentResponse.__init__"></a>
+
+### __init__
+
+```python
+def __init__(self, generator: Generator[ChatAgentResponse, None, None]):
+```
+
+<a id="camel.agents.chat_agent.StreamingChatAgentResponse._ensure_latest_response"></a>
+
+### _ensure_latest_response
+
+```python
+def _ensure_latest_response(self):
+```
+
+Ensure we have the latest response by consuming the generator.
+
+<a id="camel.agents.chat_agent.StreamingChatAgentResponse.msgs"></a>
+
+### msgs
+
+```python
+def msgs(self):
+```
+
+Get messages from the latest response.
+
+<a id="camel.agents.chat_agent.StreamingChatAgentResponse.terminated"></a>
+
+### terminated
+
+```python
+def terminated(self):
+```
+
+Get terminated status from the latest response.
+
+<a id="camel.agents.chat_agent.StreamingChatAgentResponse.info"></a>
+
+### info
+
+```python
+def info(self):
+```
+
+Get info from the latest response.
+
+<a id="camel.agents.chat_agent.StreamingChatAgentResponse.msg"></a>
+
+### msg
+
+```python
+def msg(self):
+```
+
+Get the single message if there's exactly one message.
+
+<a id="camel.agents.chat_agent.StreamingChatAgentResponse.__iter__"></a>
+
+### __iter__
+
+```python
+def __iter__(self):
+```
+
+Make this object iterable.
+
+<a id="camel.agents.chat_agent.StreamingChatAgentResponse.__getattr__"></a>
+
+### __getattr__
+
+```python
+def __getattr__(self, name):
+```
+
+Forward any other attribute access to the latest response.
+
+<a id="camel.agents.chat_agent.AsyncStreamingChatAgentResponse"></a>
+
+## AsyncStreamingChatAgentResponse
+
+```python
+class AsyncStreamingChatAgentResponse:
+```
+
+A wrapper that makes async streaming responses awaitable and
+compatible with non-streaming code.
+
+This class wraps an AsyncGenerator[ChatAgentResponse, None] and provides
+both awaitable and async iterable interfaces.
+
+<a id="camel.agents.chat_agent.AsyncStreamingChatAgentResponse.__init__"></a>
+
+### __init__
+
+```python
+def __init__(self, async_generator: AsyncGenerator[ChatAgentResponse, None]):
+```
+
+<a id="camel.agents.chat_agent.AsyncStreamingChatAgentResponse.__await__"></a>
+
+### __await__
+
+```python
+def __await__(self):
+```
+
+Make this object awaitable - returns the final response.
+
+<a id="camel.agents.chat_agent.AsyncStreamingChatAgentResponse.__aiter__"></a>
+
+### __aiter__
+
+```python
+def __aiter__(self):
+```
+
+Make this object async iterable.
+
<a id="camel.agents.chat_agent.ChatAgent"></a>
## ChatAgent
@@ -23,6 +237,7 @@ Class for managing conversations of CAMEL Chat Agents.
- **max_iteration** (Optional[int], optional): Maximum number of model calling iterations allowed per step. If `None` (default), there's no explicit limit. If `1`, it performs a single model call. If `N > 1`, it allows up to N model calls. (default: :obj:`None`)
- **agent_id** (str, optional): The ID of the agent. If not provided, a random UUID will be generated. (default: :obj:`None`)
- **stop_event** (Optional[threading.Event], optional): Event to signal termination of the agent's operation. When set, the agent will terminate its execution. (default: :obj:`None`)
+- **tool_execution_timeout** (Optional[float], optional): Timeout for individual tool execution. If None, wait indefinitely.
- **mask_tool_output** (Optional[bool]): Whether to return a sanitized placeholder instead of the raw tool output. (default: :obj:`False`)
- **pause_event** (Optional[asyncio.Event]): Event to signal pause of the agent's operation. When clear, the agent will pause its execution. (default: :obj:`None`)
@@ -46,6 +261,7 @@ def __init__(
max_iteration: Optional[int] = None,
agent_id: Optional[str] = None,
stop_event: Optional[threading.Event] = None,
+ tool_execution_timeout: Optional[float] = None,
mask_tool_output: bool = False,
pause_event: Optional[asyncio.Event] = None
):
@@ -499,8 +715,11 @@ to the input message.
**Returns:**
- ChatAgentResponse: Contains output messages, a termination status
-flag, and session information.
+ Union[ChatAgentResponse, StreamingChatAgentResponse]: If stream is
+False, returns a ChatAgentResponse. If stream is True, returns
+a StreamingChatAgentResponse that behaves like
+ChatAgentResponse but can also be iterated for
+streaming updates.
<a id="camel.agents.chat_agent.ChatAgent.chat_history"></a>
@@ -710,42 +929,6 @@ information.
_ModelResponse: parsed model response.
-<a id="camel.agents.chat_agent.ChatAgent._handle_stream_response"></a>
-
-### _handle_stream_response
-
-```python
-def _handle_stream_response(self, response: Stream[ChatCompletionChunk], prompt_tokens: int):
-```
-
-Process a stream response from the model and extract the necessary
-information.
-
-**Parameters:**
-
-- **response** (dict): Model response.
-- **prompt_tokens** (int): Number of input prompt tokens.
-
-**Returns:**
-
- _ModelResponse: a parsed model response.
-
-<a id="camel.agents.chat_agent.ChatAgent._handle_chunk"></a>
-
-### _handle_chunk
-
-```python
-def _handle_chunk(
- self,
- chunk: ChatCompletionChunk,
- content_dict: defaultdict,
- finish_reasons_dict: defaultdict,
- output_messages: List[BaseMessage]
-):
-```
-
-Handle a chunk of the model response.
-
<a id="camel.agents.chat_agent.ChatAgent._step_terminate"></a>
### _step_terminate
@@ -828,107 +1011,12 @@ tool calling record.
ToolCallingRecord: A struct containing information about
this tool call.
-<a id="camel.agents.chat_agent.ChatAgent.get_usage_dict"></a>
-
-### get_usage_dict
-
-```python
-def get_usage_dict(self, output_messages: List[BaseMessage], prompt_tokens: int):
-```
-
-Get usage dictionary when using the stream mode.
-
-**Parameters:**
-
-- **output_messages** (list): List of output messages.
-- **prompt_tokens** (int): Number of input prompt tokens.
-
-**Returns:**
-
- dict: Usage dictionary.
-
-<a id="camel.agents.chat_agent.ChatAgent.add_model_scheduling_strategy"></a>
-
-### add_model_scheduling_strategy
-
-```python
-def add_model_scheduling_strategy(self, name: str, strategy_fn: Callable):
-```
-
-Add a scheduling strategy method provided by user to ModelManger.
-
-**Parameters:**
-
-- **name** (str): The name of the strategy.
-- **strategy_fn** (Callable): The scheduling strategy function.
-
-<a id="camel.agents.chat_agent.ChatAgent.clone"></a>
-
-### clone
-
-```python
-def clone(self, with_memory: bool = False):
-```
-
-Creates a new instance of :obj:`ChatAgent` with the same
-configuration as the current instance.
-
-**Parameters:**
-
-- **with_memory** (bool): Whether to copy the memory (conversation history) to the new agent. If True, the new agent will have the same conversation history. If False, the new agent will have a fresh memory with only the system message. (default: :obj:`False`)
-
-**Returns:**
-
- ChatAgent: A new instance of :obj:`ChatAgent` with the same
-configuration.
-
-<a id="camel.agents.chat_agent.ChatAgent.__repr__"></a>
-
-### __repr__
-
-```python
-def __repr__(self):
-```
-
-**Returns:**
-
- str: The string representation of the :obj:`ChatAgent`.
-
-<a id="camel.agents.chat_agent.ChatAgent.to_mcp"></a>
-
-### to_mcp
-
-```python
-def to_mcp(
- self,
- name: str = 'CAMEL-ChatAgent',
- description: str = 'A helpful assistant using the CAMEL AI framework.',
- dependencies: Optional[List[str]] = None,
- host: str = 'localhost',
- port: int = 8000
-):
-```
-
-Expose this ChatAgent as an MCP server.
-
-**Parameters:**
-
-- **name** (str): Name of the MCP server. (default: :obj:`CAMEL-ChatAgent`)
-- **description** (Optional[List[str]]): Description of the agent. If None, a generic description is used. (default: :obj:`A helpful assistant using the CAMEL AI framework.`)
-- **dependencies** (Optional[List[str]]): Additional dependencies for the MCP server. (default: :obj:`None`)
-- **host** (str): Host to bind to for HTTP transport. (default: :obj:`localhost`)
-- **port** (int): Port to bind to for HTTP transport. (default: :obj:`8000`)
-
-**Returns:**
+<a id="camel.agents.chat_agent.ChatAgent._stream"></a>
- FastMCP: An MCP server instance that can be run.
-
-<a id="camel.agents.chat_agent.ChatAgent.stream"></a>
-
-### stream
+### _stream
```python
-def stream(
+def _stream(
self,
input_message: Union[BaseMessage, str],
response_format: Optional[Type[BaseModel]] = None
@@ -945,6 +1033,16 @@ intermediate responses as they are generated.
- **Yields**:
- **ChatAgentResponse**: Intermediate responses containing partial content, tool calls, and other information as they become available.
+<a id="camel.agents.chat_agent.ChatAgent._get_token_count"></a>
+
+### _get_token_count
+
+```python
+def _get_token_count(self, content: str):
+```
+
+Get token count for content with fallback.
+
<a id="camel.agents.chat_agent.ChatAgent._stream_response"></a>
### _stream_response
@@ -968,7 +1066,7 @@ Internal method to handle streaming responses with tool calls.
def _process_stream_chunks_with_accumulator(
self,
stream: Stream[ChatCompletionChunk],
- content_accumulator: '_StreamContentAccumulator',
+ content_accumulator: StreamContentAccumulator,
accumulated_tool_calls: Dict[str, Any],
tool_call_records: List[ToolCallingRecord],
step_token_usage: Dict[str, int],
@@ -1010,14 +1108,15 @@ any tool call is complete.
def _execute_tools_sync_with_status_accumulator(
self,
accumulated_tool_calls: Dict[str, Any],
- content_accumulator: '_StreamContentAccumulator',
+ content_accumulator: StreamContentAccumulator,
step_token_usage: Dict[str, int],
tool_call_records: List[ToolCallingRecord]
):
```
Execute multiple tools synchronously with
-proper content accumulation.
+proper content accumulation, using threads+queue for
+non-blocking status streaming.
<a id="camel.agents.chat_agent.ChatAgent._execute_tool_from_stream_data"></a>
@@ -1056,54 +1155,6 @@ Record the assistant message that contains tool calls.
This method creates and records an assistant message that includes
the tool calls information, which is required by OpenAI's API format.
-<a id="camel.agents.chat_agent.ChatAgent._create_tool_status_response"></a>
-
-### _create_tool_status_response
-
-```python
-def _create_tool_status_response(
- self,
- content: str,
- status_message: str,
- status_type: str,
- step_token_usage: Dict[str, int],
- tool_calls: Optional[List[ToolCallingRecord]] = None
-):
-```
-
-Create a generic tool status response to
-reduce code duplication.
-
-<a id="camel.agents.chat_agent.ChatAgent._create_simple_tool_calling_status"></a>
-
-### _create_simple_tool_calling_status
-
-```python
-def _create_simple_tool_calling_status(
- self,
- tool_call_data: Dict[str, Any],
- content: str,
- step_token_usage: Dict[str, int]
-):
-```
-
-Create a simple tool calling status response.
-
-<a id="camel.agents.chat_agent.ChatAgent._create_simple_tool_output_status"></a>
-
-### _create_simple_tool_output_status
-
-```python
-def _create_simple_tool_output_status(
- self,
- tool_call_record: ToolCallingRecord,
- content: str,
- step_token_usage: Dict[str, int]
-):
-```
-
-Create a simple tool output status response.
-
<a id="camel.agents.chat_agent.ChatAgent._create_tool_status_response_with_accumulator"></a>
### _create_tool_status_response_with_accumulator
@@ -1111,7 +1162,7 @@ Create a simple tool output status response.
```python
def _create_tool_status_response_with_accumulator(
self,
- accumulator: '_StreamContentAccumulator',
+ accumulator: StreamContentAccumulator,
status_message: str,
status_type: str,
step_token_usage: Dict[str, int],
@@ -1128,7 +1179,7 @@ Create a tool status response using content accumulator.
```python
def _create_streaming_response_with_accumulator(
self,
- accumulator: '_StreamContentAccumulator',
+ accumulator: StreamContentAccumulator,
new_content: str,
step_token_usage: Dict[str, int],
response_id: str = '',
@@ -1138,81 +1189,97 @@ def _create_streaming_response_with_accumulator(
Create a streaming response using content accumulator.
-<a id="camel.agents.chat_agent._StreamContentAccumulator"></a>
+<a id="camel.agents.chat_agent.ChatAgent.get_usage_dict"></a>
-## _StreamContentAccumulator
+### get_usage_dict
```python
-class _StreamContentAccumulator:
+def get_usage_dict(self, output_messages: List[BaseMessage], prompt_tokens: int):
```
-Manages content accumulation across streaming responses to ensure
-all responses contain complete cumulative content.
+Get usage dictionary when using the stream mode.
-<a id="camel.agents.chat_agent._StreamContentAccumulator.__init__"></a>
+**Parameters:**
-### __init__
+- **output_messages** (list): List of output messages.
+- **prompt_tokens** (int): Number of input prompt tokens.
-```python
-def __init__(self):
-```
+**Returns:**
-<a id="camel.agents.chat_agent._StreamContentAccumulator.set_base_content"></a>
+ dict: Usage dictionary.
-### set_base_content
+<a id="camel.agents.chat_agent.ChatAgent.add_model_scheduling_strategy"></a>
+
+### add_model_scheduling_strategy
```python
-def set_base_content(self, content: str):
+def add_model_scheduling_strategy(self, name: str, strategy_fn: Callable):
```
-Set the base content (usually empty or pre-tool content).
+Add a scheduling strategy method provided by user to ModelManger.
-<a id="camel.agents.chat_agent._StreamContentAccumulator.add_streaming_content"></a>
+**Parameters:**
-### add_streaming_content
+- **name** (str): The name of the strategy.
+- **strategy_fn** (Callable): The scheduling strategy function.
+
+<a id="camel.agents.chat_agent.ChatAgent.clone"></a>
+
+### clone
```python
-def add_streaming_content(self, new_content: str):
+def clone(self, with_memory: bool = False):
```
-Add new streaming content.
+Creates a new instance of :obj:`ChatAgent` with the same
+configuration as the current instance.
-<a id="camel.agents.chat_agent._StreamContentAccumulator.add_tool_status"></a>
+**Parameters:**
-### add_tool_status
+- **with_memory** (bool): Whether to copy the memory (conversation history) to the new agent. If True, the new agent will have the same conversation history. If False, the new agent will have a fresh memory with only the system message. (default: :obj:`False`)
-```python
-def add_tool_status(self, status_message: str):
-```
+**Returns:**
-Add a tool status message.
+ ChatAgent: A new instance of :obj:`ChatAgent` with the same
+configuration.
-<a id="camel.agents.chat_agent._StreamContentAccumulator.get_full_content"></a>
+<a id="camel.agents.chat_agent.ChatAgent.__repr__"></a>
-### get_full_content
+### __repr__
```python
-def get_full_content(self):
+def __repr__(self):
```
-Get the complete accumulated content.
+**Returns:**
-<a id="camel.agents.chat_agent._StreamContentAccumulator.get_content_with_new_status"></a>
+ str: The string representation of the :obj:`ChatAgent`.
-### get_content_with_new_status
+<a id="camel.agents.chat_agent.ChatAgent.to_mcp"></a>
+
+### to_mcp
```python
-def get_content_with_new_status(self, status_message: str):
+def to_mcp(
+ self,
+ name: str = 'CAMEL-ChatAgent',
+ description: str = 'A helpful assistant using the CAMEL AI framework.',
+ dependencies: Optional[List[str]] = None,
+ host: str = 'localhost',
+ port: int = 8000
+):
```
-Get content with a new status message appended.
+Expose this ChatAgent as an MCP server.
-<a id="camel.agents.chat_agent._StreamContentAccumulator.reset_streaming_content"></a>
+**Parameters:**
-### reset_streaming_content
+- **name** (str): Name of the MCP server. (default: :obj:`CAMEL-ChatAgent`)
+- **description** (Optional[List[str]]): Description of the agent. If None, a generic description is used. (default: :obj:`A helpful assistant using the CAMEL AI framework.`)
+- **dependencies** (Optional[List[str]]): Additional dependencies for the MCP server. (default: :obj:`None`)
+- **host** (str): Host to bind to for HTTP transport. (default: :obj:`localhost`)
+- **port** (int): Port to bind to for HTTP transport. (default: :obj:`8000`)
-```python
-def reset_streaming_content(self):
-```
+**Returns:**
-Reset only the streaming content, keep base and tool status.
+ FastMCP: An MCP server instance that can be run.
diff --git a/docs/mintlify/reference/camel.models.azure_openai_model.mdx b/docs/mintlify/reference/camel.models.azure_openai_model.mdx
index f27231d0d..e4f5a1e95 100644
--- a/docs/mintlify/reference/camel.models.azure_openai_model.mdx
+++ b/docs/mintlify/reference/camel.models.azure_openai_model.mdx
@@ -130,8 +130,6 @@ def _request_stream_parse(
Request streaming structured output parsing.
-Note: This uses OpenAI's beta streaming API for structured outputs.
-
<a id="camel.models.azure_openai_model.AzureOpenAIModel.check_model_config"></a>
### check_model_config
diff --git a/docs/mintlify/reference/camel.models.base_model.mdx b/docs/mintlify/reference/camel.models.base_model.mdx
index d6db74e5f..abf8afe60 100644
--- a/docs/mintlify/reference/camel.models.base_model.mdx
+++ b/docs/mintlify/reference/camel.models.base_model.mdx
@@ -161,7 +161,8 @@ Runs the query to the backend model in a non-stream mode.
Union[ChatCompletion, Stream[ChatCompletionChunk], Any]:
`ChatCompletion` in the non-stream mode, or
`Stream[ChatCompletionChunk]` in the stream mode,
-or other stream managers for structured output.
+or `ChatCompletionStreamManager[BaseModel]` in the structured
+stream mode.
<a id="camel.models.base_model.BaseModelBackend.run"></a>
@@ -189,7 +190,8 @@ Runs the query to the backend model.
Union[ChatCompletion, Stream[ChatCompletionChunk], Any]:
`ChatCompletion` in the non-stream mode,
`Stream[ChatCompletionChunk]` in the stream mode, or
-other stream managers for structured output.
+`ChatCompletionStreamManager[BaseModel]` in the structured
+stream mode.
<a id="camel.models.base_model.BaseModelBackend.check_model_config"></a>
diff --git a/docs/mintlify/reference/camel.models.model_manager.mdx b/docs/mintlify/reference/camel.models.model_manager.mdx
index b6551acd4..e6309ae57 100644
--- a/docs/mintlify/reference/camel.models.model_manager.mdx
+++ b/docs/mintlify/reference/camel.models.model_manager.mdx
@@ -203,6 +203,9 @@ and returns a single response.
**Returns:**
- Union[ChatCompletion, Stream[ChatCompletionChunk]]:
+ Union[ChatCompletion, Stream[ChatCompletionChunk],
+ChatCompletionStreamManager[BaseModel]]:
`ChatCompletion` in the non-stream mode, or
-`Stream[ChatCompletionChunk]` in the stream mode.
+`Stream[ChatCompletionChunk]` in the stream mode, or
+`ChatCompletionStreamManager[BaseModel]` for
+structured-output stream.
diff --git a/docs/mintlify/reference/camel.models.openai_compatible_model.mdx b/docs/mintlify/reference/camel.models.openai_compatible_model.mdx
index fe86349f6..548751f1f 100644
--- a/docs/mintlify/reference/camel.models.openai_compatible_model.mdx
+++ b/docs/mintlify/reference/camel.models.openai_compatible_model.mdx
@@ -107,8 +107,6 @@ def _request_stream_parse(
Request streaming structured output parsing.
-Note: This uses OpenAI's beta streaming API for structured outputs.
-
<a id="camel.models.openai_compatible_model.OpenAICompatibleModel.token_counter"></a>
### token_counter
diff --git a/docs/mintlify/reference/camel.models.openai_model.mdx b/docs/mintlify/reference/camel.models.openai_model.mdx
index 8a6955465..ac1961c65 100644
--- a/docs/mintlify/reference/camel.models.openai_model.mdx
+++ b/docs/mintlify/reference/camel.models.openai_model.mdx
@@ -151,8 +151,6 @@ def _request_stream_parse(
Request streaming structured output parsing.
-Note: This uses OpenAI's beta streaming API for structured outputs.
-
<a id="camel.models.openai_model.OpenAIModel.check_model_config"></a>
### check_model_config
diff --git a/docs/reference/camel.agents.chat_agent.md b/docs/reference/camel.agents.chat_agent.md
index 5727c047f..ef98894bd 100644
--- a/docs/reference/camel.agents.chat_agent.md
+++ b/docs/reference/camel.agents.chat_agent.md
@@ -922,3 +922,297 @@ Expose this ChatAgent as an MCP server.
**Returns:**
FastMCP: An MCP server instance that can be run.
+
+<a id="camel.agents.chat_agent.ChatAgent.stream"></a>
+
+### stream
+
+```python
+def stream(
+ self,
+ input_message: Union[BaseMessage, str],
+ response_format: Optional[Type[BaseModel]] = None
+):
+```
+
+Executes a streaming step in the chat session, yielding
+intermediate responses as they are generated.
+
+**Parameters:**
+
+- **input_message** (Union[BaseMessage, str]): The input message for the agent.
+- **response_format** (Optional[Type[BaseModel]], optional): A Pydantic model defining the expected structure of the response.
+- **Yields**:
+- **ChatAgentResponse**: Intermediate responses containing partial content, tool calls, and other information as they become available.
+
+<a id="camel.agents.chat_agent.ChatAgent._stream_response"></a>
+
+### _stream_response
+
+```python
+def _stream_response(
+ self,
+ openai_messages: List[OpenAIMessage],
+ num_tokens: int,
+ response_format: Optional[Type[BaseModel]] = None
+):
+```
+
+Internal method to handle streaming responses with tool calls.
+
+<a id="camel.agents.chat_agent.ChatAgent._process_stream_chunks_with_accumulator"></a>
+
+### _process_stream_chunks_with_accumulator
+
+```python
+def _process_stream_chunks_with_accumulator(
+ self,
+ stream: Stream[ChatCompletionChunk],
+ content_accumulator: '_StreamContentAccumulator',
+ accumulated_tool_calls: Dict[str, Any],
+ tool_call_records: List[ToolCallingRecord],
+ step_token_usage: Dict[str, int],
+ response_format: Optional[Type[BaseModel]] = None
+):
+```
+
+Process streaming chunks with content accumulator.
+
+<a id="camel.agents.chat_agent.ChatAgent._accumulate_tool_calls"></a>
+
+### _accumulate_tool_calls
+
+```python
+def _accumulate_tool_calls(
+ self,
+ tool_call_deltas: List[Any],
+ accumulated_tool_calls: Dict[str, Any]
+):
+```
+
+Accumulate tool call chunks and return True when
+any tool call is complete.
+
+**Parameters:**
+
+- **tool_call_deltas** (List[Any]): List of tool call deltas.
+- **accumulated_tool_calls** (Dict[str, Any]): Dictionary of accumulated tool calls.
+
+**Returns:**
+
+ bool: True if any tool call is complete, False otherwise.
+
+<a id="camel.agents.chat_agent.ChatAgent._execute_tools_sync_with_status_accumulator"></a>
+
+### _execute_tools_sync_with_status_accumulator
+
+```python
+def _execute_tools_sync_with_status_accumulator(
+ self,
+ accumulated_tool_calls: Dict[str, Any],
+ content_accumulator: '_StreamContentAccumulator',
+ step_token_usage: Dict[str, int],
+ tool_call_records: List[ToolCallingRecord]
+):
+```
+
+Execute multiple tools synchronously with
+proper content accumulation.
+
+<a id="camel.agents.chat_agent.ChatAgent._execute_tool_from_stream_data"></a>
+
+### _execute_tool_from_stream_data
+
+```python
+def _execute_tool_from_stream_data(self, tool_call_data: Dict[str, Any]):
+```
+
+Execute a tool from accumulated stream data.
+
+<a id="camel.agents.chat_agent.ChatAgent._create_error_response"></a>
+
+### _create_error_response
+
+```python
+def _create_error_response(
+ self,
+ error_message: str,
+ tool_call_records: List[ToolCallingRecord]
+):
+```
+
+Create an error response for streaming.
+
+<a id="camel.agents.chat_agent.ChatAgent._record_assistant_tool_calls_message"></a>
+
+### _record_assistant_tool_calls_message
+
+```python
+def _record_assistant_tool_calls_message(self, accumulated_tool_calls: Dict[str, Any], content: str = ''):
+```
+
+Record the assistant message that contains tool calls.
+
+This method creates and records an assistant message that includes
+the tool calls information, which is required by OpenAI's API format.
+
+<a id="camel.agents.chat_agent.ChatAgent._create_tool_status_response"></a>
+
+### _create_tool_status_response
+
+```python
+def _create_tool_status_response(
+ self,
+ content: str,
+ status_message: str,
+ status_type: str,
+ step_token_usage: Dict[str, int],
+ tool_calls: Optional[List[ToolCallingRecord]] = None
+):
+```
+
+Create a generic tool status response to
+reduce code duplication.
+
+<a id="camel.agents.chat_agent.ChatAgent._create_simple_tool_calling_status"></a>
+
+### _create_simple_tool_calling_status
+
+```python
+def _create_simple_tool_calling_status(
+ self,
+ tool_call_data: Dict[str, Any],
+ content: str,
+ step_token_usage: Dict[str, int]
+):
+```
+
+Create a simple tool calling status response.
+
+<a id="camel.agents.chat_agent.ChatAgent._create_simple_tool_output_status"></a>
+
+### _create_simple_tool_output_status
+
+```python
+def _create_simple_tool_output_status(
+ self,
+ tool_call_record: ToolCallingRecord,
+ content: str,
+ step_token_usage: Dict[str, int]
+):
+```
+
+Create a simple tool output status response.
+
+<a id="camel.agents.chat_agent.ChatAgent._create_tool_status_response_with_accumulator"></a>
+
+### _create_tool_status_response_with_accumulator
+
+```python
+def _create_tool_status_response_with_accumulator(
+ self,
+ accumulator: '_StreamContentAccumulator',
+ status_message: str,
+ status_type: str,
+ step_token_usage: Dict[str, int],
+ tool_calls: Optional[List[ToolCallingRecord]] = None
+):
+```
+
+Create a tool status response using content accumulator.
+
+<a id="camel.agents.chat_agent.ChatAgent._create_streaming_response_with_accumulator"></a>
+
+### _create_streaming_response_with_accumulator
+
+```python
+def _create_streaming_response_with_accumulator(
+ self,
+ accumulator: '_StreamContentAccumulator',
+ new_content: str,
+ step_token_usage: Dict[str, int],
+ response_id: str = '',
+ tool_call_records: Optional[List[ToolCallingRecord]] = None
+):
+```
+
+Create a streaming response using content accumulator.
+
+<a id="camel.agents.chat_agent._StreamContentAccumulator"></a>
+
+## _StreamContentAccumulator
+
+```python
+class _StreamContentAccumulator:
+```
+
+Manages content accumulation across streaming responses to ensure
+all responses contain complete cumulative content.
+
+<a id="camel.agents.chat_agent._StreamContentAccumulator.__init__"></a>
+
+### __init__
+
+```python
+def __init__(self):
+```
+
+<a id="camel.agents.chat_agent._StreamContentAccumulator.set_base_content"></a>
+
+### set_base_content
+
+```python
+def set_base_content(self, content: str):
+```
+
+Set the base content (usually empty or pre-tool content).
+
+<a id="camel.agents.chat_agent._StreamContentAccumulator.add_streaming_content"></a>
+
+### add_streaming_content
+
+```python
+def add_streaming_content(self, new_content: str):
+```
+
+Add new streaming content.
+
+<a id="camel.agents.chat_agent._StreamContentAccumulator.add_tool_status"></a>
+
+### add_tool_status
+
+```python
+def add_tool_status(self, status_message: str):
+```
+
+Add a tool status message.
+
+<a id="camel.agents.chat_agent._StreamContentAccumulator.get_full_content"></a>
+
+### get_full_content
+
+```python
+def get_full_content(self):
+```
+
+Get the complete accumulated content.
+
+<a id="camel.agents.chat_agent._StreamContentAccumulator.get_content_with_new_status"></a>
+
+### get_content_with_new_status
+
+```python
+def get_content_with_new_status(self, status_message: str):
+```
+
+Get content with a new status message appended.
+
+<a id="camel.agents.chat_agent._StreamContentAccumulator.reset_streaming_content"></a>
+
+### reset_streaming_content
+
+```python
+def reset_streaming_content(self):
+```
+
+Reset only the streaming content, keep base and tool status.
diff --git a/docs/reference/camel.models.azure_openai_model.md b/docs/reference/camel.models.azure_openai_model.md
new file mode 100644
index 000000000..f27231d0d
--- /dev/null
+++ b/docs/reference/camel.models.azure_openai_model.md
@@ -0,0 +1,153 @@
+<a id="camel.models.azure_openai_model"></a>
+
+<a id="camel.models.azure_openai_model.AzureOpenAIModel"></a>
+
+## AzureOpenAIModel
+
+```python
+class AzureOpenAIModel(BaseModelBackend):
+```
+
+Azure OpenAI API in a unified BaseModelBackend interface.
+
+**Parameters:**
+
+- **model_type** (Union[ModelType, str]): Model for which a backend is created, one of GPT_* series.
+- **model_config_dict** (Optional[Dict[str, Any]], optional): A dictionary that will be fed into:obj:`openai.ChatCompletion.create()`. If :obj:`None`, :obj:`ChatGPTConfig().as_dict()` will be used. (default: :obj:`None`)
+- **api_key** (Optional[str], optional): The API key for authenticating with the OpenAI service. (default: :obj:`None`)
+- **url** (Optional[str], optional): The url to the OpenAI service. (default: :obj:`None`)
+- **api_version** (Optional[str], optional): The api version for the model. (default: :obj:`None`)
+- **azure_deployment_name** (Optional[str], optional): The deployment name you chose when you deployed an azure model. (default: :obj:`None`)
+- **azure_ad_token** (Optional[str], optional): Your Azure Active Directory token, https://www.microsoft.com/en-us/security/business/ identity-access/microsoft-entra-id. (default: :obj:`None`)
+- **azure_ad_token_provider** (Optional[AzureADTokenProvider], optional): A function that returns an Azure Active Directory token, will be invoked on every request. (default: :obj:`None`)
+- **token_counter** (Optional[BaseTokenCounter], optional): Token counter to use for the model. If not provided, :obj:`OpenAITokenCounter` will be used. (default: :obj:`None`)
+- **timeout** (Optional[float], optional): The timeout value in seconds for API calls. If not provided, will fall back to the MODEL_TIMEOUT environment variable or default to 180 seconds. (default: :obj:`None`)
+- **max_retries** (int, optional): Maximum number of retries for API calls. (default: :obj:`3`) **kwargs (Any): Additional arguments to pass to the client initialization.
+- **References**:
+- **https**: //learn.microsoft.com/en-us/azure/ai-services/openai/
+
+<a id="camel.models.azure_openai_model.AzureOpenAIModel.__init__"></a>
+
+### __init__
+
+```python
+def __init__(
+ self,
+ model_type: Union[ModelType, str],
+ model_config_dict: Optional[Dict[str, Any]] = None,
+ api_key: Optional[str] = None,
+ url: Optional[str] = None,
+ timeout: Optional[float] = None,
+ token_counter: Optional[BaseTokenCounter] = None,
+ api_version: Optional[str] = None,
+ azure_deployment_name: Optional[str] = None,
+ azure_ad_token_provider: Optional['AzureADTokenProvider'] = None,
+ azure_ad_token: Optional[str] = None,
+ max_retries: int = 3,
+ **kwargs: Any
+):
+```
+
+<a id="camel.models.azure_openai_model.AzureOpenAIModel.token_counter"></a>
+
+### token_counter
+
+```python
+def token_counter(self):
+```
+
+**Returns:**
+
+ BaseTokenCounter: The token counter following the model's
+tokenization style.
+
+<a id="camel.models.azure_openai_model.AzureOpenAIModel._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 Azure OpenAI 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.
+`ChatCompletionStreamManager[BaseModel]` for
+structured output streaming.
+
+<a id="camel.models.azure_openai_model.AzureOpenAIModel._request_chat_completion"></a>
+
+### _request_chat_completion
+
+```python
+def _request_chat_completion(
+ self,
+ messages: List[OpenAIMessage],
+ tools: Optional[List[Dict[str, Any]]] = None
+):
+```
+
+<a id="camel.models.azure_openai_model.AzureOpenAIModel._request_parse"></a>
+
+### _request_parse
+
+```python
+def _request_parse(
+ self,
+ messages: List[OpenAIMessage],
+ response_format: Type[BaseModel],
+ tools: Optional[List[Dict[str, Any]]] = None
+):
+```
+
+<a id="camel.models.azure_openai_model.AzureOpenAIModel._request_stream_parse"></a>
+
+### _request_stream_parse
+
+```python
+def _request_stream_parse(
+ self,
+ messages: List[OpenAIMessage],
+ response_format: Type[BaseModel],
+ tools: Optional[List[Dict[str, Any]]] = None
+):
+```
+
+Request streaming structured output parsing.
+
+Note: This uses OpenAI's beta streaming API for structured outputs.
+
+<a id="camel.models.azure_openai_model.AzureOpenAIModel.check_model_config"></a>
+
+### check_model_config
+
+```python
+def check_model_config(self):
+```
+
+<a id="camel.models.azure_openai_model.AzureOpenAIModel.stream"></a>
+
+### stream
+
+```python
+def stream(self):
+```
+
+**Returns:**
+
+ bool: Whether the model is in stream mode.
diff --git a/docs/reference/camel.models.base_model.md b/docs/reference/camel.models.base_model.md
index 658bf2cfd..d6db74e5f 100644
--- a/docs/reference/camel.models.base_model.md
+++ b/docs/reference/camel.models.base_model.md
@@ -148,6 +148,21 @@ def _run(
):
```
+Runs the query to the backend model in a non-stream mode.
+
+**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], Any]:
+`ChatCompletion` in the non-stream mode, or
+`Stream[ChatCompletionChunk]` in the stream mode,
+or other stream managers for structured output.
+
<a id="camel.models.base_model.BaseModelBackend.run"></a>
### run
@@ -171,9 +186,10 @@ Runs the query to the backend model.
**Returns:**
- Union[ChatCompletion, Stream[ChatCompletionChunk]]:
-`ChatCompletion` in the non-stream mode, or
-`Stream[ChatCompletionChunk]` in the stream mode.
+ Union[ChatCompletion, Stream[ChatCompletionChunk], Any]:
+`ChatCompletion` in the non-stream mode,
+`Stream[ChatCompletionChunk]` in the stream mode, or
+other stream managers for structured output.
<a id="camel.models.base_model.BaseModelBackend.check_model_config"></a>
diff --git a/docs/reference/camel.models.openai_compatible_model.md b/docs/reference/camel.models.openai_compatible_model.md
new file mode 100644
index 000000000..fe86349f6
--- /dev/null
+++ b/docs/reference/camel.models.openai_compatible_model.md
@@ -0,0 +1,143 @@
+<a id="camel.models.openai_compatible_model"></a>
+
+<a id="camel.models.openai_compatible_model.OpenAICompatibleModel"></a>
+
+## OpenAICompatibleModel
+
+```python
+class OpenAICompatibleModel(BaseModelBackend):
+```
+
+Constructor for model backend supporting OpenAI compatibility.
+
+**Parameters:**
+
+- **model_type** (Union[ModelType, str]): Model for which a backend is created.
+- **model_config_dict** (Optional[Dict[str, Any]], optional): A dictionary that will be fed into:obj:`openai.ChatCompletion.create()`. If :obj:`None`, :obj:`{}` will be used. (default: :obj:`None`)
+- **api_key** (str): The API key for authenticating with the model service.
+- **url** (str): The url to the model service.
+- **token_counter** (Optional[BaseTokenCounter], optional): Token counter to use for the model. If not provided, :obj:`OpenAITokenCounter( ModelType.GPT_4O_MINI)` will be used. (default: :obj:`None`)
+- **timeout** (Optional[float], optional): The timeout value in seconds for API calls. If not provided, will fall back to the MODEL_TIMEOUT environment variable or default to 180 seconds. (default: :obj:`None`)
+- **max_retries** (int, optional): Maximum number of retries for API calls. (default: :obj:`3`) **kwargs (Any): Additional arguments to pass to the OpenAI client initialization. These can include parameters like 'organization', 'default_headers', 'http_client', etc.
+
+<a id="camel.models.openai_compatible_model.OpenAICompatibleModel.__init__"></a>
+
+### __init__
+
+```python
+def __init__(
+ self,
+ model_type: Union[ModelType, str],
+ model_config_dict: Optional[Dict[str, Any]] = None,
+ api_key: Optional[str] = None,
+ url: Optional[str] = None,
+ token_counter: Optional[BaseTokenCounter] = None,
+ timeout: Optional[float] = None,
+ max_retries: int = 3,
+ **kwargs: Any
+):
+```
+
+<a id="camel.models.openai_compatible_model.OpenAICompatibleModel._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 OpenAI 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.
+`ChatCompletionStreamManager[BaseModel]` for
+structured output streaming.
+
+<a id="camel.models.openai_compatible_model.OpenAICompatibleModel._request_chat_completion"></a>
+
+### _request_chat_completion
+
+```python
+def _request_chat_completion(
+ self,
+ messages: List[OpenAIMessage],
+ tools: Optional[List[Dict[str, Any]]] = None
+):
+```
+
+<a id="camel.models.openai_compatible_model.OpenAICompatibleModel._request_parse"></a>
+
+### _request_parse
+
+```python
+def _request_parse(
+ self,
+ messages: List[OpenAIMessage],
+ response_format: Type[BaseModel],
+ tools: Optional[List[Dict[str, Any]]] = None
+):
+```
+
+<a id="camel.models.openai_compatible_model.OpenAICompatibleModel._request_stream_parse"></a>
+
+### _request_stream_parse
+
+```python
+def _request_stream_parse(
+ self,
+ messages: List[OpenAIMessage],
+ response_format: Type[BaseModel],
+ tools: Optional[List[Dict[str, Any]]] = None
+):
+```
+
+Request streaming structured output parsing.
+
+Note: This uses OpenAI's beta streaming API for structured outputs.
+
+<a id="camel.models.openai_compatible_model.OpenAICompatibleModel.token_counter"></a>
+
+### token_counter
+
+```python
+def token_counter(self):
+```
+
+**Returns:**
+
+ OpenAITokenCounter: The token counter following the model's
+tokenization style.
+
+<a id="camel.models.openai_compatible_model.OpenAICompatibleModel.stream"></a>
+
+### stream
+
+```python
+def stream(self):
+```
+
+**Returns:**
+
+ bool: Whether the model is in stream mode.
+
+<a id="camel.models.openai_compatible_model.OpenAICompatibleModel.check_model_config"></a>
+
+### check_model_config
+
+```python
+def check_model_config(self):
+```
diff --git a/docs/reference/camel.models.openai_model.md b/docs/reference/camel.models.openai_model.md
new file mode 100644
index 000000000..8a6955465
--- /dev/null
+++ b/docs/reference/camel.models.openai_model.md
@@ -0,0 +1,174 @@
+<a id="camel.models.openai_model"></a>
+
+<a id="camel.models.openai_model.OpenAIModel"></a>
+
+## OpenAIModel
+
+```python
+class OpenAIModel(BaseModelBackend):
+```
+
+OpenAI API in a unified BaseModelBackend interface.
+
+**Parameters:**
+
+- **model_type** (Union[ModelType, str]): Model for which a backend is created, one of GPT_* series.
+- **model_config_dict** (Optional[Dict[str, Any]], optional): A dictionary that will be fed into:obj:`openai.ChatCompletion.create()`. If :obj:`None`, :obj:`ChatGPTConfig().as_dict()` will be used. (default: :obj:`None`)
+- **api_key** (Optional[str], optional): The API key for authenticating with the OpenAI service. (default: :obj:`None`)
+- **url** (Optional[str], optional): The url to the OpenAI service. (default: :obj:`None`)
+- **token_counter** (Optional[BaseTokenCounter], optional): Token counter to use for the model. If not provided, :obj:`OpenAITokenCounter` will be used. (default: :obj:`None`)
+- **timeout** (Optional[float], optional): The timeout value in seconds for API calls. If not provided, will fall back to the MODEL_TIMEOUT environment variable or default to 180 seconds. (default: :obj:`None`)
+- **max_retries** (int, optional): Maximum number of retries for API calls. (default: :obj:`3`) **kwargs (Any): Additional arguments to pass to the OpenAI client initialization. These can include parameters like 'organization', 'default_headers', 'http_client', etc.
+
+<a id="camel.models.openai_model.OpenAIModel.__init__"></a>
+
+### __init__
+
+```python
+def __init__(
+ self,
+ model_type: Union[ModelType, str],
+ model_config_dict: Optional[Dict[str, Any]] = None,
+ api_key: Optional[str] = None,
+ url: Optional[str] = None,
+ token_counter: Optional[BaseTokenCounter] = None,
+ timeout: Optional[float] = None,
+ max_retries: int = 3,
+ **kwargs: Any
+):
+```
+
+<a id="camel.models.openai_model.OpenAIModel._sanitize_config"></a>
+
+### _sanitize_config
+
+```python
+def _sanitize_config(self, config_dict: Dict[str, Any]):
+```
+
+Sanitize the model configuration for O1 models.
+
+<a id="camel.models.openai_model.OpenAIModel._adapt_messages_for_o1_models"></a>
+
+### _adapt_messages_for_o1_models
+
+```python
+def _adapt_messages_for_o1_models(self, messages: List[OpenAIMessage]):
+```
+
+Adjust message roles to comply with O1 model requirements by
+converting 'system' or 'developer' to 'user' role.
+
+**Parameters:**
+
+- **messages** (List[OpenAIMessage]): Message list with the chat history in OpenAI API format.
+
+**Returns:**
+
+ processed_messages (List[OpenAIMessage]): Return a new list of
+messages to avoid mutating input.
+
+<a id="camel.models.openai_model.OpenAIModel.token_counter"></a>
+
+### token_counter
+
+```python
+def token_counter(self):
+```
+
+**Returns:**
+
+ BaseTokenCounter: The token counter following the model's
+tokenization style.
+
+<a id="camel.models.openai_model.OpenAIModel._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 OpenAI 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],
+ChatCompletionStreamManager[BaseModel]]:
+`ChatCompletion` in the non-stream mode,
+`Stream[ChatCompletionChunk]`in the stream mode,
+or `ChatCompletionStreamManager[BaseModel]` for
+structured output streaming.
+
+<a id="camel.models.openai_model.OpenAIModel._request_chat_completion"></a>
+
+### _request_chat_completion
+
+```python
+def _request_chat_completion(
+ self,
+ messages: List[OpenAIMessage],
+ tools: Optional[List[Dict[str, Any]]] = None
+):
+```
+
+<a id="camel.models.openai_model.OpenAIModel._request_parse"></a>
+
+### _request_parse
+
+```python
+def _request_parse(
+ self,
+ messages: List[OpenAIMessage],
+ response_format: Type[BaseModel],
+ tools: Optional[List[Dict[str, Any]]] = None
+):
+```
+
+<a id="camel.models.openai_model.OpenAIModel._request_stream_parse"></a>
+
+### _request_stream_parse
+
+```python
+def _request_stream_parse(
+ self,
+ messages: List[OpenAIMessage],
+ response_format: Type[BaseModel],
+ tools: Optional[List[Dict[str, Any]]] = None
+):
+```
+
+Request streaming structured output parsing.
+
+Note: This uses OpenAI's beta streaming API for structured outputs.
+
+<a id="camel.models.openai_model.OpenAIModel.check_model_config"></a>
+
+### check_model_config
+
+```python
+def check_model_config(self):
+```
+
+<a id="camel.models.openai_model.OpenAIModel.stream"></a>
+
+### stream
+
+```python
+def stream(self):
+```
+
+**Returns:**
+
+ bool: Whether the model is in stream mode.