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

feat: Support xAI native client and openai compatible response client (#4010)

Wendong-Fan095f039e43b8
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index 72aba41be..e4eead514 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -26,7 +26,7 @@ body:
attributes:
label: What version of camel are you using?
description: Run command `python3 -c 'print(__import__("camel").__version__)'` in your shell and paste the output here.
- placeholder: E.g., 0.2.91a0
+ placeholder: E.g., 0.2.91a1
validations:
required: true
diff --git a/camel/__init__.py b/camel/__init__.py
index 12783a412..2ac5f1015 100644
--- a/camel/__init__.py
+++ b/camel/__init__.py
@@ -14,7 +14,7 @@
from camel.logger import disable_logging, enable_logging, set_log_level
-__version__ = '0.2.91a0'
+__version__ = '0.2.91a1'
__all__ = [
'__version__',
diff --git a/camel/configs/__init__.py b/camel/configs/__init__.py
index 9d329f282..e28814c5e 100644
--- a/camel/configs/__init__.py
+++ b/camel/configs/__init__.py
@@ -60,6 +60,7 @@ from .togetherai_config import TOGETHERAI_API_PARAMS, TogetherAIConfig
from .vllm_config import VLLM_API_PARAMS, VLLMConfig
from .volcano_config import VOLCANO_API_PARAMS, VolcanoConfig
from .watsonx_config import WATSONX_API_PARAMS, WatsonXConfig
+from .xai_config import XAI_API_PARAMS, XAIConfig
from .yi_config import YI_API_PARAMS, YiConfig
from .zhipuai_config import ZHIPUAI_API_PARAMS, ZhipuAIConfig
@@ -151,4 +152,6 @@ __all__ = [
'VOLCANO_API_PARAMS',
'AvianConfig',
'AVIAN_API_PARAMS',
+ 'XAIConfig',
+ 'XAI_API_PARAMS',
]
diff --git a/camel/configs/xai_config.py b/camel/configs/xai_config.py
new file mode 100644
index 000000000..2d25905d9
--- /dev/null
+++ b/camel/configs/xai_config.py
@@ -0,0 +1,89 @@
+# ========= Copyright 2023-2026 @ CAMEL-AI.org. All Rights Reserved. =========
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ========= Copyright 2023-2026 @ CAMEL-AI.org. All Rights Reserved. =========
+
+from __future__ import annotations
+
+from typing import Dict, Optional, Sequence, Type, Union
+
+from pydantic import BaseModel
+
+from camel.configs.base_config import BaseConfig
+
+
+class XAIConfig(BaseConfig):
+ r"""Defines the parameters for generating chat completions using the
+ xAI native SDK (gRPC).
+
+ Args:
+ temperature (float, optional): Sampling temperature to use, between
+ :obj:`0` and :obj:`2`. Higher values make the output more random,
+ while lower values make it more focused and deterministic.
+ (default: :obj:`None`)
+ top_p (float, optional): An alternative to sampling with temperature,
+ called nucleus sampling, where the model considers the results of
+ the tokens with top_p probability mass. So :obj:`0.1` means only
+ the tokens comprising the top 10% probability mass are considered.
+ (default: :obj:`None`)
+ max_tokens (int, optional): The maximum number of tokens to generate
+ in the chat completion. (default: :obj:`None`)
+ stop (str or list, optional): Up to :obj:`4` sequences where the API
+ will stop generating further tokens. (default: :obj:`None`)
+ stream (bool, optional): If True, partial message deltas will be sent
+ as they become available. (default: :obj:`None`)
+ response_format (object, optional): An object specifying the format
+ that the model must output. Setting to a Pydantic BaseModel enables
+ JSON schema mode for structured outputs.
+ (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. :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.
+ (default: :obj:`None`)
+ reasoning_effort (str, optional): Controls the reasoning effort for
+ reasoning models. Valid values: :obj:`"low"`, :obj:`"medium"`,
+ :obj:`"high"`. (default: :obj:`None`)
+ use_encrypted_content (bool, optional): If True, encrypted reasoning
+ traces will be returned and preserved across conversation turns.
+ This is required for multi-turn reasoning with thinking models.
+ (default: :obj:`None`)
+ store_messages (bool, optional): If True, request/response history is
+ stored on xAI's servers for up to 30 days, enabling conversation
+ chaining via previous_response_id. If False, history is managed
+ locally. (default: :obj:`None`)
+ frequency_penalty (float, optional): Penalizes new tokens based on
+ their existing frequency in the text so far. Values between
+ :obj:`-2.0` and :obj:`2.0`. (default: :obj:`None`)
+ presence_penalty (float, optional): Penalizes new tokens based on
+ whether they appear in the text so far. Values between
+ :obj:`-2.0` and :obj:`2.0`. (default: :obj:`None`)
+ """
+
+ temperature: Optional[float] = None
+ top_p: Optional[float] = None
+ max_tokens: Optional[int] = None
+ stop: Optional[Union[str, Sequence[str]]] = None
+ stream: Optional[bool] = None
+ response_format: Optional[Union[Type[BaseModel], dict]] = None
+ tool_choice: Optional[
+ Union[Dict[str, Union[str, Dict[str, str]]], str]
+ ] = None
+ reasoning_effort: Optional[str] = None
+ use_encrypted_content: Optional[bool] = None
+ store_messages: Optional[bool] = None
+ frequency_penalty: Optional[float] = None
+ presence_penalty: Optional[float] = None
+
+
+XAI_API_PARAMS = {param for param in XAIConfig.model_fields.keys()}
diff --git a/camel/embeddings/vlm_embedding.py b/camel/embeddings/vlm_embedding.py
index 7fe5f2382..f4fd43e11 100644
--- a/camel/embeddings/vlm_embedding.py
+++ b/camel/embeddings/vlm_embedding.py
@@ -110,11 +110,11 @@ class VisionLanguageEmbedding(BaseEmbedding[Union[str, Image.Image]]):
images=obj,
return_tensors="pt",
padding=True,
- **image_processor_kwargs,
+ **(image_processor_kwargs or {}),
)
image_feature = (
self.model.get_image_features(
- **image_input, **model_kwargs
+ **image_input, **(model_kwargs or {})
)
.squeeze(dim=0)
.tolist()
@@ -125,10 +125,12 @@ class VisionLanguageEmbedding(BaseEmbedding[Union[str, Image.Image]]):
text=obj,
return_tensors="pt",
padding=True,
- **tokenizer_kwargs,
+ **(tokenizer_kwargs or {}),
)
text_feature = (
- self.model.get_text_features(**text_input, **model_kwargs)
+ self.model.get_text_features(
+ **text_input, **(model_kwargs or {})
+ )
.squeeze(dim=0)
.tolist()
)
diff --git a/camel/interpreters/internal_python_interpreter.py b/camel/interpreters/internal_python_interpreter.py
index c75556abe..6849f316b 100644
--- a/camel/interpreters/internal_python_interpreter.py
+++ b/camel/interpreters/internal_python_interpreter.py
@@ -405,7 +405,7 @@ class InternalPythonInterpreter(BaseInterpreter):
keyword.arg: self._execute_ast(keyword.value)
for keyword in call.keywords
}
- return callable_func(*args, **kwargs)
+ return callable_func(*args, **kwargs) # type: ignore[arg-type]
def _execute_subscript(self, subscript: ast.Subscript):
index = self._execute_ast(subscript.slice)
diff --git a/camel/models/__init__.py b/camel/models/__init__.py
index eb555789a..f6c6a0ff3 100644
--- a/camel/models/__init__.py
+++ b/camel/models/__init__.py
@@ -62,6 +62,7 @@ from .togetherai_model import TogetherAIModel
from .vllm_model import VLLMModel
from .volcano_model import VolcanoModel
from .watsonx_model import WatsonXModel
+from .xai_model import XAIModel
from .yi_model import YiModel
from .zhipuai_model import ZhipuAIModel
@@ -120,4 +121,5 @@ __all__ = [
'AihubMixModel',
'FunctionGemmaModel',
'AvianModel',
+ 'XAIModel',
]
diff --git a/camel/models/mistral_model.py b/camel/models/mistral_model.py
index e8a5ecc86..f73d97568 100644
--- a/camel/models/mistral_model.py
+++ b/camel/models/mistral_model.py
@@ -202,15 +202,15 @@ class MistralModel(BaseModelBackend):
mistral_tool_calls = []
for tool_call in tool_calls_list:
function_call = FunctionCall(
- name=tool_call["function"].get("name"), # type: ignore[attr-defined]
- arguments=tool_call["function"].get("arguments"), # type: ignore[attr-defined]
+ name=tool_call["function"].get("name"), # type: ignore[index]
+ arguments=tool_call["function"].get("arguments"), # type: ignore[index]
)
# Preserve the original tool call id to keep tool result
# ordering valid across turns.
mistral_tool_calls.append(
ToolCall(
function=function_call,
- id=tool_call.get("id"), # type: ignore[attr-defined]
+ id=tool_call.get("id"), # type: ignore[union-attr]
)
)
diff --git a/camel/models/model_factory.py b/camel/models/model_factory.py
index 19b1306f8..fe4c5825b 100644
--- a/camel/models/model_factory.py
+++ b/camel/models/model_factory.py
@@ -60,6 +60,7 @@ from camel.models.togetherai_model import TogetherAIModel
from camel.models.vllm_model import VLLMModel
from camel.models.volcano_model import VolcanoModel
from camel.models.watsonx_model import WatsonXModel
+from camel.models.xai_model import XAIModel
from camel.models.yi_model import YiModel
from camel.models.zhipuai_model import ZhipuAIModel
from camel.types import ModelPlatformType, ModelType, UnifiedModelType
@@ -121,6 +122,7 @@ class ModelFactory:
ModelPlatformType.AIHUBMIX: AihubMixModel,
ModelPlatformType.AVIAN: AvianModel,
ModelPlatformType.FUNCTION_GEMMA: FunctionGemmaModel,
+ ModelPlatformType.XAI: XAIModel,
}
@staticmethod
diff --git a/camel/models/openai_compatible_model.py b/camel/models/openai_compatible_model.py
index 3cddfe1e5..8c1f86f01 100644
--- a/camel/models/openai_compatible_model.py
+++ b/camel/models/openai_compatible_model.py
@@ -12,9 +12,23 @@
# limitations under the License.
# ========= Copyright 2023-2026 @ CAMEL-AI.org. All Rights Reserved. =========
+import copy
+import json
import os
+import warnings
from json import JSONDecodeError
-from typing import Any, Dict, List, Optional, Type, Union
+from typing import (
+ Any,
+ AsyncGenerator,
+ Dict,
+ Generator,
+ List,
+ Literal,
+ Optional,
+ Type,
+ Union,
+ cast,
+)
from openai import AsyncOpenAI, AsyncStream, BadRequestError, OpenAI, Stream
from openai.lib.streaming.chat import (
@@ -35,6 +49,7 @@ from camel.types import (
from camel.utils import (
BaseTokenCounter,
OpenAITokenCounter,
+ get_current_agent_session_id,
is_langfuse_available,
)
@@ -87,6 +102,9 @@ class OpenAICompatibleModel(BaseModelBackend):
OpenAI-compatible client instance. If provided, this client will
be used instead of creating a new one. The client should implement
the AsyncOpenAI client interface. (default: :obj:`None`)
+ api_mode (Literal["chat_completions", "responses"], optional):
+ API mode to use. Supported values:
+ `"chat_completions"` (default) and `"responses"`.
**kwargs (Any): Additional arguments to pass to the
OpenAI client initialization. These can include parameters like
'organization', 'default_headers', 'http_client', etc.
@@ -104,11 +122,22 @@ class OpenAICompatibleModel(BaseModelBackend):
max_retries: int = 3,
client: Optional[Any] = None,
async_client: Optional[Any] = None,
+ api_mode: Literal["chat_completions", "responses"] = (
+ "chat_completions"
+ ),
**kwargs: Any,
) -> None:
api_key = api_key or os.environ.get("OPENAI_COMPATIBILITY_API_KEY")
url = url or os.environ.get("OPENAI_COMPATIBILITY_API_BASE_URL")
timeout = timeout or float(os.environ.get("MODEL_TIMEOUT", 180))
+ if api_mode not in {"chat_completions", "responses"}:
+ raise ValueError(
+ "api_mode must be 'chat_completions' or 'responses', "
+ f"got: {api_mode}"
+ )
+ self._api_mode = api_mode
+ self._responses_previous_response_id_by_session: Dict[str, str] = {}
+ self._responses_last_message_count_by_session: Dict[str, int] = {}
super().__init__(
model_type,
@@ -208,15 +237,34 @@ class OpenAICompatibleModel(BaseModelBackend):
if response_format:
if is_streaming:
- # Use streaming parse for structured output
+ if self._api_mode == "responses":
+ return cast(
+ Stream[ChatCompletionChunk],
+ self._request_responses_stream(
+ messages, response_format, tools
+ ),
+ )
return self._request_stream_parse(
messages, response_format, tools
)
else:
- # Use non-streaming parse for structured output
+ if self._api_mode == "responses":
+ return self._request_responses(
+ messages, response_format, tools
+ )
return self._request_parse(messages, response_format, tools)
else:
- result = self._request_chat_completion(messages, tools)
+ result: Union[ChatCompletion, Stream[ChatCompletionChunk]]
+ if self._api_mode == "responses":
+ if is_streaming:
+ result = cast(
+ Stream[ChatCompletionChunk],
+ self._request_responses_stream(messages, None, tools),
+ )
+ else:
+ result = self._request_responses(messages, None, tools)
+ else:
+ result = self._request_chat_completion(messages, tools)
return result
@@ -260,17 +308,43 @@ class OpenAICompatibleModel(BaseModelBackend):
if response_format:
if is_streaming:
- # Use streaming parse for structured output
+ if self._api_mode == "responses":
+ return cast(
+ AsyncStream[ChatCompletionChunk],
+ await self._arequest_responses_stream(
+ messages, response_format, tools
+ ),
+ )
return await self._arequest_stream_parse(
messages, response_format, tools
)
else:
- # Use non-streaming parse for structured output
+ if self._api_mode == "responses":
+ return await self._arequest_responses(
+ messages, response_format, tools
+ )
return await self._arequest_parse(
messages, response_format, tools
)
else:
- result = await self._arequest_chat_completion(messages, tools)
+ result: Union[
+ ChatCompletion,
+ AsyncStream[ChatCompletionChunk],
+ ]
+ if self._api_mode == "responses":
+ if is_streaming:
+ result = cast(
+ AsyncStream[ChatCompletionChunk],
+ await self._arequest_responses_stream(
+ messages, None, tools
+ ),
+ )
+ else:
+ result = await self._arequest_responses(
+ messages, None, tools
+ )
+ else:
+ result = await self._arequest_chat_completion(messages, tools)
return result
@@ -422,6 +496,431 @@ class OpenAICompatibleModel(BaseModelBackend):
**request_config,
)
+ # ------------------------------------------------------------------
+ # Responses API helpers
+ # ------------------------------------------------------------------
+
+ @staticmethod
+ def _normalize_tools_for_responses_api(
+ tools: List[Dict[str, Any]],
+ ) -> List[Dict[str, Any]]:
+ r"""Convert chat-completions style function tools to Responses style.
+
+ Input:
+ {"type":"function","function":{"name":"foo",...}}
+ Output:
+ {"type":"function","name":"foo",...}
+ """
+ normalized_tools: List[Dict[str, Any]] = []
+ for tool in tools:
+ if (
+ isinstance(tool, dict)
+ and tool.get("type") == "function"
+ and isinstance(tool.get("function"), dict)
+ ):
+ normalized_tools.append(
+ {"type": "function", **tool["function"]}
+ )
+ else:
+ normalized_tools.append(tool)
+ return normalized_tools
+
+ @staticmethod
+ def _enforce_object_additional_properties_false(schema: Any) -> None:
+ r"""Recursively enforce strict object schema for Responses API."""
+ if isinstance(schema, dict):
+ if (
+ schema.get("type") == "object"
+ and "additionalProperties" not in schema
+ ):
+ schema["additionalProperties"] = False
+
+ for value in schema.values():
+ OpenAICompatibleModel._enforce_object_additional_properties_false(
+ value
+ )
+ elif isinstance(schema, list):
+ for item in schema:
+ OpenAICompatibleModel._enforce_object_additional_properties_false(
+ item
+ )
+
+ def _get_response_chain_session_key(self) -> str:
+ return get_current_agent_session_id() or "__default__"
+
+ def _clear_response_chain_state(self, session_key: str) -> None:
+ self._responses_previous_response_id_by_session.pop(session_key, None)
+ self._responses_last_message_count_by_session.pop(session_key, None)
+
+ @staticmethod
+ def _responses_chain_enabled(request_config: Dict[str, Any]) -> bool:
+ return request_config.get("store") is not False
+
+ def _prepare_responses_input_and_chain(
+ self,
+ messages: List[OpenAIMessage],
+ chain_enabled: bool = True,
+ ) -> Dict[str, Any]:
+ session_key = self._get_response_chain_session_key()
+ if chain_enabled:
+ previous_response_id = (
+ self._responses_previous_response_id_by_session.get(
+ session_key
+ )
+ )
+ last_message_count = (
+ self._responses_last_message_count_by_session.get(
+ session_key, 0
+ )
+ )
+ else:
+ self._clear_response_chain_state(session_key)
+ previous_response_id = None
+ last_message_count = 0
+
+ # If memory was reset/truncated, reset chain and send full context.
+ if len(messages) < last_message_count:
+ previous_response_id = None
+ last_message_count = 0
+ self._clear_response_chain_state(session_key)
+
+ if previous_response_id and last_message_count > 0:
+ delta_messages = messages[last_message_count:]
+ # Filter out ALL assistant messages from the delta.
+ # The server already knows every assistant turn via
+ # previous_response_id. Only tool results and user
+ # messages are genuinely new. ChatAgent's streaming
+ # path may also record duplicate assistant messages,
+ # so filtering by role is the safest approach.
+ delta_messages = [
+ m for m in delta_messages if m.get("role") != "assistant"
+ ]
+ input_messages = (
+ delta_messages if delta_messages else [messages[-1]]
+ )
+ else:
+ input_messages = messages
+
+ input_items = self._convert_messages_to_responses_input(input_messages)
+
+ return {
+ "session_key": session_key,
+ "previous_response_id": previous_response_id,
+ "input_messages": input_items,
+ "message_count": len(messages),
+ }
+
+ @staticmethod
+ def _convert_messages_to_responses_input(
+ messages: List[OpenAIMessage],
+ ) -> List[Dict[str, Any]]:
+ r"""Convert chat-completions style messages to Responses input items.
+
+ This specifically rewrites tool-calling history:
+ - assistant message with `tool_calls` -> one or more `function_call`
+ items (+ optional assistant message when content exists)
+ - tool message -> `function_call_output` item
+ """
+ input_items: List[Dict[str, Any]] = []
+ for message in messages:
+ role = message.get("role")
+ content = message.get("content", "")
+
+ if role == "tool":
+ input_items.append(
+ {
+ "type": "function_call_output",
+ "call_id": message.get("tool_call_id", "null"),
+ "output": content
+ if isinstance(content, str)
+ else str(content),
+ }
+ )
+ continue
+
+ if role == "assistant" and message.get("tool_calls"):
+ if content not in (None, "", []):
+ input_items.append(
+ {
+ "role": "assistant",
+ "content": content,
+ }
+ )
+
+ tool_calls = message.get("tool_calls", [])
+ if not isinstance(tool_calls, list):
+ tool_calls = [tool_calls]
+ for tool_call in tool_calls:
+ function_data = (
+ tool_call.get("function", {})
+ if isinstance(tool_call, dict)
+ else {}
+ )
+ if not isinstance(function_data, dict):
+ continue
+ arguments = function_data.get("arguments", "{}")
+ if not isinstance(arguments, str):
+ arguments = json.dumps(arguments, ensure_ascii=False)
+ input_items.append(
+ {
+ "type": "function_call",
+ "call_id": (
+ tool_call.get("id", "null")
+ if isinstance(tool_call, dict)
+ else "null"
+ ),
+ "name": function_data.get("name", ""),
+ "arguments": arguments,
+ }
+ )
+ continue
+
+ input_items.append(
+ {
+ "role": role,
+ "content": content,
+ }
+ )
+
+ return input_items
+
+ def _save_response_chain_state(
+ self,
+ session_key: str,
+ response_id: Optional[str],
+ message_count: int,
+ ) -> None:
+ if response_id:
+ self._responses_previous_response_id_by_session[session_key] = (
+ response_id
+ )
+ self._responses_last_message_count_by_session[session_key] = (
+ message_count
+ )
+
+ def _prepare_responses_request_config(
+ self,
+ tools: Optional[List[Dict[str, Any]]] = None,
+ response_format: Optional[Type[BaseModel]] = None,
+ stream: bool = False,
+ ) -> Dict[str, Any]:
+ request_config = self._prepare_request_config(tools)
+
+ # Translate chat-completions style parameters to responses style.
+ max_tokens = request_config.pop("max_tokens", None)
+ if (
+ max_tokens is not None
+ and "max_output_tokens" not in request_config
+ ):
+ request_config["max_output_tokens"] = max_tokens
+
+ # `n` is unsupported in responses. Keep backward compatibility.
+ if request_config.get("n") not in (None, 1):
+ warnings.warn(
+ "OpenAI Responses API does not support `n`; "
+ "ignoring configured value.",
+ UserWarning,
+ )
+ request_config.pop("n", None)
+
+ request_config.pop("response_format", None)
+ request_config.pop("stream_options", None)
+ request_config["stream"] = stream
+ # previous_response_id chaining requires stored responses.
+ # Only force store=True when not explicitly set by the user.
+ if "store" not in request_config:
+ request_config["store"] = True
+ elif request_config.get("store") is False:
+ warnings.warn(
+ "Setting `store=False` will disable "
+ "`previous_response_id` chaining.",
+ UserWarning,
+ )
+
+ if request_config.get("tools"):
+ request_config["tools"] = self._normalize_tools_for_responses_api(
+ request_config["tools"]
+ )
+
+ if response_format is not None:
+ schema = copy.deepcopy(response_format.model_json_schema())
+ self._enforce_object_additional_properties_false(schema)
+ request_config["text"] = {
+ "format": {
+ "type": "json_schema",
+ "name": response_format.__name__,
+ "schema": schema,
+ }
+ }
+
+ return request_config
+
+ # ------------------------------------------------------------------
+ # Responses API request methods
+ # ------------------------------------------------------------------
+
+ def _request_responses(
+ self,
+ messages: List[OpenAIMessage],
+ response_format: Optional[Type[BaseModel]],
+ tools: Optional[List[Dict[str, Any]]] = None,
+ ) -> ChatCompletion:
+ from camel.models.openai_responses_adapter import (
+ response_to_chat_completion,
+ )
+
+ request_config = self._prepare_responses_request_config(
+ tools=tools, response_format=response_format, stream=False
+ )
+ chain_enabled = self._responses_chain_enabled(request_config)
+ chain_state = self._prepare_responses_input_and_chain(
+ messages, chain_enabled=chain_enabled
+ )
+ if chain_enabled and chain_state["previous_response_id"]:
+ request_config["previous_response_id"] = chain_state[
+ "previous_response_id"
+ ]
+ response = self._client.responses.create(
+ input=chain_state["input_messages"],
+ model=self.model_type,
+ **request_config,
+ )
+ if chain_enabled:
+ self._save_response_chain_state(
+ session_key=chain_state["session_key"],
+ response_id=getattr(response, "id", None)
+ if not isinstance(response, dict)
+ else response.get("id"),
+ message_count=chain_state["message_count"],
+ )
+ return response_to_chat_completion(
+ response=response,
+ model=str(self.model_type),
+ response_format=response_format,
+ )
+
+ async def _arequest_responses(
+ self,
+ messages: List[OpenAIMessage],
+ response_format: Optional[Type[BaseModel]],
+ tools: Optional[List[Dict[str, Any]]] = None,
+ ) -> ChatCompletion:
+ from camel.models.openai_responses_adapter import (
+ response_to_chat_completion,
+ )
+
+ request_config = self._prepare_responses_request_config(
+ tools=tools, response_format=response_format, stream=False
+ )
+ chain_enabled = self._responses_chain_enabled(request_config)
+ chain_state = self._prepare_responses_input_and_chain(
+ messages, chain_enabled=chain_enabled
+ )
+ if chain_enabled and chain_state["previous_response_id"]:
+ request_config["previous_response_id"] = chain_state[
+ "previous_response_id"
+ ]
+ response = await self._async_client.responses.create(
+ input=chain_state["input_messages"],
+ model=self.model_type,
+ **request_config,
+ )
+ if chain_enabled:
+ self._save_response_chain_state(
+ session_key=chain_state["session_key"],
+ response_id=getattr(response, "id", None)
+ if not isinstance(response, dict)
+ else response.get("id"),
+ message_count=chain_state["message_count"],
+ )
+ return response_to_chat_completion(
+ response=response,
+ model=str(self.model_type),
+ response_format=response_format,
+ )
+
+ def _request_responses_stream(
+ self,
+ messages: List[OpenAIMessage],
+ response_format: Optional[Type[BaseModel]],
+ tools: Optional[List[Dict[str, Any]]] = None,
+ ) -> Generator[ChatCompletionChunk, None, None]:
+ from camel.models.openai_responses_adapter import (
+ iter_response_events_to_chat_chunks,
+ )
+
+ request_config = self._prepare_responses_request_config(
+ tools=tools, response_format=response_format, stream=True
+ )
+ chain_enabled = self._responses_chain_enabled(request_config)
+ chain_state = self._prepare_responses_input_and_chain(
+ messages, chain_enabled=chain_enabled
+ )
+ if chain_enabled and chain_state["previous_response_id"]:
+ request_config["previous_response_id"] = chain_state[
+ "previous_response_id"
+ ]
+ event_stream = self._client.responses.create(
+ input=chain_state["input_messages"],
+ model=self.model_type,
+ **request_config,
+ )
+
+ def _on_response_completed(response_id: str) -> None:
+ if chain_enabled:
+ self._save_response_chain_state(
+ session_key=chain_state["session_key"],
+ response_id=response_id,
+ message_count=chain_state["message_count"],
+ )
+
+ return iter_response_events_to_chat_chunks(
+ event_stream=event_stream,
+ model=str(self.model_type),
+ on_response_completed=_on_response_completed,
+ )
+
+ async def _arequest_responses_stream(
+ self,
+ messages: List[OpenAIMessage],
+ response_format: Optional[Type[BaseModel]],
+ tools: Optional[List[Dict[str, Any]]] = None,
+ ) -> AsyncGenerator[ChatCompletionChunk, None]:
+ from camel.models.openai_responses_adapter import (
+ aiter_response_events_to_chat_chunks,
+ )
+
+ request_config = self._prepare_responses_request_config(
+ tools=tools, response_format=response_format, stream=True
+ )
+ chain_enabled = self._responses_chain_enabled(request_config)
+ chain_state = self._prepare_responses_input_and_chain(
+ messages, chain_enabled=chain_enabled
+ )
+ if chain_enabled and chain_state["previous_response_id"]:
+ request_config["previous_response_id"] = chain_state[
+ "previous_response_id"
+ ]
+ event_stream = await self._async_client.responses.create(
+ input=chain_state["input_messages"],
+ model=self.model_type,
+ **request_config,
+ )
+
+ def _on_response_completed(response_id: str) -> None:
+ if chain_enabled:
+ self._save_response_chain_state(
+ session_key=chain_state["session_key"],
+ response_id=response_id,
+ message_count=chain_state["message_count"],
+ )
+
+ return aiter_response_events_to_chat_chunks(
+ event_stream=event_stream,
+ model=str(self.model_type),
+ on_response_completed=_on_response_completed,
+ )
+
@property
def token_counter(self) -> BaseTokenCounter:
r"""Initialize the token counter for the model backend.
diff --git a/camel/models/xai_model.py b/camel/models/xai_model.py
new file mode 100644
index 000000000..2126476a8
--- /dev/null
+++ b/camel/models/xai_model.py
@@ -0,0 +1,1001 @@
+# ========= Copyright 2023-2026 @ CAMEL-AI.org. All Rights Reserved. =========
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ========= Copyright 2023-2026 @ CAMEL-AI.org. All Rights Reserved. =========
+import json
+import os
+import time
+from typing import (
+ TYPE_CHECKING,
+ Any,
+ AsyncGenerator,
+ Dict,
+ Generator,
+ List,
+ Optional,
+ Sequence,
+ Type,
+ Union,
+)
+
+from openai import AsyncStream, Stream
+from pydantic import BaseModel
+
+from camel.configs import XAIConfig
+from camel.logger import get_logger
+from camel.messages import OpenAIMessage
+from camel.models.base_model import BaseModelBackend
+from camel.types import (
+ ChatCompletion,
+ ChatCompletionChunk,
+ ModelType,
+)
+from camel.utils import (
+ BaseTokenCounter,
+ OpenAITokenCounter,
+ api_keys_required,
+)
+
+if TYPE_CHECKING:
+ from xai_sdk import (
+ AsyncClient as XAIAsyncClient, # type: ignore[import-untyped]
+ )
+ from xai_sdk import Client as XAIClient # type: ignore[import-untyped]
+ from xai_sdk.chat import ( # type: ignore[import-untyped]
+ Response as XAIResponse,
+ )
+ from xai_sdk.proto import chat_pb2 # type: ignore[import-untyped]
+
+if os.environ.get("LANGFUSE_ENABLED", "False").lower() == "true":
+ try:
+ from langfuse.decorators import observe
+ except ImportError:
+ from camel.utils import observe
+elif os.environ.get("TRACEROOT_ENABLED", "False").lower() == "true":
+ try:
+ from traceroot import trace as observe # type: ignore[import]
+ except ImportError:
+ from camel.utils import observe
+else:
+ from camel.utils import observe
+
+
+logger = get_logger(__name__)
+
+# Map xAI SDK finish reason enum names to OpenAI-style strings.
+_FINISH_REASON_MAP = {
+ "REASON_STOP": "stop",
+ "REASON_TOOL_CALLS": "tool_calls",
+ "REASON_MAX_LEN": "length",
+ "REASON_MAX_CONTEXT": "length",
+ "REASON_TIME_LIMIT": "length",
+}
+
+
+class XAIModel(BaseModelBackend):
+ r"""xAI native SDK model backend using gRPC.
+
+ This backend uses the ``xai_sdk`` package to communicate with xAI's API
+ via gRPC, providing access to Grok models with native features like
+ encrypted thinking content and server-side conversation storage.
+
+ Args:
+ model_type (Union[ModelType, str]): Model for which a backend is
+ created, one of the Grok series (e.g. ``"grok-3"``).
+ model_config_dict (Optional[Dict[str, Any]], optional): A dictionary
+ of configuration parameters. If :obj:`None`,
+ :obj:`XAIConfig().as_dict()` will be used.
+ (default: :obj:`None`)
+ api_key (Optional[str], optional): The API key for authenticating with
+ the xAI service. Falls back to the ``XAI_API_KEY`` environment
+ variable. (default: :obj:`None`)
+ url (Optional[str], optional): Not used for native SDK (gRPC), kept
+ for interface compatibility. (default: :obj:`None`)
+ 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`)
+ """
+
+ @api_keys_required(
+ [
+ ("api_key", "XAI_API_KEY"),
+ ]
+ )
+ 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,
+ ) -> None:
+ if model_config_dict is None:
+ model_config_dict = XAIConfig().as_dict()
+
+ api_key = api_key or os.environ.get("XAI_API_KEY")
+ timeout = timeout or float(os.environ.get("MODEL_TIMEOUT", 180))
+
+ super().__init__(
+ model_type=model_type,
+ model_config_dict=model_config_dict,
+ api_key=api_key,
+ url=url,
+ token_counter=token_counter,
+ timeout=timeout,
+ max_retries=max_retries,
+ )
+
+ self._client: Optional["XAIClient"] = None
+ self._async_client: Optional["XAIAsyncClient"] = None
+
+ # Store the last encrypted content for multi-turn reasoning
+ self._last_encrypted_content: Optional[str] = None
+ self._last_reasoning_content: Optional[str] = None
+
+ # Conversation chaining state: use previous_response_id to avoid
+ # resending full history on every turn.
+ self._previous_response_id: Optional[str] = None
+ self._last_message_count: int = 0
+
+ @property
+ def client(self) -> "XAIClient":
+ r"""Lazy-initialize the synchronous xAI SDK client."""
+ if self._client is None:
+ from xai_sdk import Client
+
+ self._client = Client(
+ api_key=self._api_key,
+ timeout=self._timeout,
+ )
+ return self._client
+
+ @property
+ def async_client(self) -> "XAIAsyncClient":
+ r"""Lazy-initialize the asynchronous xAI SDK client."""
+ if self._async_client is None:
+ from xai_sdk import AsyncClient
+
+ self._async_client = AsyncClient(
+ api_key=self._api_key,
+ timeout=self._timeout,
+ )
+ return self._async_client
+
+ @property
+ def token_counter(self) -> BaseTokenCounter:
+ r"""Initialize the token counter for the model backend.
+
+ Returns:
+ OpenAITokenCounter: The token counter following the model's
+ tokenization style.
+ """
+ if not self._token_counter:
+ self._token_counter = OpenAITokenCounter(ModelType.GPT_4O_MINI)
+ return self._token_counter
+
+ @property
+ def stream(self) -> bool:
+ r"""Returns whether the model is in stream mode.
+
+ Returns:
+ bool: Whether the model is in stream mode.
+ """
+ return self.model_config_dict.get("stream", False)
+
+ # ------------------------------------------------------------------
+ # Message conversion: OpenAI format -> xAI SDK format
+ # ------------------------------------------------------------------
+
+ def _convert_openai_tool_to_xai(
+ self,
+ tool: Dict[str, Any],
+ ) -> "chat_pb2.Tool":
+ r"""Convert an OpenAI-format tool dict to xAI SDK Tool proto.
+
+ Args:
+ tool: OpenAI-format tool dict with ``type`` and ``function`` keys.
+
+ Returns:
+ chat_pb2.Tool: The xAI SDK tool proto.
+ """
+ from xai_sdk.proto import chat_pb2
+
+ func = tool.get("function", {})
+ parameters = func.get("parameters", {})
+ if isinstance(parameters, dict):
+ parameters = json.dumps(parameters)
+ return chat_pb2.Tool(
+ function=chat_pb2.Function(
+ name=func.get("name", ""),
+ description=func.get("description", ""),
+ parameters=parameters,
+ )
+ )
+
+ def _convert_messages(
+ self,
+ messages: List[OpenAIMessage],
+ ) -> List[Any]:
+ r"""Convert OpenAI-format messages to xAI SDK message objects.
+
+ Handles system, user, assistant (with/without tool calls), and tool
+ result messages. For assistant messages that carry reasoning or
+ encrypted content (stored from a previous response), those fields are
+ injected into the protobuf message so xAI can reconstruct the
+ reasoning chain.
+
+ Args:
+ messages: List of OpenAI-format message dicts.
+
+ Returns:
+ List of ``chat_pb2.Message`` objects ready for ``chat.append()``.
+ """
+ from xai_sdk.chat import (
+ assistant as xai_assistant,
+ )
+ from xai_sdk.chat import (
+ system as xai_system,
+ )
+ from xai_sdk.chat import (
+ text as xai_text,
+ )
+ from xai_sdk.chat import (
+ tool_result as xai_tool_result,
+ )
+ from xai_sdk.chat import (
+ user as xai_user,
+ )
+ from xai_sdk.proto import chat_pb2
+
+ converted: List[chat_pb2.Message] = []
+ for msg in messages:
+ role = msg.get("role", "")
+ content = msg.get("content", "") or ""
+ if isinstance(content, list):
+ # Handle multi-part content - extract text parts
+ text_parts = []
+ for part in content:
+ if isinstance(part, dict) and part.get("type") == "text":
+ text_parts.append(part.get("text", ""))
+ elif isinstance(part, str):
+ text_parts.append(part)
+ content = "\n".join(text_parts)
+
+ if role == "system":
+ converted.append(xai_system(content))
+
+ elif role == "user":
+ converted.append(xai_user(content))
+
+ elif role == "assistant":
+ tool_calls = msg.get("tool_calls")
+ if tool_calls:
+ # Build an assistant message with tool calls via proto
+ xai_tool_calls = []
+ for tc in tool_calls: # type: ignore[attr-defined]
+ func_data = tc.get("function", {})
+ arguments = func_data.get("arguments", "{}")
+ if not isinstance(arguments, str):
+ arguments = json.dumps(
+ arguments, ensure_ascii=False
+ )
+ xai_tool_calls.append(
+ chat_pb2.ToolCall(
+ id=tc.get("id", ""),
+ function=chat_pb2.FunctionCall(
+ name=func_data.get("name", ""),
+ arguments=arguments,
+ ),
+ )
+ )
+ proto_msg = chat_pb2.Message(
+ role=chat_pb2.MessageRole.ROLE_ASSISTANT,
+ content=[xai_text(content)] if content else [],
+ tool_calls=xai_tool_calls,
+ )
+ # Inject reasoning/encrypted content if present
+ reasoning = msg.get("reasoning_content", "")
+ encrypted = msg.get("encrypted_content", "")
+ if reasoning:
+ proto_msg.reasoning_content = reasoning
+ if encrypted:
+ proto_msg.encrypted_content = encrypted
+ converted.append(proto_msg)
+ else:
+ proto_msg = xai_assistant(content)
+ # Inject reasoning/encrypted content if present
+ reasoning = msg.get("reasoning_content", "")
+ encrypted = msg.get("encrypted_content", "")
+ if reasoning:
+ proto_msg.reasoning_content = reasoning
+ if encrypted:
+ proto_msg.encrypted_content = encrypted
+ converted.append(proto_msg)
+
+ elif role == "tool":
+ tool_call_id = msg.get("tool_call_id", "")
+ converted.append(
+ xai_tool_result(content, tool_call_id=tool_call_id)
+ )
+
+ else:
+ raise ValueError(f"Unsupported message role: {role!r}")
+
+ return converted
+
+ # ------------------------------------------------------------------
+ # Response conversion: xAI SDK -> OpenAI ChatCompletion
+ # ------------------------------------------------------------------
+
+ @staticmethod
+ def _map_finish_reason(xai_reason: str) -> str:
+ r"""Map xAI finish reason enum name to OpenAI-style string."""
+ return _FINISH_REASON_MAP.get(xai_reason, "stop")
+
+ def _xai_response_to_chat_completion(
+ self,
+ response: "XAIResponse",
+ ) -> ChatCompletion:
+ r"""Convert an xAI SDK Response to an OpenAI ChatCompletion.
+
+ Preserves reasoning_content and encrypted_content from the response
+ for downstream consumers and for injection into future requests.
+
+ Args:
+ response: The xAI SDK Response object.
+
+ Returns:
+ ChatCompletion: The OpenAI-compatible completion object.
+ """
+ from openai.types.chat.chat_completion import Choice
+ from openai.types.chat.chat_completion_message import (
+ ChatCompletionMessage,
+ )
+ from openai.types.completion_usage import CompletionUsage
+
+ # Build tool_calls list if present
+ tool_calls_list = None
+ if response.tool_calls:
+ from openai.types.chat.chat_completion_message_tool_call import (
+ ChatCompletionMessageToolCall,
+ Function,
+ )
+
+ tool_calls_list = []
+ for tc in response.tool_calls:
+ tool_calls_list.append(
+ ChatCompletionMessageToolCall(
+ id=tc.id,
+ type="function",
+ function=Function(
+ name=tc.function.name,
+ arguments=tc.function.arguments,
+ ),
+ )
+ )
+
+ message = ChatCompletionMessage(
+ role="assistant",
+ content=response.content or None,
+ tool_calls=tool_calls_list, # type: ignore[arg-type]
+ )
+
+ # Attach reasoning_content if available
+ reasoning = response.reasoning_content
+ if reasoning:
+ message.reasoning_content = reasoning # type: ignore[attr-defined]
+
+ # Store encrypted content for future multi-turn requests
+ encrypted = response.encrypted_content
+ if encrypted:
+ self._last_encrypted_content = encrypted
+ if reasoning:
+ self._last_reasoning_content = reasoning
+
+ finish_reason = self._map_finish_reason(response.finish_reason)
+
+ choice = Choice(
+ index=0,
+ message=message,
+ finish_reason=finish_reason, # type: ignore[arg-type]
+ )
+
+ # Build usage
+ usage = None
+ if response.usage:
+ u = response.usage
+ usage = CompletionUsage(
+ prompt_tokens=u.prompt_tokens,
+ completion_tokens=u.completion_tokens,
+ total_tokens=u.total_tokens,
+ )
+ # Attach reasoning tokens if available
+ if u.reasoning_tokens:
+ usage.reasoning_tokens = u.reasoning_tokens # type: ignore[attr-defined]
+
+ return ChatCompletion.construct(
+ id=response.id or "",
+ choices=[choice],
+ created=int(time.time()),
+ model=str(self.model_type),
+ object="chat.completion",
+ usage=usage,
+ )
+
+ # ------------------------------------------------------------------
+ # Streaming conversion: xAI SDK -> ChatCompletionChunk generators
+ # ------------------------------------------------------------------
+
+ @staticmethod
+ def _make_chunk(
+ chunk_id: str,
+ model: str,
+ delta_content: Optional[str] = None,
+ delta_reasoning: Optional[str] = None,
+ delta_tool_calls: Optional[List[Any]] = None,
+ finish_reason: Optional[str] = None,
+ usage: Any = None,
+ ) -> ChatCompletionChunk:
+ r"""Build a ``ChatCompletionChunk`` with proper pydantic objects."""
+ from openai.types.chat.chat_completion_chunk import (
+ Choice as ChunkChoice,
+ )
+ from openai.types.chat.chat_completion_chunk import (
+ ChoiceDelta,
+ )
+
+ delta = ChoiceDelta(
+ role="assistant",
+ content=delta_content,
+ tool_calls=delta_tool_calls,
+ )
+ # Attach reasoning_content as extra attribute if present
+ if delta_reasoning is not None:
+ delta.reasoning_content = delta_reasoning # type: ignore[attr-defined]
+
+ choice = ChunkChoice(
+ index=0,
+ delta=delta,
+ finish_reason=finish_reason, # type: ignore[arg-type]
+ )
+ return ChatCompletionChunk.construct(
+ id=chunk_id,
+ choices=[choice],
+ created=int(time.time()),
+ model=model,
+ object="chat.completion.chunk",
+ usage=usage,
+ )
+
+ def _build_delta_tool_calls(self, tool_calls: Sequence) -> List[Any]:
+ r"""Convert xAI tool calls to ChoiceDeltaToolCall objects."""
+ from openai.types.chat.chat_completion_chunk import (
+ ChoiceDeltaToolCall,
+ ChoiceDeltaToolCallFunction,
+ )
+
+ return [
+ ChoiceDeltaToolCall(
+ index=i,
+ id=tc.id,
+ type="function",
+ function=ChoiceDeltaToolCallFunction(
+ name=tc.function.name,
+ arguments=tc.function.arguments,
+ ),
+ )
+ for i, tc in enumerate(tool_calls)
+ ]
+
+ def _stream_to_chunks(
+ self,
+ stream_iter,
+ total_messages: int = 0,
+ ) -> Generator[ChatCompletionChunk, None, None]:
+ r"""Convert xAI SDK stream iterator to ChatCompletionChunk generator.
+
+ Args:
+ stream_iter: Iterator from ``chat.stream()`` yielding
+ ``(Response, Chunk)`` tuples.
+ total_messages: Total message count for chain state bookkeeping.
+
+ Yields:
+ ChatCompletionChunk: OpenAI-compatible streaming chunks.
+ """
+ chunk_id = ""
+ model = str(self.model_type)
+ tool_calls_emitted = False
+ for response, chunk in stream_iter:
+ chunk_id = chunk_id or (response.id if response.id else "")
+
+ finish_reason = None
+ if response.finish_reason and response.finish_reason not in (
+ "REASON_INVALID",
+ "",
+ ):
+ finish_reason = self._map_finish_reason(response.finish_reason)
+
+ # Emit tool calls only once, from the accumulated response,
+ # when the stream signals completion. xAI gRPC streaming
+ # may repeat the full tool_calls list on every chunk (unlike
+ # OpenAI SSE incremental deltas), so emitting per-chunk
+ # causes ChatAgent to accumulate duplicates.
+ delta_tc = None
+ if (
+ finish_reason
+ and not tool_calls_emitted
+ and response.tool_calls
+ ):
+ delta_tc = self._build_delta_tool_calls(response.tool_calls)
+ tool_calls_emitted = True
+
+ yield self._make_chunk(
+ chunk_id=chunk_id,
+ model=model,
+ delta_content=chunk.content or None,
+ delta_reasoning=chunk.reasoning_content or None,
+ delta_tool_calls=delta_tc,
+ finish_reason=finish_reason,
+ )
+
+ # After stream ends, store state from the accumulated response
+ if response:
+ encrypted = response.encrypted_content
+ reasoning = response.reasoning_content
+ if encrypted:
+ self._last_encrypted_content = encrypted
+ if reasoning:
+ self._last_reasoning_content = reasoning
+ self._save_response_chain(response.id, total_messages)
+
+ if response.usage:
+ u = response.usage
+ from openai.types.completion_usage import CompletionUsage
+
+ # Do NOT include finish_reason here — it was already
+ # sent on the final streaming chunk. A second
+ # finish_reason triggers ChatAgent to re-execute the
+ # same tool calls.
+ yield self._make_chunk(
+ chunk_id=chunk_id,
+ model=model,
+ usage=CompletionUsage(
+ prompt_tokens=u.prompt_tokens,
+ completion_tokens=u.completion_tokens,
+ total_tokens=u.total_tokens,
+ ),
+ )
+
+ async def _astream_to_chunks(
+ self,
+ stream_iter,
+ total_messages: int = 0,
+ ) -> AsyncGenerator[ChatCompletionChunk, None]:
+ r"""Async version of stream-to-chunks conversion.
+
+ Args:
+ stream_iter: Async iterator from ``chat.stream()`` yielding
+ ``(Response, Chunk)`` tuples.
+ total_messages: Total message count for chain state bookkeeping.
+
+ Yields:
+ ChatCompletionChunk: OpenAI-compatible streaming chunks.
+ """
+ chunk_id = ""
+ model = str(self.model_type)
+ response = None
+ tool_calls_emitted = False
+ async for resp, chunk in stream_iter:
+ response = resp
+ chunk_id = chunk_id or (response.id if response.id else "")
+
+ finish_reason = None
+ if response.finish_reason and response.finish_reason not in (
+ "REASON_INVALID",
+ "",
+ ):
+ finish_reason = self._map_finish_reason(response.finish_reason)
+
+ delta_tc = None
+ if (
+ finish_reason
+ and not tool_calls_emitted
+ and response.tool_calls
+ ):
+ delta_tc = self._build_delta_tool_calls(response.tool_calls)
+ tool_calls_emitted = True
+
+ yield self._make_chunk(
+ chunk_id=chunk_id,
+ model=model,
+ delta_content=chunk.content or None,
+ delta_reasoning=chunk.reasoning_content or None,
+ delta_tool_calls=delta_tc,
+ finish_reason=finish_reason,
+ )
+
+ if response is not None:
+ encrypted = response.encrypted_content
+ reasoning = response.reasoning_content
+ if encrypted:
+ self._last_encrypted_content = encrypted
+ if reasoning:
+ self._last_reasoning_content = reasoning
+ self._save_response_chain(response.id, total_messages)
+
+ if response.usage:
+ u = response.usage
+ from openai.types.completion_usage import CompletionUsage
+
+ yield self._make_chunk(
+ chunk_id=chunk_id,
+ model=model,
+ usage=CompletionUsage(
+ prompt_tokens=u.prompt_tokens,
+ completion_tokens=u.completion_tokens,
+ total_tokens=u.total_tokens,
+ ),
+ )
+
+ # ------------------------------------------------------------------
+ # Chat session creation helpers
+ # ------------------------------------------------------------------
+
+ def _build_chat_kwargs(
+ self,
+ tools: Optional[List[Dict[str, Any]]] = None,
+ ) -> Dict[str, Any]:
+ r"""Build keyword arguments for ``client.chat.create()``.
+
+ Translates the CAMEL model config dict into xAI SDK create
+ parameters, and converts OpenAI-format tools to xAI Tool protos.
+
+ Args:
+ tools: Optional list of OpenAI-format tool dicts.
+
+ Returns:
+ Dict of keyword arguments for ``client.chat.create()``.
+ """
+ kwargs: Dict[str, Any] = {
+ "model": str(self.model_type),
+ }
+
+ config = self.model_config_dict
+
+ # Simple passthrough parameters
+ for key in (
+ "temperature",
+ "top_p",
+ "max_tokens",
+ "seed",
+ "frequency_penalty",
+ "presence_penalty",
+ ):
+ val = config.get(key)
+ if val is not None:
+ kwargs[key] = val
+
+ # Stop sequences
+ stop = config.get("stop")
+ if stop is not None:
+ if isinstance(stop, str):
+ stop = [stop]
+ kwargs["stop"] = stop
+
+ # xAI-specific parameters
+ use_encrypted = config.get("use_encrypted_content")
+ if use_encrypted is not None:
+ kwargs["use_encrypted_content"] = use_encrypted
+
+ store = config.get("store_messages")
+ if store is not None:
+ kwargs["store_messages"] = store
+ else:
+ # Default to True to enable conversation chaining
+ kwargs["store_messages"] = True
+
+ # Reasoning effort - xAI SDK accepts string literals "low" / "high"
+ reasoning_effort = config.get("reasoning_effort")
+ if reasoning_effort is not None:
+ kwargs["reasoning_effort"] = reasoning_effort.lower()
+
+ # Response format (structured outputs)
+ response_format = config.get("response_format")
+ if response_format is not None and isinstance(response_format, type):
+ if issubclass(response_format, BaseModel):
+ kwargs["response_format"] = response_format
+
+ # Tool choice - xAI SDK accepts string literals
+ # "auto", "none", "required"
+ tool_choice = config.get("tool_choice")
+ if tool_choice is not None and tools:
+ if isinstance(tool_choice, str):
+ kwargs["tool_choice"] = tool_choice.lower()
+
+ # Convert tools
+ if tools:
+ kwargs["tools"] = [
+ self._convert_openai_tool_to_xai(t) for t in tools
+ ]
+
+ return kwargs
+
+ def _compute_delta_messages(
+ self,
+ messages: List[OpenAIMessage],
+ ) -> List[OpenAIMessage]:
+ r"""Compute the delta messages for conversation chaining.
+
+ If we have a ``previous_response_id`` from the last turn, only the
+ new messages since then need to be sent. If the conversation was
+ truncated (memory reset / context-window management), fall back to
+ sending the full history.
+
+ Args:
+ messages: The full conversation history from ChatAgent.
+
+ Returns:
+ The messages to actually send in this request.
+ """
+ n = len(messages)
+
+ if self._previous_response_id and n >= self._last_message_count:
+ delta = messages[self._last_message_count :]
+ if delta:
+ # Filter out ALL assistant messages from the delta.
+ # The server already knows every assistant turn via
+ # previous_response_id. Only tool results and user
+ # messages are genuinely new. ChatAgent's streaming
+ # path may also record duplicate assistant messages,
+ # so filtering by role is the safest approach.
+ delta = [
+ m for m in delta if m.get("role") != "assistant"
+ ]
+ if delta:
+ return delta
+
+ # Fallback: reset chain, send everything
+ self._previous_response_id = None
+ self._last_message_count = 0
+ return messages
+
+ def _save_response_chain(
+ self, response_id: Optional[str], total_messages: int
+ ) -> None:
+ r"""Persist the chain state after a successful response."""
+ if response_id:
+ self._previous_response_id = response_id
+ self._last_message_count = total_messages
+
+ def _inject_encrypted_content(
+ self,
+ messages: List[OpenAIMessage],
+ ) -> List[OpenAIMessage]:
+ r"""Inject stored encrypted/reasoning content into conversation
+ history for multi-turn reasoning.
+
+ When ``use_encrypted_content`` is enabled, the encrypted thinking
+ traces from the previous response must be included in the assistant
+ message of the conversation history so xAI can reconstruct the
+ reasoning chain.
+
+ Args:
+ messages: The original OpenAI-format messages.
+
+ Returns:
+ Messages with encrypted content injected into the last assistant
+ message.
+ """
+ if (
+ not self._last_encrypted_content
+ and not self._last_reasoning_content
+ ):
+ return messages
+
+ # Find the last assistant message and inject content
+ processed = list(messages)
+ for i in range(len(processed) - 1, -1, -1):
+ msg = processed[i]
+ if msg.get("role") == "assistant":
+ new_msg = dict(msg)
+ if (
+ self._last_encrypted_content
+ and "encrypted_content" not in new_msg
+ ):
+ new_msg["encrypted_content"] = self._last_encrypted_content
+ if (
+ self._last_reasoning_content
+ and "reasoning_content" not in new_msg
+ ):
+ new_msg["reasoning_content"] = self._last_reasoning_content
+ processed[i] = new_msg # type: ignore[call-overload]
+ break
+
+ # Clear after injection
+ self._last_encrypted_content = None
+ self._last_reasoning_content = None
+
+ return processed
+
+ def _prepare_chat(
+ self,
+ messages: List[OpenAIMessage],
+ tools: Optional[List[Dict[str, Any]]] = None,
+ response_format: Optional[Type[BaseModel]] = None,
+ ) -> tuple:
+ r"""Shared setup for ``_run`` and ``_arun``.
+
+ Returns:
+ (chat_kwargs, messages_to_send, total_message_count)
+ """
+ messages = self._inject_encrypted_content(messages)
+ total = len(messages)
+
+ chat_kwargs = self._build_chat_kwargs(tools)
+
+ if response_format:
+ chat_kwargs["response_format"] = response_format
+ elif self.model_config_dict.get("response_format") and isinstance(
+ self.model_config_dict["response_format"], type
+ ):
+ chat_kwargs["response_format"] = self.model_config_dict[
+ "response_format"
+ ]
+
+ # Conversation chaining: send only delta when possible
+ store_enabled = chat_kwargs.get("store_messages", True)
+ if store_enabled:
+ messages_to_send = self._compute_delta_messages(messages)
+ if self._previous_response_id:
+ chat_kwargs["previous_response_id"] = (
+ self._previous_response_id
+ )
+ else:
+ messages_to_send = messages
+
+ return chat_kwargs, messages_to_send, total
+
+ def _handle_response(
+ self,
+ response: "XAIResponse",
+ total_messages: int,
+ ) -> ChatCompletion:
+ r"""Convert response and update chain state."""
+ store_enabled = (
+ self.model_config_dict.get("store_messages", None) is not False
+ )
+ if store_enabled:
+ self._save_response_chain(response.id, total_messages)
+
+ return self._xai_response_to_chat_completion(response)
+
+ # ------------------------------------------------------------------
+ # Core run methods
+ # ------------------------------------------------------------------
+
+ @observe()
+ def _run(
+ self,
+ messages: List[OpenAIMessage],
+ response_format: Optional[Type[BaseModel]] = None,
+ tools: Optional[List[Dict[str, Any]]] = None,
+ ) -> Union[ChatCompletion, Stream[ChatCompletionChunk]]:
+ r"""Runs inference using the xAI native SDK.
+
+ Uses ``previous_response_id`` to chain conversations on xAI's
+ server, sending only new (delta) messages instead of the full
+ history on subsequent turns.
+
+ Args:
+ 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 non-stream mode, or a
+ ``ChatCompletionChunk`` generator in stream mode.
+ """
+ self._log_and_trace()
+
+ chat_kwargs, messages_to_send, total = self._prepare_chat(
+ messages, tools, response_format
+ )
+
+ # Sync request log with the actual payload sent to xAI
+ self._sync_request_log_with_client_kwargs(
+ {
+ "messages": messages_to_send,
+ "model": str(self.model_type),
+ "previous_response_id": chat_kwargs.get(
+ "previous_response_id"
+ ),
+ }
+ )
+
+ chat = self.client.chat.create(**chat_kwargs)
+
+ xai_messages = self._convert_messages(messages_to_send)
+ for msg in xai_messages:
+ chat.append(msg)
+
+ if self.stream:
+ return self._stream_to_chunks(chat.stream(), total) # type: ignore[return-value]
+
+ response = chat.sample()
+ return self._handle_response(response, total)
+
+ @observe()
+ async def _arun(
+ self,
+ messages: List[OpenAIMessage],
+ response_format: Optional[Type[BaseModel]] = None,
+ tools: Optional[List[Dict[str, Any]]] = None,
+ ) -> Union[ChatCompletion, AsyncStream[ChatCompletionChunk]]:
+ r"""Runs async inference using the xAI native SDK.
+
+ Args:
+ 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, AsyncStream[ChatCompletionChunk]]:
+ ``ChatCompletion`` in non-stream mode, or an async
+ ``ChatCompletionChunk`` generator in stream mode.
+ """
+ self._log_and_trace()
+
+ chat_kwargs, messages_to_send, total = self._prepare_chat(
+ messages, tools, response_format
+ )
+
+ # Sync request log with the actual payload sent to xAI
+ self._sync_request_log_with_client_kwargs(
+ {
+ "messages": messages_to_send,
+ "model": str(self.model_type),
+ "previous_response_id": chat_kwargs.get(
+ "previous_response_id"
+ ),
+ }
+ )
+
+ chat = self.async_client.chat.create(**chat_kwargs)
+
+ xai_messages = self._convert_messages(messages_to_send)
+ for msg in xai_messages:
+ chat.append(msg)
+
+ if self.stream:
+ return self._astream_to_chunks( # type: ignore[return-value]
+ await chat.stream(), total
+ )
+
+ response = await chat.sample()
+ return self._handle_response(response, total)
diff --git a/camel/retrievers/hybrid_retrival.py b/camel/retrievers/hybrid_retrival.py
index b3765c81e..d4a525ffe 100644
--- a/camel/retrievers/hybrid_retrival.py
+++ b/camel/retrievers/hybrid_retrival.py
@@ -234,4 +234,4 @@ class HybridRetriever(BaseRetriever):
else [item['text'] for item in all_retrieved_info] # type: ignore[misc]
),
}
- return retrieved_info
+ return retrieved_info # type: ignore[return-value]
diff --git a/camel/types/enums.py b/camel/types/enums.py
index fddee12f1..b919a4259 100644
--- a/camel/types/enums.py
+++ b/camel/types/enums.py
@@ -1938,6 +1938,7 @@ class ModelPlatformType(Enum):
FUNCTION_GEMMA = "function-gemma"
AVIAN = "avian"
ATLASCLOUD = "atlascloud"
+ XAI = "xai"
@classmethod
def from_name(cls, name):
diff --git a/docs/conf.py b/docs/conf.py
index 2992f02a3..066d88a62 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -27,7 +27,7 @@ sys.path.insert(0, os.path.abspath('..'))
project = 'CAMEL'
copyright = '2024, CAMEL-AI.org'
author = 'CAMEL-AI.org'
-release = '0.2.91a0'
+release = '0.2.91a1'
html_favicon = (
'https://raw.githubusercontent.com/camel-ai/camel/master/misc/favicon.png'
diff --git a/examples/models/xai_model_example.py b/examples/models/xai_model_example.py
new file mode 100644
index 000000000..2eb45dcfb
--- /dev/null
+++ b/examples/models/xai_model_example.py
@@ -0,0 +1,57 @@
+# ========= Copyright 2023-2026 @ CAMEL-AI.org. All Rights Reserved. =========
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ========= Copyright 2023-2026 @ CAMEL-AI.org. All Rights Reserved. =========
+
+"""
+xAI Native SDK Model Example
+==============================
+pip install xai-sdk
+export XAI_API_KEY="your_api_key"
+python examples/models/xai_model_example.py
+"""
+
+from camel.agents import ChatAgent
+from camel.configs import XAIConfig
+from camel.models import ModelFactory
+from camel.types import ModelPlatformType
+
+model = ModelFactory.create(
+ model_platform=ModelPlatformType.XAI,
+ model_type="grok-4.20-reasoning",
+ model_config_dict=XAIConfig(use_encrypted_content=True).as_dict(),
+)
+
+agent = ChatAgent(
+ system_message="You are a helpful assistant. Be concise.",
+ model=model,
+)
+
+print("=" * 60)
+print("Turn 1")
+print("=" * 60)
+r1 = agent.step("What is the integral of x^2 * e^x dx?")
+print(r1.msgs[0].content)
+
+print()
+print("=" * 60)
+print("Turn 2")
+print("=" * 60)
+r2 = agent.step("Evaluate that from 0 to 1.")
+print(r2.msgs[0].content)
+
+print()
+print("=" * 60)
+print("Turn 3")
+print("=" * 60)
+r3 = agent.step("Is the result exactly e - 2? Verify.")
+print(r3.msgs[0].content)
diff --git a/pyproject.toml b/pyproject.toml
index 1088052f1..5154ed8b7 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "camel-ai"
-version = "0.2.91a0"
+version = "0.2.91a1"
description = "Communicative Agents for AI Society Study"
authors = [{ name = "CAMEL-AI.org" }]
requires-python = ">=3.10,<3.15"
@@ -201,6 +201,7 @@ model_platforms = [
"fish-audio-sdk>=1.0.0",
"ibm-watsonx-ai>=1.3.11",
"boto3>=1.42.64",
+ "xai_sdk>=1.11.0",
]
huggingface = [
"transformers>=4,<5",
@@ -465,6 +466,7 @@ all = [
"scipy>=1.15.3",
"statsmodels>=0.14.6",
"av<16",
+ "xai_sdk>=1.11.0",
]
earth-science = [
"numpy>=1.2,<=2.2",
@@ -717,6 +719,7 @@ module = [
"markitdown",
"httplib2",
"serpapi.*",
+ "xai_sdk",
]
ignore_missing_imports = true
diff --git a/uv.lock b/uv.lock
index bdd1ddaed..19c4c8d25 100644
--- a/uv.lock
+++ b/uv.lock
@@ -59,21 +59,20 @@ wheels = [
[[package]]
name = "agentops"
-version = "0.3.26"
+version = "0.3.24"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "opentelemetry-api" },
{ name = "opentelemetry-exporter-otlp-proto-http" },
{ name = "opentelemetry-sdk" },
- { name = "packaging" },
{ name = "psutil" },
{ name = "pyyaml" },
{ name = "requests" },
{ name = "termcolor" },
]
-sdist = { url = "https://files.pythonhosted.org/packages/76/a1/b03c6348a77798e750bde4eec03b4af620d71b9e4b64ff7dcf0860025a2d/agentops-0.3.26.tar.gz", hash = "sha256:bc824bf8727332f59bf803cf84440d13e9e398406222ab29f45909ac1e39f815", size = 234235, upload-time = "2025-01-24T23:44:08.541Z" }
+sdist = { url = "https://files.pythonhosted.org/packages/71/fe/e96e22c4bf762f34cd5ba435880470dad4576ab357ee61742fe053752322/agentops-0.3.24.tar.gz", hash = "sha256:c97a3af959b728bcfbfb1ac2494cef82d8804defc9dac858648b39a9ecdcd2e4", size = 233974, upload-time = "2025-01-18T19:08:04.121Z" }
wheels = [
- { url = "https://files.pythonhosted.org/packages/f5/21/671c458951850bd3a445aa09eafd2793aae1104fa68351a5c3976cdf762b/agentops-0.3.26-py3-none-any.whl", hash = "sha256:20948f52e3ffb4ba1d52301c3a82e59490182c4dad22774ad831dce0181eb5c2", size = 72090, upload-time = "2025-01-24T23:44:06.828Z" },
+ { url = "https://files.pythonhosted.org/packages/25/4e/a7d131802bac2ece5302ebf78dcef1ba1ba2f8b3a51fbe44c7f52bae6a53/agentops-0.3.24-py3-none-any.whl", hash = "sha256:c5dfc8098b0dd49ddd819aa55280d07f8bfbf2f8fa088fc51ff5849b65062b10", size = 71957, upload-time = "2025-01-18T19:08:02.053Z" },
]
[[package]]
@@ -761,30 +760,30 @@ wheels = [
[[package]]
name = "boto3"
-version = "1.42.88"
+version = "1.42.89"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "botocore" },
{ name = "jmespath" },
{ name = "s3transfer" },
]
-sdist = { url = "https://files.pythonhosted.org/packages/da/bb/7d4435cca6fccf235dd40c891c731bcb9078e815917b57ebadd1e0ffabaf/boto3-1.42.88.tar.gz", hash = "sha256:2d22c70de5726918676a06f1a03acfb4d5d9ea92fc759354800b67b22aaeef19", size = 113238, upload-time = "2026-04-10T19:41:06.912Z" }
+sdist = { url = "https://files.pythonhosted.org/packages/bb/0c/f7bccb22b245cabf392816baba20f9e95f78ace7dbc580fd40136e80e732/boto3-1.42.89.tar.gz", hash = "sha256:3e43aacc0801bba9bcd23a8c271c089af297a69565f783fcdd357ae0e330bf1e", size = 113165, upload-time = "2026-04-13T19:36:17.516Z" }
wheels = [
- { url = "https://files.pythonhosted.org/packages/0a/2b/8bfddb39a19f5fbc16a869f1a394771e6223f07160dbc0ff6b38e05ea0ae/boto3-1.42.88-py3-none-any.whl", hash = "sha256:2d0f52c971503377e4370d2a83edee6f077ddb8e684366ff38df4f13581d9cfc", size = 140557, upload-time = "2026-04-10T19:41:05.309Z" },
+ { url = "https://files.pythonhosted.org/packages/b9/33/55103ba5ef9975ea54b8d39e69b76eb6e9fded3beae5f01065e26951a3a1/boto3-1.42.89-py3-none-any.whl", hash = "sha256:6204b189f4d0c655535f43d7eaa57ff4e8d965b8463c97e45952291211162932", size = 140556, upload-time = "2026-04-13T19:36:13.894Z" },
]
[[package]]
name = "botocore"
-version = "1.42.88"
+version = "1.42.89"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "jmespath" },
{ name = "python-dateutil" },
{ name = "urllib3" },
]
-sdist = { url = "https://files.pythonhosted.org/packages/93/50/87966238f7aa3f7e5f87081185d5a407a95ede8b551e11bbe134ca3306dc/botocore-1.42.88.tar.gz", hash = "sha256:cbb59ee464662039b0c2c95a520cdf85b1e8ce00b72375ab9cd9f842cc001301", size = 15195331, upload-time = "2026-04-10T19:40:57.012Z" }
+sdist = { url = "https://files.pythonhosted.org/packages/0f/cc/e6be943efa9051bd15c2ee14077c2b10d6e27c9e9385fc43a03a5c4ed8b5/botocore-1.42.89.tar.gz", hash = "sha256:95ac52f472dad29942f3088b278ab493044516c16dbf9133c975af16527baa99", size = 15206290, upload-time = "2026-04-13T19:36:02.321Z" }
wheels = [
- { url = "https://files.pythonhosted.org/packages/2a/46/ad14e41245adb8b0c83663ba13e822b68a0df08999dd250e75b0750fdf6c/botocore-1.42.88-py3-none-any.whl", hash = "sha256:032375b213305b6b81eedb269eaeefdf96f674620799bbf96117dca86052cc1a", size = 14876640, upload-time = "2026-04-10T19:40:53.663Z" },
+ { url = "https://files.pythonhosted.org/packages/91/f1/90a7b8eda38b7c3a65ca7ee0075bdf310b6b471cb1b95fab6e8994323a50/botocore-1.42.89-py3-none-any.whl", hash = "sha256:d9b786c8d9db6473063b4cc5be0ba7e6a381082307bd6afb69d4216f9fa95f35", size = 14887287, upload-time = "2026-04-13T19:35:56.677Z" },
]
[[package]]
@@ -814,7 +813,7 @@ wheels = [
[[package]]
name = "camel-ai"
-version = "0.2.91a0"
+version = "0.2.91a1"
source = { editable = "." }
dependencies = [
{ name = "astor" },
@@ -984,6 +983,7 @@ all = [
{ name = "websockets" },
{ name = "wikipedia" },
{ name = "wolframalpha" },
+ { name = "xai-sdk" },
{ name = "xls2xlsx" },
{ name = "yt-dlp" },
]
@@ -1163,6 +1163,7 @@ model-platforms = [
{ name = "litellm", version = "1.80.11", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.14'" },
{ name = "mistralai" },
{ name = "reka-api" },
+ { name = "xai-sdk" },
]
owl = [
{ name = "aci-sdk" },
@@ -1699,6 +1700,8 @@ requires-dist = [
{ name = "wikipedia", marker = "extra == 'web-tools'", specifier = ">=1,<2" },
{ name = "wolframalpha", marker = "extra == 'all'", specifier = ">=5.0.0,<6" },
{ name = "wolframalpha", marker = "extra == 'web-tools'", specifier = ">=5.0.0,<6" },
+ { name = "xai-sdk", marker = "extra == 'all'", specifier = ">=1.11.0" },
+ { name = "xai-sdk", marker = "extra == 'model-platforms'", specifier = ">=1.11.0" },
{ name = "xls2xlsx", marker = "extra == 'all'", specifier = ">=0.2.0" },
{ name = "xls2xlsx", marker = "extra == 'document-tools'", specifier = ">=0.2.0" },
{ name = "xls2xlsx", marker = "extra == 'eigent'", specifier = ">=0.2.0" },
@@ -1812,41 +1815,45 @@ wheels = [
[[package]]
name = "chardet"
-version = "7.4.2"
-source = { registry = "https://pypi.org/simple" }
-sdist = { url = "https://files.pythonhosted.org/packages/05/1d/0d102acd04cebb03377a3aa79f0c501db68bd0afbc1306e40cb208911319/chardet-7.4.2.tar.gz", hash = "sha256:f2a41ccf8bf8eb1768d741e80d09b902e8d0d8c94974597e07a5d7e6a122a0dc", size = 784024, upload-time = "2026-04-13T01:38:09.911Z" }
-wheels = [
- { url = "https://files.pythonhosted.org/packages/12/24/d3caa08d6ec8f3a344d514aab0d776b8df983e4cf081076da8c41dffd7fb/chardet-7.4.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:8c92d5bbb75ee2405c629764e86a801d34b96b6896044d2e3a255b4ae0e0044f", size = 874137, upload-time = "2026-04-13T01:37:24.587Z" },
- { url = "https://files.pythonhosted.org/packages/41/9c/9938d6c86654b900b929b48d164d896d5f57cf681c5e7d30ee8ba50f1096/chardet-7.4.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:af9369e95adcb07dca9581965ce683cb78fceaf41e8657a8497f2d235f9b2ff4", size = 856824, upload-time = "2026-04-13T01:37:26.04Z" },
- { url = "https://files.pythonhosted.org/packages/4a/91/a8387c63cd8d20bcd76cf85728ba5a929c2791e88a748388545e01044b66/chardet-7.4.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6274e779a717f4a9aab24a23946d05e257a6aee46c950b21d6548cef57cb9aeb", size = 876577, upload-time = "2026-04-13T01:37:27.404Z" },
- { url = "https://files.pythonhosted.org/packages/d2/48/1bdf0976c925063c4932353032e515aabd38b543fb0b004e8f9548098a7a/chardet-7.4.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6eaabaf5f52aa52ac0d8c42df69212e661a3311535455e1f8c6b81236f908837", size = 886468, upload-time = "2026-04-13T01:37:28.838Z" },
- { url = "https://files.pythonhosted.org/packages/71/dc/83af4434153218a7af2c72d4dbcf3024f4a535c38948ae199654a1efef2f/chardet-7.4.2-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:2736431d200d22d4d1c324e926f4cd279d0d6a9ddf8944ca0340bcf1cdd8272e", size = 881011, upload-time = "2026-04-13T01:37:30.391Z" },
- { url = "https://files.pythonhosted.org/packages/b0/c4/d606bd8fe1e873f76cf5327acef1d3a7d76e296d2aba8b38dea164e7d8fc/chardet-7.4.2-cp310-cp310-win_amd64.whl", hash = "sha256:65e4590f7d78b8a2cdde5ae7c876d173e7d387d5804c32865605dbdc3abcc551", size = 942510, upload-time = "2026-04-13T01:37:32.084Z" },
- { url = "https://files.pythonhosted.org/packages/7e/5a/522464b4db2c1506b3dafc5bc79aa8d9945c7205f7279a0b4c848273c583/chardet-7.4.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ac5d06a7ba643a6349b39c9959de5f97ca0790c5c0cff8a7167e69568ebd3b64", size = 870805, upload-time = "2026-04-13T01:37:33.433Z" },
- { url = "https://files.pythonhosted.org/packages/94/96/5f0193da84a805723fa68aa231e3b3467037578320886f2aa3c2114338db/chardet-7.4.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:3099c9e5e8cfe858fbcc5597044f581bef8f118744ebaea037e33d9e90041e39", size = 852985, upload-time = "2026-04-13T01:37:34.687Z" },
- { url = "https://files.pythonhosted.org/packages/5d/d3/f13a04a9d558670c94c775e4ba3f04e7b6068f9f1956738e3a58afce7740/chardet-7.4.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b367ebb9f5a2eb2700b457a9cfb1fa5be3177d2105f25bd4ad634c2b7fee098b", size = 873526, upload-time = "2026-04-13T01:37:35.956Z" },
- { url = "https://files.pythonhosted.org/packages/7a/d1/c81c94e4ad69a18acf8cb062a9020df1fe8ee585069743c1f7bc58bb8000/chardet-7.4.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:db39b500114d9665994f800946eaa3d8c9b5a41bdb59911a0ec6ff4ca45f7b05", size = 883352, upload-time = "2026-04-13T01:37:37.469Z" },
- { url = "https://files.pythonhosted.org/packages/b6/66/97b24adefcc41a8a853723fffafa8718088c247344fe7c0f546a5dce5ae3/chardet-7.4.2-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:cefd74690e3b2bd1ad3ab0defb58081d8804a6f5291a29f8d672e5399924ce94", size = 876576, upload-time = "2026-04-13T01:37:39.043Z" },
- { url = "https://files.pythonhosted.org/packages/40/5d/c04277fd29ffbd82ff1adf62b63c338b010d27ac54f9c750de33b6969805/chardet-7.4.2-cp311-cp311-win_amd64.whl", hash = "sha256:b9f83d0906705725d3dcf1de5d886241f8666c2231f974a867012936c2c465cd", size = 941809, upload-time = "2026-04-13T01:37:40.297Z" },
- { url = "https://files.pythonhosted.org/packages/64/56/053f0ead4c9b16bff717b3d34641a68ace197ab8af1232c33328aa68cb3e/chardet-7.4.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:348ae6b4881b4fc9b2ce60e8e75bc3a8be94ad6f73ca1b27163a93405a122e20", size = 874720, upload-time = "2026-04-13T01:37:42.05Z" },
- { url = "https://files.pythonhosted.org/packages/62/48/32f4b84d62a290f568168b2e4d8989e3fe9da5089487ad3aea032d8b92d0/chardet-7.4.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:c077dd95a1d3bf4cf86d599e0e424bfb41ed1c67ea60b02e4960d78594b01e4d", size = 854682, upload-time = "2026-04-13T01:37:43.404Z" },
- { url = "https://files.pythonhosted.org/packages/01/13/4f9b1e77eb344ae30e32d43e29c51cabbaf62735ff8295d8a3a9228d6b4f/chardet-7.4.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d1d421a7bf9c6f1feda8e9768e6809924a1b27cd42fcae436e8a0b730bcc7843", size = 874984, upload-time = "2026-04-13T01:37:44.612Z" },
- { url = "https://files.pythonhosted.org/packages/35/e6/0c06add96eb9d8649d88d57576c31fa4a96f7c9b805b50968caad494cc56/chardet-7.4.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a05b3edb0371ae918e4fd7affd340d57fa7251946066276193e6d14a70314d1b", size = 888229, upload-time = "2026-04-13T01:37:46.231Z" },
- { url = "https://files.pythonhosted.org/packages/f7/72/5f2c7b548a37369c495710931adbb3111ecaa50e1a304e0578d5c8a1b489/chardet-7.4.2-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:aa3fa4d07321b336344367537fb9d98143fed3361dc8ab0a77a2316024a7472c", size = 879917, upload-time = "2026-04-13T01:37:47.722Z" },
- { url = "https://files.pythonhosted.org/packages/a5/f8/f7dda18efbf7887e5aad6df999900b0487b3fb88418bfa5eda9b171b8953/chardet-7.4.2-cp312-cp312-win_amd64.whl", hash = "sha256:a60688606cb7c684b8067bd6621c50d8c1ecb32da7502de93dc46b8c02d1ccab", size = 943906, upload-time = "2026-04-13T01:37:49.368Z" },
- { url = "https://files.pythonhosted.org/packages/6c/ba/540d17ff88793c39fa53e2ba2e1e63a5d49fcffb45c3daa8d6af094683bd/chardet-7.4.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:45bccf3860b81874317932711bb35edce07d4fcd34eb655bda8d531af77a43d5", size = 873602, upload-time = "2026-04-13T01:37:50.916Z" },
- { url = "https://files.pythonhosted.org/packages/c9/3d/12f55619f50b9be136c08b44873eafa7ccb0a406097fcce1c256878bd792/chardet-7.4.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:c119bda1e78d0f11715972358c648f67ac26e81d2189f5fe90b72ee781f1ca63", size = 853915, upload-time = "2026-04-13T01:37:52.113Z" },
- { url = "https://files.pythonhosted.org/packages/83/f1/fbba65929a25a1db7d1dab4ed1d3400c862fdf7713f57f8d0f56004c58ec/chardet-7.4.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3ee315e62db42b879488d4464e095d3d87bffad2ad14407d09693b2488e2bd90", size = 873943, upload-time = "2026-04-13T01:37:53.85Z" },
- { url = "https://files.pythonhosted.org/packages/af/b7/b227d8c6f64c4e31f3eb12ca8427840e7bf9eb7a100156285e3caef51630/chardet-7.4.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:33fbc50370046bc3fa8a849a0a2a59ab7aed1741d1f045a45298a40e38a4ab44", size = 887325, upload-time = "2026-04-13T01:37:55.211Z" },
- { url = "https://files.pythonhosted.org/packages/27/b4/53e5a1c8baaa0a8b36dd867dec03a01233dc8d5d9d69d523ce4d78dce5e3/chardet-7.4.2-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:61075ea3a5313d2091d5d55c957ee27df45b3c403dc1d5c586ac2314dd14675e", size = 879293, upload-time = "2026-04-13T01:37:56.566Z" },
- { url = "https://files.pythonhosted.org/packages/43/8c/78b387768ee1f7a592867224372635367e1603cf3131c30f25c43257e588/chardet-7.4.2-cp313-cp313-win_amd64.whl", hash = "sha256:e9ab1f46a829c5ac7af437145df5de4e0dacb10951934260406e6947c57b7aed", size = 944070, upload-time = "2026-04-13T01:37:57.949Z" },
- { url = "https://files.pythonhosted.org/packages/60/34/31ba56222a398829cbefd8f6939c5af1ad2ec9ac3bbb6fe1318d40072d31/chardet-7.4.2-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:5c66332e46efc184f5ff2020be446bad2f2da69a8d607e2ec727f587c73df0cc", size = 872770, upload-time = "2026-04-13T01:37:59.365Z" },
- { url = "https://files.pythonhosted.org/packages/34/9c/eb9a9a3e1a12fb0e2852ac950add684477513986a5aa282ef152be4a8172/chardet-7.4.2-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:bfb4559d0eccdccab8759460b65e2d2a386058cd98fa11e27a6967e3503f26f7", size = 853889, upload-time = "2026-04-13T01:38:00.974Z" },
- { url = "https://files.pythonhosted.org/packages/62/3d/17532b848ff3cf81ea997817d84c6bd730aa6709a68631a1f7ca07fd633d/chardet-7.4.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ef78ba612179f5526a168897db45daf5c3aead82e50462388bccf984e946aa7c", size = 875949, upload-time = "2026-04-13T01:38:02.317Z" },
- { url = "https://files.pythonhosted.org/packages/fd/ea/5e9329696e3f6a753524cf0c3dcc15f581c4b147283e9cbee5001f39da8a/chardet-7.4.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9c59b028fd8f6c7c68fc19143c65efb856426c8a06ca82c08950a74fc4ae75a3", size = 887646, upload-time = "2026-04-13T01:38:03.696Z" },
- { url = "https://files.pythonhosted.org/packages/7d/fc/ea1698d45956bbf805378c49507c8c87b57a8847b13c7de280556389c4df/chardet-7.4.2-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:f23ab97d02426db20ecaba972e41fa9e60e2648deb816d648bf6eb0b299bc8b1", size = 879813, upload-time = "2026-04-13T01:38:05.186Z" },
- { url = "https://files.pythonhosted.org/packages/ea/ea/7b6d7eb2d9153ca6301531f74571b5f8e2ada14f0c0ec5895a247579995a/chardet-7.4.2-cp314-cp314-win_amd64.whl", hash = "sha256:8305582e5253026daf14f7e41da3cdddd9e9bb76f56fe11960fb93feb7776a84", size = 939517, upload-time = "2026-04-13T01:38:06.919Z" },
- { url = "https://files.pythonhosted.org/packages/8c/81/7a0cb90b97de02038ef4882776fd643998fe9e78ba7d720c3b04bdaa0eaf/chardet-7.4.2-py3-none-any.whl", hash = "sha256:5ca09c5122c111df7edfbe6cd33b1dd96a30fd2874c812f8593ba446eaf9a1a3", size = 626555, upload-time = "2026-04-13T01:38:08.544Z" },
+version = "7.4.3"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/19/b6/9df434a8eeba2e6628c465a1dfa31034228ef79b26f76f46278f4ef7e49d/chardet-7.4.3.tar.gz", hash = "sha256:cc1d4eb92a4ec1c2df3b490836ffa46922e599d34ce0bb75cf41fd2bf6303d56", size = 784800, upload-time = "2026-04-13T21:33:39.803Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/6b/1b/7f73766c119a1344eb69e31890ede7c5825ce03d69a9d29292d1bd1cfa1b/chardet-7.4.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c0c79b13c9908ac7dfe0a74116ebc9a0f28b2319d23c32f3dfcdfbe1279c7eaf", size = 874121, upload-time = "2026-04-13T21:32:47.065Z" },
+ { url = "https://files.pythonhosted.org/packages/8b/02/b677c8203d34dad6c2af48287bb1f8c5dff63db2094636fbe634b555b7fb/chardet-7.4.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:bba8bea1b28d927b3e99e47deafe53658d34497c0a891d95ff1ba8ff6663f01c", size = 856900, upload-time = "2026-04-13T21:32:48.893Z" },
+ { url = "https://files.pythonhosted.org/packages/c4/4b/1361a485a999d97cac4c895e615326f69a639532a52ef365a468bd09bad1/chardet-7.4.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:23163921dccf3103ce59540b0443c106d2c0a0ff2e0503e05196f5e6fdea453f", size = 876634, upload-time = "2026-04-13T21:32:50.238Z" },
+ { url = "https://files.pythonhosted.org/packages/87/23/e31c8ad33aa448f0845fd58af5fc22da1626407616d09df4973b2b34f477/chardet-7.4.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:cfb54563fe5f130da17c44c6a4e2e8052ba628e5ab4eab7ef8190f736f0f8f72", size = 886497, upload-time = "2026-04-13T21:32:52.111Z" },
+ { url = "https://files.pythonhosted.org/packages/18/ef/ea4edec8c87f7e6eda02673acc68fe48725e564fc5a1865782efb53d5598/chardet-7.4.3-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:3990fffcc6a6045f2234ab72752ad037e3b2d48c72037f244d42738db397eb75", size = 881061, upload-time = "2026-04-13T21:32:53.755Z" },
+ { url = "https://files.pythonhosted.org/packages/f2/11/fc10600da98541777d720ad9e6bc040c0e0af1adb92e27142e35158957cb/chardet-7.4.3-cp310-cp310-win_amd64.whl", hash = "sha256:c7116b0452994734ccff35e154b44240090eb0f4f74b9106292668133557c175", size = 942533, upload-time = "2026-04-13T21:32:55.134Z" },
+ { url = "https://files.pythonhosted.org/packages/19/52/505c207f334d51e937cbaa27ff95776e16e2d120e13cbe491cd7b3a70b50/chardet-7.4.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:25a862cddc6a9ac07023e808aedd297115345fbaabc2690479481ddc0f980e09", size = 870747, upload-time = "2026-04-13T21:32:56.916Z" },
+ { url = "https://files.pythonhosted.org/packages/14/4b/d3c79495dee4831b8bebca2790e72cb90f0c5849c940570a7c7e5b70b952/chardet-7.4.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:7005c88da26fd95d8abb8acbe6281d833e9a9181b03cf49b4546c4555389bd97", size = 853210, upload-time = "2026-04-13T21:32:58.309Z" },
+ { url = "https://files.pythonhosted.org/packages/b9/99/f6a822ad1bde25a4c38dc3e770485e78e0893dfd871cd6e18ed3ea3a795e/chardet-7.4.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:dc50f28bad067393cce0af9091052c3b8df7a23115afd8ba7b2e0947f0cef1f8", size = 873625, upload-time = "2026-04-13T21:32:59.606Z" },
+ { url = "https://files.pythonhosted.org/packages/b1/10/31932775c94a86814f76b41c4a772b52abfb0e6125324f32c6da1196c297/chardet-7.4.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4c3da294de1a681097848ab58bd3f2771a674f8039d2d87a5538b28856b815e9", size = 883436, upload-time = "2026-04-13T21:33:01.351Z" },
+ { url = "https://files.pythonhosted.org/packages/6c/63/0f43e3acf2c436fdb32a0f904aeb03a2904d2126eed34a042a194d235926/chardet-7.4.3-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:93c45e116dd51b66226a53ade3f9f635e870de5399b90e00ce45dcc311093bf4", size = 876589, upload-time = "2026-04-13T21:33:02.636Z" },
+ { url = "https://files.pythonhosted.org/packages/5d/a6/e9b8f8a3e99602792b01fa7d0a731737615ab56d8bfd0b52935a0ef88b85/chardet-7.4.3-cp311-cp311-win_amd64.whl", hash = "sha256:ccc1f83ab4bcfb901cf39e0c4ba6bc6e726fc6264735f10e24ceb5cb47387578", size = 941866, upload-time = "2026-04-13T21:33:04.282Z" },
+ { url = "https://files.pythonhosted.org/packages/61/33/29de185079e6675c3f375546e30a559b7ddc75ce972f18d6e566cd9ea4eb/chardet-7.4.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:75d3c65cc16bddf40b8da1fd25ba84fca5f8070f2b14e86083653c1c85aee971", size = 874870, upload-time = "2026-04-13T21:33:05.977Z" },
+ { url = "https://files.pythonhosted.org/packages/9c/2f/4c5af01fd1a7506a1d5375403d68925eac70289229492db5aa68b58103d8/chardet-7.4.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:29af5999f654e8729d251f1724a62b538b1262d9292cccaefddf8a02aae1ef6a", size = 854859, upload-time = "2026-04-13T21:33:07.381Z" },
+ { url = "https://files.pythonhosted.org/packages/36/21/edb36ad5dfa48d7f8eed97ab43931ecdaa8c15166c21b1d614967e49d681/chardet-7.4.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:626f00299ad62dfe937058a09572beed442ccc7b58f87aa667949b20fd3db235", size = 875032, upload-time = "2026-04-13T21:33:08.741Z" },
+ { url = "https://files.pythonhosted.org/packages/e5/59/a32a241d861cf180853a11c8e5a67641cb1b2af13c3a5ccce83ec07e2c9f/chardet-7.4.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9a4904dd5f071b7a7d7f50b4a67a86db3c902d243bf31708f1d5cde2f68239cb", size = 888283, upload-time = "2026-04-13T21:33:10.213Z" },
+ { url = "https://files.pythonhosted.org/packages/87/2e/e1ee6a77abf3782c00e05b89c4d4328c8353bf9500661c4348df1dd68614/chardet-7.4.3-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:5d2879598bc220689e8ce509fe9c3f37ad2fca53a36be9c9bd91abdd91dd364f", size = 879974, upload-time = "2026-04-13T21:33:11.448Z" },
+ { url = "https://files.pythonhosted.org/packages/32/60/fca69c534602a7ced04280c952a246ad1edde2a6ca3a164f65d32ac41fe7/chardet-7.4.3-cp312-cp312-win_amd64.whl", hash = "sha256:4b2799bd58e7245cfa8d4ab2e8ad1d76a5c3a5b1f32318eb6acca4c69a3e7101", size = 943973, upload-time = "2026-04-13T21:33:12.756Z" },
+ { url = "https://files.pythonhosted.org/packages/7c/43/79ac9b4db5bc87020c9dbc419125371d80882d1d197e9c4765ba8682b605/chardet-7.4.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:a9e4486df251b8962e86ea9f139ca235aa6e0542a00f7844c9a04160afb99aa9", size = 873769, upload-time = "2026-04-13T21:33:14.002Z" },
+ { url = "https://files.pythonhosted.org/packages/55/5f/25bdec773905bff0ff6cf35ca73b17bd05593b4f87bd8c5fa43705f7167d/chardet-7.4.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:4fbff1907925b0c5a1064cffb5e040cd5e338585c9c552625f30de6bc2f3107a", size = 853991, upload-time = "2026-04-13T21:33:15.564Z" },
+ { url = "https://files.pythonhosted.org/packages/b4/07/a29380ee0b215d23d77733b5ad60c5c0c7969650e080c667acdf9462040d/chardet-7.4.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:365135eaf37ba65a828f8e668eb0a8c38c479dcbec724dc25f4dfd781049c357", size = 874024, upload-time = "2026-04-13T21:33:16.915Z" },
+ { url = "https://files.pythonhosted.org/packages/a8/b1/3338e121cbd4c8a126b8ccb1061170c2ce51a53f678c502793ea49c6fd6d/chardet-7.4.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bfc134b70c846c21ead8e43ada3ae1a805fff732f6922f8abcf2ff27b8f6493d", size = 887410, upload-time = "2026-04-13T21:33:18.368Z" },
+ { url = "https://files.pythonhosted.org/packages/63/1c/44a9a9e0c59c185a5d307ceaeee8768afa1558f0a24f7a4b5fa11b67586b/chardet-7.4.3-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:9acd9988a93e09390f3cd231201ea7166c415eb8da1b735928990ffc05cb9fbb", size = 879269, upload-time = "2026-04-13T21:33:20.377Z" },
+ { url = "https://files.pythonhosted.org/packages/1b/b3/5d0e77ea774bd3224321c248880ea0c0379000ac5c2bb6d77609549de247/chardet-7.4.3-cp313-cp313-win_amd64.whl", hash = "sha256:e1b98790c284ff813f18f7cf7de5f05ea2435a080030c7f1a8318f3a4f80b131", size = 944155, upload-time = "2026-04-13T21:33:21.694Z" },
+ { url = "https://files.pythonhosted.org/packages/70/a8/bf0811d859e13801279a2ae64f37a408027b282f2047bc0001c75dd356ad/chardet-7.4.3-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:d892d3dcd652fdef53e3d6327d39b17c0df40a899dfc919abaeb64c974497531", size = 872887, upload-time = "2026-04-13T21:33:23.328Z" },
+ { url = "https://files.pythonhosted.org/packages/51/ac/b9d68ebddfe1b02c77af5bf81120e12b036b4432dc6af7a303d90e2bc38b/chardet-7.4.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:acc46d1b8b7d5783216afe15db56d1c179b9a40e5a1558bc13164c4fd20674c4", size = 853964, upload-time = "2026-04-13T21:33:24.724Z" },
+ { url = "https://files.pythonhosted.org/packages/2a/81/17fa103ea9caf5d325a5e4051ab2ba65996fd66baa60b81ee41af1f54e10/chardet-7.4.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0ac3bf11c645734a1701a3804e43eabd98851838192267d08c353a834ab79fea", size = 876006, upload-time = "2026-04-13T21:33:26.098Z" },
+ { url = "https://files.pythonhosted.org/packages/c2/20/193faab46a68ea550587331a698c3dca8099f8901d10937c4443135c7ed9/chardet-7.4.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6e3bd9f936e04bae89c254262af08d9e5b98f805175ba1e29d454e6cba3107b7", size = 887680, upload-time = "2026-04-13T21:33:27.49Z" },
+ { url = "https://files.pythonhosted.org/packages/40/c6/94a3c673327392652ee8bdea9a45bc8a5f5365197a7387d68f0eed007115/chardet-7.4.3-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:27cc23da03630cdecc9aa81a895aa86629c211f995cd57651f0fbc280717bf93", size = 879865, upload-time = "2026-04-13T21:33:29.052Z" },
+ { url = "https://files.pythonhosted.org/packages/b1/2c/cad8b5e3623a987f3c930b68e2bdd06cfc388cd91cd42ed05f1227701b73/chardet-7.4.3-cp314-cp314-win_amd64.whl", hash = "sha256:b95c934b9ad59e2ba8abb9be49df70d3ad1b0d95d864b9fdb7588d4fa8bd921c", size = 939594, upload-time = "2026-04-13T21:33:31.391Z" },
+ { url = "https://files.pythonhosted.org/packages/33/e0/d06e42fd6f02a58e5e227e5106587751cb38adcff0aaf949add744b78b6e/chardet-7.4.3-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:c77867f0c1cb8bd819502249fcdc500364aedb07881e11b743726fa2148e7b6e", size = 889714, upload-time = "2026-04-13T21:33:32.772Z" },
+ { url = "https://files.pythonhosted.org/packages/d4/ed/40d091954d48abea037baae6be8fb79905e5f78d34d12ea955132c7d8011/chardet-7.4.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:cf1efeaf65a6ef2f5b9cc3a1df6f08ba2831b369ccaa4c7018eaf90aa757bb11", size = 872319, upload-time = "2026-04-13T21:33:34.427Z" },
+ { url = "https://files.pythonhosted.org/packages/bb/77/82a46821dbfbdfe062710d2bf2ede13426304e3567a23c57d919c0c31630/chardet-7.4.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9f3504c139a2ad544077dd2d9e412cd08b01786843d76997cd43bb6de311723c", size = 892021, upload-time = "2026-04-13T21:33:35.766Z" },
+ { url = "https://files.pythonhosted.org/packages/49/57/42d30c562bda5b4a839766c1aad8d5856b798ad2a1c3247b72a679afec94/chardet-7.4.3-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:457f619882ba66327d4d8d14c6c342269bdb1e4e1c38e8117df941d14d351b04", size = 902509, upload-time = "2026-04-13T21:33:37.096Z" },
+ { url = "https://files.pythonhosted.org/packages/8c/6c/0a40afdb50a0fe041ab95553b835a8160b6cf0e81edf2ae2fe9f5224cbf9/chardet-7.4.3-py3-none-any.whl", hash = "sha256:1173b74051570cf08099d7429d92e4882d375ad4217f92a6e5240ccfb26f231e", size = 626562, upload-time = "2026-04-13T21:33:38.559Z" },
]
[[package]]
@@ -2706,16 +2713,16 @@ wheels = [
[[package]]
name = "ddgs"
-version = "9.13.0"
+version = "9.13.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "click" },
{ name = "lxml" },
{ name = "primp" },
]
-sdist = { url = "https://files.pythonhosted.org/packages/b0/23/d792684ee325a5965ed9af3fde30af456ca6367529bf137d7582735b3708/ddgs-9.13.0.tar.gz", hash = "sha256:b0b9db0895917d4c6dda54b730cdb1a27501ae4350e8b48182b9c3e87b9dbd84", size = 37311, upload-time = "2026-04-06T15:00:38.075Z" }
+sdist = { url = "https://files.pythonhosted.org/packages/11/04/2a40c5253e6772d9a4bf4a3036976d411fc3c3592fdcf0ce555733e08ddc/ddgs-9.13.1.tar.gz", hash = "sha256:b7149326396f9006e6ad5c565ea60cfd643deb4a936f5d2ca6db8f6b29fe26fa", size = 37300, upload-time = "2026-04-14T10:40:03.424Z" }
wheels = [
- { url = "https://files.pythonhosted.org/packages/ff/8d/ea7dba889bc5520f7a40ef191a48b62e59a265f0fdb5973046513f9e94f4/ddgs-9.13.0-py3-none-any.whl", hash = "sha256:3182c2853e7b0cfc030f50cbebee382fa44d6dd258fa55e5d24789ae1e4c6a93", size = 46437, upload-time = "2026-04-06T15:00:36.901Z" },
+ { url = "https://files.pythonhosted.org/packages/c1/c7/090c37ec80916da9abc0d88335a5df7efce4755287ddd54bcf3c02b113dd/ddgs-9.13.1-py3-none-any.whl", hash = "sha256:32282cb8ec8f70ef9e4d24ff5c9886c60b17a3b00ef927c75cb76275289a9802", size = 46427, upload-time = "2026-04-14T10:40:02.458Z" },
]
[[package]]
@@ -3760,7 +3767,7 @@ wheels = [
[[package]]
name = "google-genai"
-version = "1.72.0"
+version = "1.73.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "anyio" },
@@ -3774,9 +3781,9 @@ dependencies = [
{ name = "typing-extensions" },
{ name = "websockets" },
]
-sdist = { url = "https://files.pythonhosted.org/packages/3c/20/2aff5ea3cd7459f85101d119c136d9ca4369fcda3dcf0cfee89b305611a4/google_genai-1.72.0.tar.gz", hash = "sha256:abe7d3aecfafb464b904e3a09c81b626fb425e160e123e71a5125a7021cea7b2", size = 522844, upload-time = "2026-04-09T21:35:46.283Z" }
+sdist = { url = "https://files.pythonhosted.org/packages/99/5f/b293b1a78a547b0dd061642a3f6087f0a52c1b723eafa58f94ccdc3e0d2a/google_genai-1.73.0.tar.gz", hash = "sha256:569395b2c225e12bcd8758b8affe1af480e0a1b1c71d652d38c705677057e05f", size = 530812, upload-time = "2026-04-13T20:40:02.642Z" }
wheels = [
- { url = "https://files.pythonhosted.org/packages/9f/3d/9f70246114cdf56a2615a40428ced08bc844f5a26247fe812b2f0dd4eaca/google_genai-1.72.0-py3-none-any.whl", hash = "sha256:ea861e4c6946e3185c24b40d95503e088fc230a73a71fec0ef78164b369a8489", size = 764230, upload-time = "2026-04-09T21:35:44.587Z" },
+ { url = "https://files.pythonhosted.org/packages/5a/73/fb36ced456688c9b95a8ab49a1f408f5b3e69a589788f3eb25016002dd7a/google_genai-1.73.0-py3-none-any.whl", hash = "sha256:dfb0214b834bf977e3841de512cfb651d2fe76309f85064b80c2bc11da99d76b", size = 786072, upload-time = "2026-04-13T20:40:00.365Z" },
]
[[package]]
@@ -7255,11 +7262,11 @@ wheels = [
[[package]]
name = "packaging"
-version = "24.2"
+version = "25.0"
source = { registry = "https://pypi.org/simple" }
-sdist = { url = "https://files.pythonhosted.org/packages/d0/63/68dbb6eb2de9cb10ee4c9c14a0148804425e13c4fb20d61cce69f53106da/packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f", size = 163950, upload-time = "2024-11-08T09:47:47.202Z" }
+sdist = { url = "https://files.pythonhosted.org/packages/a1/d4/1fc4078c65507b51b96ca8f8c3ba19e6a61c8253c72794544580a7b6c24d/packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f", size = 165727, upload-time = "2025-04-19T11:48:59.673Z" }
wheels = [
- { url = "https://files.pythonhosted.org/packages/88/ef/eb23f262cca3c0c4eb7ab1933c3b1f03d021f2c48f54763065b6f0e321be/packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759", size = 65451, upload-time = "2024-11-08T09:47:44.722Z" },
+ { url = "https://files.pythonhosted.org/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484", size = 66469, upload-time = "2025-04-19T11:48:57.875Z" },
]
[[package]]
@@ -7635,7 +7642,7 @@ wheels = [
[[package]]
name = "posthog"
-version = "7.11.0"
+version = "7.11.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "backoff" },
@@ -7645,9 +7652,9 @@ dependencies = [
{ name = "six" },
{ name = "typing-extensions" },
]
-sdist = { url = "https://files.pythonhosted.org/packages/57/29/8fed5bc33a79d2f71446a5b688cdb1d186e360b00d4656ac10fddbdc37f5/posthog-7.11.0.tar.gz", hash = "sha256:9c15d998aaa94d40d2291078616c16a5919c30f0ddab9c82a98d77da4cc415ee", size = 189175, upload-time = "2026-04-10T15:17:23.056Z" }
+sdist = { url = "https://files.pythonhosted.org/packages/66/79/ce0f5af1679bcfd3b5d70072f5824759e2076b0da2b941b94bcfd9850abb/posthog-7.11.1.tar.gz", hash = "sha256:b3a5cb3b2488e6d30a79d9f79f076632a075f8d390bd35c8158a4e4b42caeeb1", size = 189196, upload-time = "2026-04-14T11:04:44.328Z" }
wheels = [
- { url = "https://files.pythonhosted.org/packages/9d/36/e746e253c6f39866bb22b1c749f85f96079c84fb698440f130a043c8105d/posthog-7.11.0-py3-none-any.whl", hash = "sha256:be51ab01d5e7a28864bbd67bc9d7545c79625195ac56be724d287d8ea2cd2efa", size = 219909, upload-time = "2026-04-10T15:17:21.13Z" },
+ { url = "https://files.pythonhosted.org/packages/12/cc/ddec4c8bfa52d966c4f8447422758c1a4f03c3a6e7f0ddccca0dadc107b8/posthog-7.11.1-py3-none-any.whl", hash = "sha256:aa92568b3ebfc2c97733452cf1cb5ef6acfeeb48efcf5e934f1b595d12034bcc", size = 219958, upload-time = "2026-04-14T11:04:42.445Z" },
]
[[package]]
@@ -8386,7 +8393,7 @@ sdist = { url = "https://files.pythonhosted.org/packages/e1/70/c7a4f46dbf06048c6
[[package]]
name = "pygithub"
-version = "2.9.0"
+version = "2.9.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "pyjwt", extra = ["crypto"] },
@@ -8395,9 +8402,9 @@ dependencies = [
{ name = "typing-extensions" },
{ name = "urllib3" },
]
-sdist = { url = "https://files.pythonhosted.org/packages/a6/9a/44f918e9be12e49cb8b053f09d5d0733b74df52bf4dabc570da1c3ecd9f6/pygithub-2.9.0.tar.gz", hash = "sha256:a26abda1222febba31238682634cad11d8b966137ed6cc3c5e445b29a11cb0a4", size = 2592289, upload-time = "2026-03-22T21:14:39.053Z" }
+sdist = { url = "https://files.pythonhosted.org/packages/ab/c3/8465a311197e16cf5ab68789fe689535e90f6b61ab524cc32a39e67237ae/pygithub-2.9.1.tar.gz", hash = "sha256:59771d7ff63d54d427be2e7d0dad2208dfffc2b0a045fec959263787739b611c", size = 2594989, upload-time = "2026-04-14T07:26:13.622Z" }
wheels = [
- { url = "https://files.pythonhosted.org/packages/2f/de/72e02bc7674e161b155a4b5a03b2347129d0626115bc97ba5bad5070cac9/pygithub-2.9.0-py3-none-any.whl", hash = "sha256:5e2b260ce327bffce9b00f447b65953ef7078ffe93e5a5425624a3075483927c", size = 449653, upload-time = "2026-03-22T21:14:37.726Z" },
+ { url = "https://files.pythonhosted.org/packages/77/aa/81a5506f089a26338bff17535e4339b3b22049ebd1bcdeff756c4d7a7559/pygithub-2.9.1-py3-none-any.whl", hash = "sha256:2ec78fca30092d51a42d76f4ddb02131b6f0c666a35dfdf364cf302cdda115b9", size = 449710, upload-time = "2026-04-14T07:26:12.382Z" },
]
[[package]]
@@ -8631,14 +8638,14 @@ wheels = [
[[package]]
name = "pypdf"
-version = "6.10.0"
+version = "6.10.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "typing-extensions", marker = "python_full_version < '3.11'" },
]
-sdist = { url = "https://files.pythonhosted.org/packages/b8/9f/ca96abf18683ca12602065e4ed2bec9050b672c87d317f1079abc7b6d993/pypdf-6.10.0.tar.gz", hash = "sha256:4c5a48ba258c37024ec2505f7e8fd858525f5502784a2e1c8d415604af29f6ef", size = 5314833, upload-time = "2026-04-10T09:34:57.102Z" }
+sdist = { url = "https://files.pythonhosted.org/packages/66/79/f2730c42ec7891a75a2fcea2eb4f356872bcbc671b711418060424796612/pypdf-6.10.1.tar.gz", hash = "sha256:62e6ca7f65aaa28b3d192addb44f97296e4be1748f57ed0f4efb2d4915841880", size = 5315704, upload-time = "2026-04-14T12:55:20.996Z" }
wheels = [
- { url = "https://files.pythonhosted.org/packages/55/f2/7ebe366f633f30a6ad105f650f44f24f98cb1335c4157d21ae47138b3482/pypdf-6.10.0-py3-none-any.whl", hash = "sha256:90005e959e1596c6e6c84c8b0ad383285b3e17011751cedd17f2ce8fcdfc86de", size = 334459, upload-time = "2026-04-10T09:34:54.966Z" },
+ { url = "https://files.pythonhosted.org/packages/f0/04/e3aa7f1f14dbc53429cae34666261eb935d99bd61d24756ab94d7e0309da/pypdf-6.10.1-py3-none-any.whl", hash = "sha256:6331940d3bfe75b7e6601d35db7adabab5fc1d716efaeb384e3c0c3957d033de", size = 335606, upload-time = "2026-04-14T12:55:18.941Z" },
]
[[package]]
@@ -11711,7 +11718,7 @@ wheels = [
[[package]]
name = "virtualenv"
-version = "21.2.1"
+version = "21.2.3"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "distlib" },
@@ -11720,9 +11727,9 @@ dependencies = [
{ name = "python-discovery" },
{ name = "typing-extensions", marker = "python_full_version < '3.11'" },
]
-sdist = { url = "https://files.pythonhosted.org/packages/97/c5/aff062c66b42e2183201a7ace10c6b2e959a9a16525c8e8ca8e59410d27a/virtualenv-21.2.1.tar.gz", hash = "sha256:b66ffe81301766c0d5e2208fc3576652c59d44e7b731fc5f5ed701c9b537fa78", size = 5844770, upload-time = "2026-04-09T18:47:11.482Z" }
+sdist = { url = "https://files.pythonhosted.org/packages/60/8c/bdd9f89f89e4a787ac61bb2da4d884bc45e0c287ec694dfa3170dddd5cfe/virtualenv-21.2.3.tar.gz", hash = "sha256:9bb6d1414ab55ca624371e30c7719c32f183ef44da544ef8aa44a456de7ac191", size = 5844776, upload-time = "2026-04-14T01:10:36.692Z" }
wheels = [
- { url = "https://files.pythonhosted.org/packages/20/0e/f083a76cb590e60dff3868779558eefefb8dfb7c9ed020babc7aa014ccbf/virtualenv-21.2.1-py3-none-any.whl", hash = "sha256:bd16b49c53562b28cf1a3ad2f36edb805ad71301dee70ddc449e5c88a9f919a2", size = 5828326, upload-time = "2026-04-09T18:47:09.331Z" },
+ { url = "https://files.pythonhosted.org/packages/95/19/bc7c4e05f42532863cf2ae7e7e847beab25835934e0410160b47eeff1e35/virtualenv-21.2.3-py3-none-any.whl", hash = "sha256:486652347ea8526d91e9807c0274583cb7ba31dd4942ff10fb5621402f0fe0d8", size = 5828329, upload-time = "2026-04-14T01:10:34.809Z" },
]
[[package]]
@@ -12060,6 +12067,25 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/a4/f5/10b68b7b1544245097b2a1b8238f66f2fc6dcaeb24ba5d917f52bd2eed4f/wsproto-1.3.2-py3-none-any.whl", hash = "sha256:61eea322cdf56e8cc904bd3ad7573359a242ba65688716b0710a5eb12beab584", size = 24405, upload-time = "2025-11-20T18:18:00.454Z" },
]
+[[package]]
+name = "xai-sdk"
+version = "1.11.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "aiohttp" },
+ { name = "googleapis-common-protos" },
+ { name = "grpcio" },
+ { name = "opentelemetry-sdk" },
+ { name = "packaging" },
+ { name = "protobuf" },
+ { name = "pydantic" },
+ { name = "requests" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/49/32/bb8385f7a3b05ce406b689aa000c9a34289caa1526f1c093a1cefc0d9695/xai_sdk-1.11.0.tar.gz", hash = "sha256:ca87a830d310fb8e06fba44fb2a8c5cdf0d9f716b61126eddd51b7f416a63932", size = 404313, upload-time = "2026-03-27T18:23:10.091Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/04/76/86d9a3589c725ce825d2ed3e7cb3ecf7f956d3fd015353d52197bb341bcd/xai_sdk-1.11.0-py3-none-any.whl", hash = "sha256:fe58ce6d8f8115ae8bd57ded57bcd847d0bb7cb28bb7b236abefd4626df1ed8d", size = 251388, upload-time = "2026-03-27T18:23:08.573Z" },
+]
+
[[package]]
name = "xlrd"
version = "2.0.2"
@@ -12392,9 +12418,9 @@ wheels = [
[[package]]
name = "zipp"
-version = "3.23.0"
+version = "3.23.1"
source = { registry = "https://pypi.org/simple" }
-sdist = { url = "https://files.pythonhosted.org/packages/e3/02/0f2892c661036d50ede074e376733dca2ae7c6eb617489437771209d4180/zipp-3.23.0.tar.gz", hash = "sha256:a07157588a12518c9d4034df3fbbee09c814741a33ff63c05fa29d26a2404166", size = 25547, upload-time = "2025-06-08T17:06:39.4Z" }
+sdist = { url = "https://files.pythonhosted.org/packages/30/21/093488dfc7cc8964ded15ab726fad40f25fd3d788fd741cc1c5a17d78ee8/zipp-3.23.1.tar.gz", hash = "sha256:32120e378d32cd9714ad503c1d024619063ec28aad2248dc6672ad13edfa5110", size = 25965, upload-time = "2026-04-13T23:21:46.6Z" }
wheels = [
- { url = "https://files.pythonhosted.org/packages/2e/54/647ade08bf0db230bfea292f893923872fd20be6ac6f53b2b936ba839d75/zipp-3.23.0-py3-none-any.whl", hash = "sha256:071652d6115ed432f5ce1d34c336c0adfd6a884660d1e9712a256d3d3bd4b14e", size = 10276, upload-time = "2025-06-08T17:06:38.034Z" },
+ { url = "https://files.pythonhosted.org/packages/08/8a/0861bec20485572fbddf3dfba2910e38fe249796cb73ecdeb74e07eeb8d3/zipp-3.23.1-py3-none-any.whl", hash = "sha256:0b3596c50a5c700c9cb40ba8d86d9f2cc4807e9bedb06bcdf7fac85633e444dc", size = 10378, upload-time = "2026-04-13T23:21:45.386Z" },
]