🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
chore: Update all the model config parameters as optional and set default value as None. (#1947)
JINO ROHIT4e40616472cd
diff --git a/camel/configs/aiml_config.py b/camel/configs/aiml_config.pyindex 61bf34cc9..52ae15faa 100644--- a/camel/configs/aiml_config.py+++ b/camel/configs/aiml_config.py@@ -13,12 +13,12 @@# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========from __future__ import annotations-from typing import Sequence, Type, Union+from typing import Optional, Sequence, Union-from pydantic import BaseModel, Field+from pydantic import Fieldfrom camel.configs.base_config import BaseConfig-from camel.types import NOT_GIVEN, NotGiven+from camel.types import NotGivenclass AIMLConfig(BaseConfig):@@ -27,15 +27,16 @@ class AIMLConfig(BaseConfig):Args:temperature (float, optional): Determines the degree of randomness- in the response. (default: :obj:`0.7`)+ in the response. (default: :obj:`None`)top_p (float, optional): The top_p (nucleus) parameter is used todynamically adjust the number of choices for each predicted token- based on the cumulative probabilities. (default: :obj:`0.7`)- n (int, optional): Number of generations to return. (default::obj:`1`)+ based on the cumulative probabilities. (default: :obj:`None`)+ n (int, optional): Number of generations to return.+ (default: :obj:`None`)response_format (object, optional): An object specifying the formatthat the model must output.stream (bool, optional): If set, tokens are returned as Server-Sent- Events as they are made available. (default: :obj:`False`)+ Events as they are made available. (default: :obj:`None`)stop (str or list, optional): Up to :obj:`4` sequences where the APIwill stop generating further tokens. (default: :obj:`None`)max_tokens (int, optional): The maximum number of tokens to generate.@@ -48,33 +49,33 @@ class AIMLConfig(BaseConfig):The exact effect will vary per model, but values between:obj:` -1`and :obj:`1` should decrease or increase likelihood of selection;values like :obj:`-100` or :obj:`100` should result in a ban or- exclusive selection of the relevant token. (default: :obj:`{}`)+ exclusive selection of the relevant token. (default: :obj:`None`)frequency_penalty (float, optional): Number between :obj:`-2.0` and:obj:`2.0`. Positive values penalize new tokens based on theirexisting frequency in the text so far, decreasing the model'slikelihood to repeat the same line verbatim. See more information- about frequency and presence penalties. (default: :obj:`0.0`)+ about frequency and presence penalties. (default: :obj:`None`)presence_penalty (float, optional): Number between :obj:`-2.0` and:obj:`2.0`. Positive values penalize new tokens based on whetherthey appear in the text so far, increasing the model's likelihoodto talk about new topics. See more information about frequency and- presence penalties. (default: :obj:`0.0`)+ presence penalties. (default: :obj:`None`)tools (list[FunctionTool], optional): A list of tools the model maycall. Currently, only functions are supported as a tool. Use thisto provide a list of functions the model may generate JSON inputsfor. A max of 128 functions are supported."""- temperature: float = 0.7- top_p: float = 0.7- n: int = 1- stream: bool = False- stop: Union[str, Sequence[str], NotGiven] = NOT_GIVEN- max_tokens: Union[int, NotGiven] = NOT_GIVEN+ temperature: Optional[float] = None+ top_p: Optional[float] = None+ n: Optional[int] = None+ stream: Optional[bool] = None+ stop: Optional[Union[str, Sequence[str], NotGiven]] = None+ max_tokens: Optional[Union[int, NotGiven]] = Nonelogit_bias: dict = Field(default_factory=dict)- response_format: Union[Type[BaseModel], dict, NotGiven] = NOT_GIVEN- presence_penalty: float = 0.0- frequency_penalty: float = 0.0+ response_format: Optional[Union[dict, NotGiven]] = None+ presence_penalty: Optional[float] = None+ frequency_penalty: Optional[float] = NoneAIML_API_PARAMS = {param for param in AIMLConfig.model_fields.keys()}diff --git a/camel/configs/anthropic_config.py b/camel/configs/anthropic_config.pyindex 678f14e27..76dba6df9 100644--- a/camel/configs/anthropic_config.py+++ b/camel/configs/anthropic_config.py@@ -13,10 +13,9 @@# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========from __future__ import annotations-from typing import Any, ClassVar, List, Union+from typing import Any, List, Optionalfrom camel.configs.base_config import BaseConfig-from camel.types import NotGivenclass AnthropicConfig(BaseConfig):@@ -29,59 +28,58 @@ class AnthropicConfig(BaseConfig):generate before stopping. Note that Anthropic models may stopbefore reaching this maximum. This parameter only specifies theabsolute maximum number of tokens to generate.- (default: :obj:`8192`)+ (default: :obj:`None`)stop_sequences (List[str], optional): Custom text sequences that willcause the model to stop generating. The models will normally stopwhen they have naturally completed their turn. If the modelencounters one of these custom sequences, the response will beterminated and the stop_reason will be "stop_sequence".- (default: :obj:`[]`)+ (default: :obj:`None`)temperature (float, optional): Amount of randomness injected into theresponse. Defaults to 1. Ranges from 0 to 1. Use temp closer to 0for analytical / multiple choice, and closer to 1 for creativeand generative tasks. Note that even with temperature of 0.0, the- results will not be fully deterministic. (default: :obj:`1`)+ results will not be fully deterministic. (default: :obj:`None`)top_p (float, optional): Use nucleus sampling. In nucleus sampling, wecompute the cumulative distribution over all the options for eachsubsequent token in decreasing probability order and cut it offonce it reaches a particular probability specified by `top_p`.You should either alter `temperature` or `top_p`,- but not both. (default: :obj:`0.7`)+ but not both. (default: :obj:`None`)top_k (int, optional): Only sample from the top K options for eachsubsequent token. Used to remove "long tail" low probability- responses. (default: :obj:`5`)+ responses. (default: :obj:`None`)stream (bool, optional): Whether to incrementally stream the response- using server-sent events. (default: :obj:`False`)- metadata (Union[dict, NotGiven], optional): An object describing+ using server-sent events. (default: :obj:`None`)+ metadata (dict, optional): An object describingmetadata about the request. Can include user_id as an externalidentifier for the user associated with the request.- (default: :obj:`NotGiven()`)- thinking (Union[dict, NotGiven], optional): Configuration for enabling+ (default: :obj:`None`)+ thinking (dict, optional): Configuration for enablingClaude's extended thinking. When enabled, responses includethinking content blocks showing Claude's thinking process.- (default: :obj:`NotGiven()`)- tool_choice (Union[dict, NotGiven], optional): How the model should+ (default: :obj:`None`)+ tool_choice (dict, optional): How the model shoulduse the provided tools. The model can use a specific tool, anyavailable tool, decide by itself, or not use tools at all.- (default: :obj:`NotGiven()`)+ (default: :obj:`None`)"""- max_tokens: int = 8192- stop_sequences: ClassVar[Union[List[str], NotGiven]] = []- temperature: float = 1- top_p: Union[float, NotGiven] = 0.7- stream: bool = False- metadata: Union[dict, NotGiven] = NotGiven()- thinking: Union[dict, NotGiven] = NotGiven()- tool_choice: Union[dict, NotGiven] = NotGiven()+ max_tokens: Optional[int] = None+ stop_sequences: Optional[List[str]] = None+ temperature: Optional[float] = None+ top_p: Optional[float] = None+ top_k: Optional[int] = None+ stream: Optional[bool] = None+ metadata: Optional[dict] = None+ thinking: Optional[dict] = None+ tool_choice: Optional[dict] = Nonedef as_dict(self) -> dict[str, Any]:config_dict = super().as_dict()# Create a list of keys to remove to avoid modifying dictkeys_to_remove = [- key- for key, value in config_dict.items()- if isinstance(value, NotGiven)+ key for key, value in config_dict.items() if value is None]for key in keys_to_remove:@@ -89,8 +87,8 @@ class AnthropicConfig(BaseConfig):# remove some keys if thinking is enabledthinking_enabled = (- not isinstance(self.thinking, NotGiven)- and self.thinking["type"] == "enabled"+ self.thinking is not None+ and self.thinking.get("type") == "enabled")if thinking_enabled:# `top_p`, `top_k`, `temperature` must be unset when thinking isdiff --git a/camel/configs/cohere_config.py b/camel/configs/cohere_config.pyindex e00181ad3..8b6ee2611 100644--- a/camel/configs/cohere_config.py+++ b/camel/configs/cohere_config.py@@ -26,7 +26,7 @@ class CohereConfig(BaseConfig):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:`0.3`)+ (default: :obj:`None`)documents (list, optional): A list of relevant documents that themodel can cite to generate a more accurate reply. Each document iseither a string or document object with content and metadata.@@ -47,30 +47,31 @@ class CohereConfig(BaseConfig):`1.0`. Used to reduce repetitiveness of generated tokens. Thehigher the value, the stronger a penalty is applied to previouslypresent tokens, proportional to how many times they have already- appeared in the prompt or prior generation. (default: :obj:`0.0`)+ appeared in the prompt or prior generation.+ (default: :obj:`None`)presence_penalty (float, optional): Min value of `0.0`, max value of`1.0`. Used to reduce repetitiveness of generated tokens. Similarto `frequency_penalty`, except that this penalty is appliedequally to all tokens that have already appeared, regardless of- their exact frequencies. (default: :obj:`0.0`)+ their exact frequencies. (default: :obj:`None`)k (int, optional): Ensures only the top k most likely tokens areconsidered for generation at each step. Min value of `0`, max- value of `500`. (default: :obj:`0`)+ value of `500`. (default: :obj:`None`)p (float, optional): Ensures that only the most likely tokens, withtotal probability mass of `p`, are considered for generation ateach step. If both k and p are enabled, `p` acts after `k`. Min- value of `0.01`, max value of `0.99`. (default: :obj:`0.75`)+ value of `0.01`, max value of `0.99`. (default: :obj:`None`)"""- temperature: Optional[float] = 0.2+ temperature: Optional[float] = Nonedocuments: Optional[list] = Nonemax_tokens: Optional[int] = Nonestop_sequences: Optional[List[str]] = Noneseed: Optional[int] = None- frequency_penalty: Optional[float] = 0.0- presence_penalty: Optional[float] = 0.0- k: Optional[int] = 0- p: Optional[float] = 0.75+ frequency_penalty: Optional[float] = None+ presence_penalty: Optional[float] = None+ k: Optional[int] = None+ p: Optional[float] = NoneCOHERE_API_PARAMS = {param for param in CohereConfig().model_fields.keys()}diff --git a/camel/configs/deepseek_config.py b/camel/configs/deepseek_config.pyindex e0bb15724..447bef034 100644--- a/camel/configs/deepseek_config.py+++ b/camel/configs/deepseek_config.py@@ -29,19 +29,19 @@ class DeepSeekConfig(BaseConfig):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:`1.0`)+ (default: :obj:`None`)top_p (float, optional): Controls the diversity and focus of thegenerated results. Higher values make the output more diverse,- while lower values make it more focused. (default: :obj:`1.0`)+ while lower values make it more focused. (default: :obj:`None`)response_format (object, optional): Specifies the format of thereturned content. The available values are `{"type": "text"}` or`{"type": "json_object"}`. Setting it to `{"type": "json_object"}`will output a standard JSON string.- (default: :obj:`{"type": "text"}`)+ (default: :obj:`None`)stream (bool, optional): If set, partial message deltas will be sent.Tokens will be sent as data-only server-sent events (SSE) asthey become available, with the stream terminated by a- data: [DONE] message. (default: :obj:`False`)+ data: [DONE] message. (default: :obj:`None`)stop (Union[str, list[str]], optional): Up to 16 sequences wherethe API will stop generating further tokens. (default: :obj:`None`)max_tokens (int, optional): The maximum number of tokens that can@@ -51,11 +51,11 @@ class DeepSeekConfig(BaseConfig):presence_penalty (float, optional): Number between -2.0 and 2.0.Positive values penalize new tokens based on whether theyappear in the text so far, increasing the model's likelihood- to talk about new topics. (default: :obj:`0.0`)+ to talk about new topics. (default: :obj:`None`)frequency_penalty (float, optional): Number between -2.0 and 2.0.Positive values penalize new tokens based on their existingfrequency in the text so far, decreasing the model's likelihood- to repeat the same line verbatim. (default: :obj:`0`)+ to repeat the same line verbatim. (default: :obj:`None`)tools (list[FunctionTool], optional): A list of tools the model maycall. Currently, only functions are supported as a tool. Usethis to provide a list of functions the model may generate JSON@@ -70,31 +70,31 @@ class DeepSeekConfig(BaseConfig):{"type": "function", "function": {"name": "my_function"}} forcesthe model to call that tool. "none" is the default when no toolsare present. "auto" is the default if tools are present.- (default: :obj:`"auto"`)+ (default: :obj:`None`)logprobs (bool, optional): Whether to return log probabilities ofthe output tokens or not. If true, returns the log probabilitiesof each output token returned in the content of message.- (default: :obj:`False`)+ (default: :obj:`None`)top_logprobs (int, optional): An integer between 0 and 20 specifyingthe number of most likely tokens to return at each tokenposition, each with an associated log probability. logprobsmust be set to true if this parameter is used.(default: :obj:`None`)include_usage (bool, optional): When streaming, specifies whether to- include usage information in `stream_options`. (default:- :obj:`True`)+ include usage information in `stream_options`.+ (default: :obj:`None`)"""- temperature: float = 1.0 # deepseek default: 1.0- top_p: float = 1.0- stream: bool = False+ temperature: Optional[float] = None # deepseek default: 1.0+ top_p: Optional[float] = None+ stream: Optional[bool] = Nonestop: Optional[Union[str, Sequence[str]]] = Nonemax_tokens: Optional[int] = None- presence_penalty: float = 0.0+ presence_penalty: Optional[float] = Noneresponse_format: Optional[Union[Type[BaseModel], dict]] = None- frequency_penalty: float = 0.0+ frequency_penalty: Optional[float] = Nonetool_choice: Optional[Union[dict[str, str], str]] = None- logprobs: bool = False+ logprobs: Optional[bool] = Nonetop_logprobs: Optional[int] = Nonedef __init__(self, include_usage: bool = True, **kwargs):diff --git a/camel/configs/gemini_config.py b/camel/configs/gemini_config.pyindex 2ac5bbe2a..ac80bf854 100644--- a/camel/configs/gemini_config.py+++ b/camel/configs/gemini_config.py@@ -29,14 +29,14 @@ class GeminiConfig(BaseConfig):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:`0.2`)+ (default: :obj:`None`)top_p (float, optional): An alternative to sampling with temperature,called nucleus sampling, where the model considers the results ofthe tokens with top_p probability mass. So :obj:`0.1` means onlythe tokens comprising the top 10% probability mass are considered.- (default: :obj:`1.0`)+ (default: :obj:`None`)n (int, optional): How many chat completion choices to generate for- each input message. (default: :obj:`1`)+ each input message. (default: :obj:`None`)response_format (object, optional): An object specifying the formatthat the model must output. Compatible with GPT-4 Turbo and allGPT-3.5 Turbo models newer than gpt-3.5-turbo-1106. Setting to@@ -52,7 +52,7 @@ class GeminiConfig(BaseConfig):max context length.stream (bool, optional): If True, partial message deltas will be sentas data-only server-sent events as they become available.- (default: :obj:`False`)+ (default: :obj:`None`)stop (str or list, optional): Up to :obj:`4` sequences where the APIwill stop generating further tokens. (default: :obj:`None`)max_tokens (int, optional): The maximum number of tokens to generate@@ -75,10 +75,10 @@ class GeminiConfig(BaseConfig):are present."""- temperature: float = 0.2 # openai default: 1.0- top_p: float = 1.0- n: int = 1- stream: bool = False+ temperature: Optional[float] = None # openai default: 1.0+ top_p: Optional[float] = None+ n: Optional[int] = None+ stream: Optional[bool] = Nonestop: Optional[Union[str, Sequence[str]]] = Nonemax_tokens: Optional[int] = Noneresponse_format: Optional[Union[Type[BaseModel], dict]] = Nonediff --git a/camel/configs/groq_config.py b/camel/configs/groq_config.pyindex 5cfaf88d9..61fd8d719 100644--- a/camel/configs/groq_config.py+++ b/camel/configs/groq_config.py@@ -16,7 +16,6 @@ from __future__ import annotationsfrom typing import Optional, Sequence, Unionfrom camel.configs.base_config import BaseConfig-from camel.types import NOT_GIVEN, NotGivenclass GroqConfig(BaseConfig):@@ -29,14 +28,14 @@ class GroqConfig(BaseConfig):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:`0.2`)+ (default: :obj:`None`)top_p (float, optional): An alternative to sampling with temperature,called nucleus sampling, where the model considers the results ofthe tokens with top_p probability mass. So :obj:`0.1` means onlythe tokens comprising the top 10% probability mass are considered.- (default: :obj:`1.0`)+ (default: :obj:`None`)n (int, optional): How many chat completion choices to generate for- each input message. (default: :obj:`1`)+ each input message. (default: :obj:`None`)response_format (object, optional): An object specifying the formatthat the model must output. Compatible with GPT-4 Turbo and allGPT-3.5 Turbo models newer than gpt-3.5-turbo-1106. Setting to@@ -52,7 +51,7 @@ class GroqConfig(BaseConfig):max context length.stream (bool, optional): If True, partial message deltas will be sentas data-only server-sent events as they become available.- (default: :obj:`False`)+ (default: :obj:`None`)stop (str or list, optional): Up to :obj:`4` sequences where the APIwill stop generating further tokens. (default: :obj:`None`)max_tokens (int, optional): The maximum number of tokens to generate@@ -63,15 +62,15 @@ class GroqConfig(BaseConfig)::obj:`2.0`. Positive values penalize new tokens based on whetherthey appear in the text so far, increasing the model's likelihoodto talk about new topics. See more information about frequency and- presence penalties. (default: :obj:`0.0`)+ presence penalties. (default: :obj:`None`)frequency_penalty (float, optional): Number between :obj:`-2.0` and:obj:`2.0`. Positive values penalize new tokens based on theirexisting frequency in the text so far, decreasing the model'slikelihood to repeat the same line verbatim. See more information- about frequency and presence penalties. (default: :obj:`0.0`)+ about frequency and presence penalties. (default: :obj:`None`)user (str, optional): A unique identifier representing your end-user,which can help OpenAI to monitor and detect abuse.- (default: :obj:`""`)+ (default: :obj:`None`)tools (list[FunctionTool], optional): A list of tools the model maycall. Currently, only functions are supported as a tool. Use thisto provide a list of functions the model may generate JSON inputs@@ -88,17 +87,17 @@ class GroqConfig(BaseConfig):are present."""- temperature: float = 0.2 # openai default: 1.0- top_p: float = 1.0- n: int = 1- stream: bool = False- stop: Union[str, Sequence[str], NotGiven] = NOT_GIVEN- max_tokens: Union[int, NotGiven] = NOT_GIVEN- presence_penalty: float = 0.0- response_format: Union[dict, NotGiven] = NOT_GIVEN- frequency_penalty: float = 0.0- user: str = ""- tool_choice: Optional[Union[dict[str, str], str]] = "auto"+ temperature: Optional[float] = None+ top_p: Optional[float] = None+ n: Optional[int] = None+ stream: Optional[bool] = None+ stop: Optional[Union[str, Sequence[str]]] = None+ max_tokens: Optional[int] = None+ presence_penalty: Optional[float] = None+ response_format: Optional[dict] = None+ frequency_penalty: Optional[float] = None+ user: Optional[str] = None+ tool_choice: Optional[Union[dict[str, str], str]] = NoneGROQ_API_PARAMS = {param for param in GroqConfig.model_fields.keys()}diff --git a/camel/configs/internlm_config.py b/camel/configs/internlm_config.pyindex 6f48385e5..073b884bf 100644--- a/camel/configs/internlm_config.py+++ b/camel/configs/internlm_config.py@@ -24,16 +24,16 @@ class InternLMConfig(BaseConfig):Args:stream (bool, optional): Whether to stream the response.- (default: :obj:`False`)+ (default: :obj:`None`)temperature (float, optional): Controls the diversity and focus ofthe generated results. Lower values make the output more focused,- while higher values make it more diverse. (default: :obj:`0.8`)+ while higher values make it more diverse. (default: :obj:`None`)top_p (float, optional): Controls the diversity and focus of thegenerated results. Higher values make the output more diverse,- while lower values make it more focused. (default: :obj:`0.9`)- max_tokens (Union[int, NotGiven], optional): Allows the model to+ while lower values make it more focused. (default: :obj:`None`)+ max_tokens (int, optional): Allows the model togenerate the maximum number of tokens.- (default: :obj:`NOT_GIVEN`)+ (default: :obj:`None`)tools (list, optional): Specifies an array of tools that the model cancall. It can contain one or more tool objects. During a functioncall process, the model will select one tool from the array.@@ -50,9 +50,9 @@ class InternLMConfig(BaseConfig):are present."""- stream: bool = False- temperature: float = 0.8- top_p: float = 0.9+ stream: Optional[bool] = None+ temperature: Optional[float] = None+ top_p: Optional[float] = Nonemax_tokens: Optional[int] = Nonetool_choice: Optional[Union[dict[str, str], str]] = Nonediff --git a/camel/configs/litellm_config.py b/camel/configs/litellm_config.pyindex f7fea3d09..6d5175e93 100644--- a/camel/configs/litellm_config.py+++ b/camel/configs/litellm_config.py@@ -24,49 +24,51 @@ class LiteLLMConfig(BaseConfig):Args:timeout (Optional[Union[float, str]], optional): Request timeout.- (default: None)+ (default: :obj:`None`)temperature (Optional[float], optional): Temperature parameter for- controlling randomness. (default: None)+ controlling randomness. (default: :obj:`None`)top_p (Optional[float], optional): Top-p parameter for nucleus- sampling. (default: None)+ sampling. (default: :obj:`None`)n (Optional[int], optional): Number of completions to generate.- (default: None)+ (default: :obj:`None`)stream (Optional[bool], optional): Whether to return a streaming- response. (default: None)+ response. (default: :obj:`None`)stream_options (Optional[dict], optional): Options for the streaming- response. (default: None)+ response. (default: :obj:`None`)stop (Optional[Union[str, List[str]]], optional): Sequences where the- API will stop generating further tokens. (default: None)+ API will stop generating further tokens. (default: :obj:`None`)max_tokens (Optional[int], optional): Maximum number of tokens to- generate. (default: None)+ generate. (default: :obj:`None`)presence_penalty (Optional[float], optional): Penalize new tokens- based on their existence in the text so far. (default: None)+ based on their existence in the text so far. (default: :obj:`None`)frequency_penalty (Optional[float], optional): Penalize new tokens- based on their frequency in the text so far. (default: None)+ based on their frequency in the text so far. (default: :obj:`None`)logit_bias (Optional[dict], optional): Modify the probability of- specific tokens appearing in the completion. (default: None)+ specific tokens appearing in the completion. (default: :obj:`None`)user (Optional[str], optional): A unique identifier representing the- end-user. (default: None)+ end-user. (default: :obj:`None`)response_format (Optional[dict], optional): Response format- parameters. (default: None)- seed (Optional[int], optional): Random seed. (default: None)- tools (Optional[List], optional): List of tools. (default: None)+ parameters. (default: :obj:`None`)+ seed (Optional[int], optional): Random seed. (default: :obj:`None`)+ tools (Optional[List], optional): List of tools. (default: :obj:`None`)tool_choice (Optional[Union[str, dict]], optional): Tool choice- parameters. (default: None)+ parameters. (default: :obj:`None`)logprobs (Optional[bool], optional): Whether to return log- probabilities of the output tokens. (default: None)+ probabilities of the output tokens. (default: :obj:`None`)top_logprobs (Optional[int], optional): Number of most likely tokens- to return at each token position. (default: None)- deployment_id (Optional[str], optional): Deployment ID. (default: None)+ to return at each token position. (default: :obj:`None`)+ deployment_id (Optional[str], optional): Deployment ID.+ (default: :obj:`None`)extra_headers (Optional[dict], optional): Additional headers for the- request. (default: None)- api_version (Optional[str], optional): API version. (default: None)+ request. (default: :obj:`None`)+ api_version (Optional[str], optional): API version.+ (default: :obj:`None`)mock_response (Optional[str], optional): Mock completion response for- testing or debugging. (default: None)+ testing or debugging. (default: :obj:`None`)custom_llm_provider (Optional[str], optional): Non-OpenAI LLM- provider. (default: None)+ provider. (default: :obj:`None`)max_retries (Optional[int], optional): Maximum number of retries.- (default: None)+ (default: :obj:`None`)"""timeout: Optional[Union[float, str]] = Nonediff --git a/camel/configs/mistral_config.py b/camel/configs/mistral_config.pyindex 1e528e13e..f71f168ee 100644--- a/camel/configs/mistral_config.py+++ b/camel/configs/mistral_config.py@@ -30,18 +30,18 @@ class MistralConfig(BaseConfig):Args:temperature (Optional[float], optional): temperature the temperature- to use for sampling, e.g. 0.5.+ to use for sampling, e.g. 0.5. (default: :obj:`None`)top_p (Optional[float], optional): the cumulative probability of- tokens to generate, e.g. 0.9. Defaults to None.+ tokens to generate, e.g. 0.9. (default: :obj:`None`)max_tokens (Optional[int], optional): the maximum number of tokens to- generate, e.g. 100. Defaults to None.+ generate, e.g. 100. (default: :obj:`None`)stop (Optional[Union[str,list[str]]]): Stop generation if this tokenis detected. Or if one of these tokens is detected when providing- a string list.+ a string list. (default: :obj:`None`)random_seed (Optional[int], optional): the random seed to use for- sampling, e.g. 42. Defaults to None.+ sampling, e.g. 42. (default: :obj:`None`)safe_prompt (bool, optional): whether to use safe prompt, e.g. true.- Defaults to False.+ (default: :obj:`None`)response_format (Union[Dict[str, str], ResponseFormat): format of theresponse.tool_choice (str, optional): Controls which (if@@ -58,9 +58,9 @@ class MistralConfig(BaseConfig):max_tokens: Optional[int] = Nonestop: Optional[Union[str, list[str]]] = Nonerandom_seed: Optional[int] = None- safe_prompt: bool = False+ safe_prompt: Optional[bool] = Noneresponse_format: Optional[Union[Dict[str, str], Any]] = None- tool_choice: Optional[str] = "auto"+ tool_choice: Optional[str] = None@field_validator("response_format", mode="before")@classmethoddiff --git a/camel/configs/moonshot_config.py b/camel/configs/moonshot_config.pyindex 681ff1b63..49e2c2477 100644--- a/camel/configs/moonshot_config.py+++ b/camel/configs/moonshot_config.py@@ -25,7 +25,7 @@ class MoonshotConfig(BaseConfig):Args:temperature (float, optional): Controls randomness in the response.Lower values make the output more focused and deterministic.- (default: :obj:`0.3`)+ (default: :obj:`None`)max_tokens (int, optional): The maximum number of tokens to generate.(default: :obj:`None`)stream (bool, optional): Whether to stream the response.@@ -35,28 +35,28 @@ class MoonshotConfig(BaseConfig):type, function name, description, and parameters.(default: :obj:`None`)top_p (float, optional): Controls diversity via nucleus sampling.- (default: :obj:`1.0`)+ (default: :obj:`None`)n (int, optional): How many chat completion choices to generate for- each input message. (default: :obj:`1`)+ each input message.(default: :obj:`None`)presence_penalty (float, optional): Penalty for new tokens based onwhether they appear in the text so far.- (default: :obj:`0.0`)+ (default: :obj:`None`)frequency_penalty (float, optional): Penalty for new tokens based ontheir frequency in the text so far.- (default: :obj:`0.0`)+ (default: :obj:`None`)stop (Optional[Union[str, List[str]]], optional): Up to 4 sequenceswhere the API will stop generating further tokens.(default: :obj:`None`)"""- temperature: float = 0.3+ temperature: Optional[float] = Nonemax_tokens: Optional[int] = None- stream: bool = False+ stream: Optional[bool] = Nonetools: Optional[list] = None- top_p: float = 1.0- n: int = 1- presence_penalty: float = 0.0- frequency_penalty: float = 0.0+ top_p: Optional[float] = None+ n: Optional[int] = None+ presence_penalty: Optional[float] = None+ frequency_penalty: Optional[float] = Nonestop: Optional[Union[str, List[str]]] = Nonediff --git a/camel/configs/nvidia_config.py b/camel/configs/nvidia_config.pyindex e90ea673f..385a5a319 100644--- a/camel/configs/nvidia_config.py+++ b/camel/configs/nvidia_config.py@@ -18,7 +18,7 @@ from typing import List, Optional, Unionfrom pydantic import Fieldfrom camel.configs.base_config import BaseConfig-from camel.types import NOT_GIVEN, NotGiven+from camel.types import NotGivenclass NvidiaConfig(BaseConfig):@@ -30,21 +30,21 @@ class NvidiaConfig(BaseConfig):Args:stream (bool, optional): Whether to stream the response.- (default: :obj:`False`)+ (default: :obj:`None`)temperature (float, optional): Controls randomness in the response.Higher values make output more random, lower values make it more- deterministic. Range: [0.0, 2.0]. (default: :obj:`0.7`)+ deterministic. Range: [0.0, 2.0]. (default: :obj:`None`)top_p (float, optional): Controls diversity via nucleus sampling.- Range: [0.0, 1.0]. (default: :obj:`0.95`)+ Range: [0.0, 1.0]. (default: :obj:`None`)presence_penalty (float, optional): Penalizes new tokens based onwhether they appear in the text so far. Range: [-2.0, 2.0].- (default: :obj:`0.0`)+ (default: :obj:`None`)frequency_penalty (float, optional): Penalizes new tokens based ontheir frequency in the text so far. Range: [-2.0, 2.0].- (default: :obj:`0.0`)+ (default: :obj:`None`)max_tokens (Union[int, NotGiven], optional): Maximum number of tokensto generate. If not provided, model will use its default maximum.- (default: :obj:`NOT_GIVEN`)+ (default: :obj:`None`)seed (Optional[int], optional): Random seed for deterministic sampling.(default: :obj:`None`)tools (Optional[List[Dict]], optional): List of tools available to the@@ -56,12 +56,12 @@ class NvidiaConfig(BaseConfig):(default: :obj:`None`)"""- stream: bool = Field(default=False)- temperature: float = Field(default=0.7)- top_p: float = Field(default=0.95)- presence_penalty: float = Field(default=0.0)- frequency_penalty: float = Field(default=0.0)- max_tokens: Union[int, NotGiven] = Field(default=NOT_GIVEN)+ stream: Optional[bool] = Field(default=None)+ temperature: Optional[float] = Field(default=None)+ top_p: Optional[float] = Field(default=None)+ presence_penalty: Optional[float] = Field(default=None)+ frequency_penalty: Optional[float] = Field(default=None)+ max_tokens: Optional[Union[int, NotGiven]] = Field(default=None)seed: Optional[int] = Field(default=None)tool_choice: Optional[str] = Field(default=None)stop: Optional[List[str]] = Field(default=None)diff --git a/camel/configs/ollama_config.py b/camel/configs/ollama_config.pyindex cba6e01e6..89d84b62c 100644--- a/camel/configs/ollama_config.py+++ b/camel/configs/ollama_config.py@@ -13,12 +13,11 @@# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========from __future__ import annotations-from typing import Sequence, Type, Union+from typing import Optional, Sequence, Type, Unionfrom pydantic import BaseModelfrom camel.configs.base_config import BaseConfig-from camel.types import NOT_GIVEN, NotGivenclass OllamaConfig(BaseConfig):@@ -31,12 +30,12 @@ class OllamaConfig(BaseConfig):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:`0.2`)+ (default: :obj:`None`)top_p (float, optional): An alternative to sampling with temperature,called nucleus sampling, where the model considers the results ofthe tokens with top_p probability mass. So :obj:`0.1` means onlythe tokens comprising the top 10% probability mass are considered.- (default: :obj:`1.0`)+ (default: :obj:`None`)response_format (object, optional): An object specifying the formatthat the model must output. Compatible with GPT-4 Turbo and allGPT-3.5 Turbo models newer than gpt-3.5-turbo-1106. Setting to@@ -52,7 +51,7 @@ class OllamaConfig(BaseConfig):max context length.stream (bool, optional): If True, partial message deltas will be sentas data-only server-sent events as they become available.- (default: :obj:`False`)+ (default: :obj:`None`)stop (str or list, optional): Up to :obj:`4` sequences where the APIwill stop generating further tokens. (default: :obj:`None`)max_tokens (int, optional): The maximum number of tokens to generate@@ -63,22 +62,22 @@ class OllamaConfig(BaseConfig)::obj:`2.0`. Positive values penalize new tokens based on whetherthey appear in the text so far, increasing the model's likelihoodto talk about new topics. See more information about frequency and- presence penalties. (default: :obj:`0.0`)+ presence penalties. (default: :obj:`None`)frequency_penalty (float, optional): Number between :obj:`-2.0` and:obj:`2.0`. Positive values penalize new tokens based on theirexisting frequency in the text so far, decreasing the model'slikelihood to repeat the same line verbatim. See more information- about frequency and presence penalties. (default: :obj:`0.0`)+ about frequency and presence penalties. (default: :obj:`None`)"""- temperature: float = 0.2- top_p: float = 1.0- stream: bool = False- stop: Union[str, Sequence[str], NotGiven] = NOT_GIVEN- max_tokens: Union[int, NotGiven] = NOT_GIVEN- presence_penalty: float = 0.0- response_format: Union[Type[BaseModel], dict, NotGiven] = NOT_GIVEN- frequency_penalty: float = 0.0+ temperature: Optional[float] = None+ top_p: Optional[float] = None+ stream: Optional[bool] = None+ stop: Optional[Union[str, Sequence[str]]] = None+ max_tokens: Optional[int] = None+ presence_penalty: Optional[float] = None+ response_format: Optional[Union[Type[BaseModel], dict]] = None+ frequency_penalty: Optional[float] = NoneOLLAMA_API_PARAMS = {param for param in OllamaConfig.model_fields.keys()}diff --git a/camel/configs/openai_config.py b/camel/configs/openai_config.pyindex c58ef342a..84f289efd 100644--- a/camel/configs/openai_config.py+++ b/camel/configs/openai_config.py@@ -79,7 +79,7 @@ class ChatGPTConfig(BaseConfig):exclusive selection of the relevant token. (default: :obj:`None`)user (str, optional): A unique identifier representing your end-user,which can help OpenAI to monitor and detect abuse.- (default: :obj:`""`)+ (default: :obj:`None`)tools (list[FunctionTool], optional): A list of tools the model maycall. Currently, only functions are supported as a tool. Use thisto provide a list of functions the model may generate JSON inputs@@ -102,8 +102,8 @@ class ChatGPTConfig(BaseConfig):or if the model type does not support it, this parameter isignored. (default: :obj:`None`)parallel_tool_calls (bool, optional): A parameter specifying whether- the model should call tools in parallel or not. (default:- :obj:`None`)+ the model should call tools in parallel or not.+ (default: :obj:`None`)"""temperature: Optional[float] = Nonediff --git a/camel/configs/openrouter_config.py b/camel/configs/openrouter_config.pyindex 15da70c87..1e6874e8f 100644--- a/camel/configs/openrouter_config.py+++ b/camel/configs/openrouter_config.py@@ -29,14 +29,14 @@ class OpenRouterConfig(BaseConfig):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`)+ (default: :obj:`None`)top_p (float, optional): An alternative to sampling with temperature,called nucleus sampling, where the model considers the results ofthe tokens with top_p probability mass. So :obj:`0.1` means onlythe tokens comprising the top 10% probability mass are considered.- (default: :obj: `None`)+ (default: :obj:`None`)n (int, optional): How many chat completion choices to generate for- each input message. (default: :obj: `None`)+ each input message. (default: :obj:`None`)response_format (object, optional): An object specifying the formatthat the model must output. Compatible with GPT-4 Turbo and allGPT-3.5 Turbo models newer than gpt-3.5-turbo-1106. Setting to@@ -52,7 +52,7 @@ class OpenRouterConfig(BaseConfig):max context length.stream (bool, optional): If True, partial message deltas will be sentas data-only server-sent events as they become available.- (default: :obj: `None`)+ (default: :obj:`None`)stop (str or list, optional): Up to :obj:`4` sequences where the APIwill stop generating further tokens. (default: :obj:`None`)max_tokens (int, optional): The maximum number of tokens to generate@@ -63,19 +63,19 @@ class OpenRouterConfig(BaseConfig)::obj:`2.0`. Positive values penalize new tokens based on whetherthey appear in the text so far, increasing the model's likelihoodto talk about new topics. See more information about frequency and- presence penalties. (default: :obj: `None`)+ presence penalties. (default: :obj:`None`)frequency_penalty (float, optional): Number between :obj:`-2.0` and:obj:`2.0`. Positive values penalize new tokens based on theirexisting frequency in the text so far, decreasing the model'slikelihood to repeat the same line verbatim. See more information- about frequency and presence penalties. (default: :obj: `None`)+ about frequency and presence penalties. (default: :obj:`None`)user (str, optional): A unique identifier representing your end-user,which can help OpenAI to monitor and detect abuse.- (default: :obj: `None`)+ (default: :obj:`None`)tools (list[FunctionTool], optional): A list of tools the model maycall. Currently, only functions are supported as a tool. Use thisto provide a list of functions the model may generate JSON inputs- for. A max of 128 functions are supported. (default: :obj: `None`)+ for. A max of 128 functions are supported. (default: :obj:`None`)tool_choice (Union[dict[str, str], str], optional): Controls which (ifany) tool is called by the model. :obj:`"none"` means the modelwill not call any tool and instead generates a message.@@ -85,7 +85,7 @@ class OpenRouterConfig(BaseConfig):via {"type": "function", "function": {"name": "my_function"}}forces the model to call that tool. :obj:`"none"` is the defaultwhen no tools are present. :obj:`"auto"` is the default if tools- are present. (default: :obj: `None`)+ are present. (default: :obj:`None`)"""temperature: Optional[float] = Nonediff --git a/camel/configs/qwen_config.py b/camel/configs/qwen_config.pyindex 646174c04..d410d32d8 100644--- a/camel/configs/qwen_config.py+++ b/camel/configs/qwen_config.py@@ -25,18 +25,18 @@ class QwenConfig(BaseConfig):Args:stream (bool, optional): Whether to stream the response.- (default: :obj:`False`)+ (default: :obj:`None`)temperature (float, optional): Controls the diversity andfocus of the generated results. Lower values make the output morefocused, while higher values make it more diverse.- (default: :obj:`0.3`)+ (default: :obj:`None`)top_p (float, optional): Controls the diversity and focus ofthe generated results. Higher values make the output more diverse,while lower values make it more focused. (default: :obj:`0.9`)presence_penalty (float, optional): Controls the repetitioncontent in the generated results. Positive values reduce therepetition of content, while negative values increase it.- (default: :obj:`0.0`)+ (default: :obj:`None`)response_format (Optional[Dict[str, str]], optional): Specifies theformat of the returned content. The available values are`{"type": "text"}` or `{"type": "json_object"}`. Setting it to@@ -67,13 +67,13 @@ class QwenConfig(BaseConfig):(default: :obj:`None`)include_usage (bool, optional): When streaming, specifies whether toinclude usage information in `stream_options`.- (default: :obj:`True`)+ (default: :obj:`None`)"""- stream: bool = False- temperature: float = 0.3- top_p: float = 0.9- presence_penalty: float = 0.0+ stream: Optional[bool] = None+ temperature: Optional[float] = None+ top_p: Optional[float] = None+ presence_penalty: Optional[float] = Noneresponse_format: Optional[Dict[str, str]] = Nonemax_tokens: Optional[int] = Noneseed: Optional[int] = Nonediff --git a/camel/configs/reka_config.py b/camel/configs/reka_config.pyindex d853b5aa4..446247db0 100644--- a/camel/configs/reka_config.py+++ b/camel/configs/reka_config.py@@ -26,32 +26,33 @@ class RekaConfig(BaseConfig):Args:temperature (Optional[float], optional): temperature the temperature- to use for sampling, e.g. 0.5.+ to use for sampling, e.g. 0.5. (default: :obj:`None`)top_p (Optional[float], optional): the cumulative probability of- tokens to generate, e.g. 0.9. Defaults to None.+ tokens to generate, e.g. 0.9. (default: :obj:`None`)top_k (Optional[int], optional): Parameter which forces the model toonly consider the tokens with the `top_k` highest probabilities at- the next step. Defaults to 1024.+ the next step. (default: :obj:`None`)max_tokens (Optional[int], optional): the maximum number of tokens to- generate, e.g. 100. Defaults to None.+ generate, e.g. 100. (default: :obj:`None`)stop (Optional[Union[str,list[str]]]): Stop generation if this tokenis detected. Or if one of these tokens is detected when providing- a string list.+ a string list. (default: :obj:`None`)seed (Optional[int], optional): the random seed to use for sampling, e.- g. 42. Defaults to None.+ g. 42. (default: :obj:`None`)presence_penalty (float, optional): Number between :obj:`-2.0` and:obj:`2.0`. Positive values penalize new tokens based on whetherthey appear in the text so far, increasing the model's likelihoodto talk about new topics. See more information about frequency and- presence penalties. (default: :obj:`0.0`)+ presence penalties. (default: :obj:`None`)frequency_penalty (float, optional): Number between :obj:`-2.0` and:obj:`2.0`. Positive values penalize new tokens based on theirexisting frequency in the text so far, decreasing the model'slikelihood to repeat the same line verbatim. See more information- about frequency and presence penalties. (default: :obj:`0.0`)+ about frequency and presence penalties. (default: :obj:`None`)use_search_engine (Optional[bool]): Whether to consider using searchengine to complete the request. Note that even if this is set to`True`, the model might decide to not use search.+ (default: :obj:`None`)"""temperature: Optional[float] = None@@ -60,9 +61,9 @@ class RekaConfig(BaseConfig):max_tokens: Optional[int] = Nonestop: Optional[Union[str, list[str]]] = Noneseed: Optional[int] = None- frequency_penalty: float = 0.0- presence_penalty: float = 0.0- use_search_engine: Optional[bool] = False+ frequency_penalty: Optional[float] = None+ presence_penalty: Optional[float] = None+ use_search_engine: Optional[bool] = Nonedef as_dict(self) -> dict[str, Any]:config_dict = super().as_dict()diff --git a/camel/configs/samba_config.py b/camel/configs/samba_config.pyindex 8d7570d18..83010485b 100644--- a/camel/configs/samba_config.py+++ b/camel/configs/samba_config.py@@ -29,39 +29,39 @@ class SambaVerseAPIConfig(BaseConfig):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:`0.7`)+ (default: :obj:`None`)top_p (float, optional): An alternative to sampling with temperature,called nucleus sampling, where the model considers the results ofthe tokens with top_p probability mass. So :obj:`0.1` means onlythe tokens comprising the top 10% probability mass are considered.- (default: :obj:`0.95`)+ (default: :obj:`None`)top_k (int, optional): Only sample from the top K options for eachsubsequent token. Used to remove "long tail" low probabilityresponses.- (default: :obj:`50`)+ (default: :obj:`None`)max_tokens (Optional[int], optional): The maximum number of tokens togenerate, e.g. 100.- (default: :obj:`2048`)+ (default: :obj:`None`)repetition_penalty (Optional[float], optional): The parameter forrepetition penalty. 1.0 means no penalty.- (default: :obj:`1.0`)+ (default: :obj:`None`)stop (Optional[Union[str,list[str]]]): Stop generation if this tokenis detected. Or if one of these tokens is detected when providinga string list.- (default: :obj:`""`)+ (default: :obj:`None`)stream (Optional[bool]): If True, partial message deltas will be sentas data-only server-sent events as they become available.Currently SambaVerse API doesn't support stream mode.- (default: :obj:`False`)+ (default: :obj:`None`)"""- temperature: Optional[float] = 0.7- top_p: Optional[float] = 0.95- top_k: Optional[int] = 50- max_tokens: Optional[int] = 2048- repetition_penalty: Optional[float] = 1.0- stop: Optional[Union[str, list[str]]] = ""- stream: Optional[bool] = False+ temperature: Optional[float] = None+ top_p: Optional[float] = None+ top_k: Optional[int] = None+ max_tokens: Optional[int] = None+ repetition_penalty: Optional[float] = None+ stop: Optional[Union[str, list[str]]] = None+ stream: Optional[bool] = Nonedef as_dict(self) -> dict[str, Any]:config_dict = super().as_dict()diff --git a/camel/configs/sglang_config.py b/camel/configs/sglang_config.pyindex fe5251935..37826e952 100644--- a/camel/configs/sglang_config.py+++ b/camel/configs/sglang_config.py@@ -16,7 +16,6 @@ from __future__ import annotationsfrom typing import Any, Dict, List, Optional, Sequence, Unionfrom camel.configs.base_config import BaseConfig-from camel.types import NOT_GIVEN, NotGivenclass SGLangConfig(BaseConfig):@@ -31,27 +30,27 @@ class SGLangConfig(BaseConfig):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:`1.0`)+ (default: :obj:`None`)top_p (float, optional): An alternative to sampling with temperature,called nucleus sampling, where the model considers the results ofthe tokens with top_p probability mass. So :obj:`0.1` means onlythe tokens comprising the top 10% probability mass are considered.- (default: :obj:`1.0`)+ (default: :obj:`None`)n (int, optional): How many chat completion choices to generate for- each input message. (default: :obj:`1`)+ each input message. (default: :obj:`None`)frequency_penalty (float, optional): Number between :obj:`-2.0` and:obj:`2.0`. Positive values penalize new tokens based on theirexisting frequency in the text so far, decreasing the model'slikelihood to repeat the same line verbatim. See more information- about frequency and presence penalties. (default: :obj:`0.0`)+ about frequency and presence penalties. (default: :obj:`None`)presence_penalty (float, optional): Number between :obj:`-2.0` and:obj:`2.0`. Positive values penalize new tokens based on whetherthey appear in the text so far, increasing the model's likelihoodto talk about new topics. See more information about frequency and- presence penalties. (default: :obj:`0.0`)+ presence penalties. (default: :obj:`None`)stream (bool, optional): Whether to stream the generated output inchunks. If set to `True`, the response will be streamed as it is- generated. (default: :obj:`False`)+ generated. (default: :obj:`None`)max_tokens (int, optional): The maximum number of tokens to generatein the chat completion. The total length of input tokens andgenerated tokens is limited by the model's context length.@@ -60,17 +59,17 @@ class SGLangConfig(BaseConfig):that the model can dynamically invoke. Each tool should bedefined as a dictionary following OpenAI's function callingspecification format. For more details, refer to the OpenAI- documentation.+ documentation. (default: :obj:`None`)"""- stop: Union[str, Sequence[str], NotGiven] = NOT_GIVEN- temperature: float = 1.0- top_p: float = 1.0- n: int = 1- frequency_penalty: float = 0.0- presence_penalty: float = 0.0- stream: bool = False- max_tokens: Union[int, NotGiven] = NOT_GIVEN+ stop: Optional[Union[str, Sequence[str]]] = None+ temperature: Optional[float] = None+ top_p: Optional[float] = None+ n: Optional[int] = None+ frequency_penalty: Optional[float] = None+ presence_penalty: Optional[float] = None+ stream: Optional[bool] = None+ max_tokens: Optional[int] = Nonetools: Optional[Union[List[Dict[str, Any]]]] = Nonediff --git a/camel/configs/siliconflow_config.py b/camel/configs/siliconflow_config.pyindex c2a76d4f2..5592d070e 100644--- a/camel/configs/siliconflow_config.py+++ b/camel/configs/siliconflow_config.py@@ -13,12 +13,12 @@# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========from __future__ import annotations-from typing import Any, Sequence, Type, Union+from typing import Any, Optional, Sequence, Type, Unionfrom pydantic import BaseModelfrom camel.configs.base_config import BaseConfig-from camel.types import NOT_GIVEN, NotGiven+from camel.types import NOT_GIVENclass SiliconFlowConfig(BaseConfig):@@ -27,15 +27,16 @@ class SiliconFlowConfig(BaseConfig):Args:temperature (float, optional): Determines the degree of randomness- in the response. (default: :obj:`0.7`)+ in the response. (default: :obj:`None`)top_p (float, optional): The top_p (nucleus) parameter is used todynamically adjust the number of choices for each predicted token- based on the cumulative probabilities. (default: :obj:`0.7`)- n (int, optional): Number of generations to return. (default::obj:`1`)+ based on the cumulative probabilities. (default: :obj:`None`)+ n (int, optional): Number of generations to return.+ (default: :obj:`None`)response_format (object, optional): An object specifying the format- that the model must output.+ that the model must output. (default: :obj:`None`)stream (bool, optional): If set, tokens are returned as Server-Sent- Events as they are made available. (default: :obj:`False`)+ Events as they are made available. (default: :obj:`None`)stop (str or list, optional): Up to :obj:`4` sequences where the APIwill stop generating further tokens. (default: :obj:`None`)max_tokens (int, optional): The maximum number of tokens to generate.@@ -44,21 +45,21 @@ class SiliconFlowConfig(BaseConfig)::obj:`2.0`. Positive values penalize new tokens based on theirexisting frequency in the text so far, decreasing the model'slikelihood to repeat the same line verbatim. See more information- about frequency and presence penalties. (default: :obj:`0.0`)+ about frequency and presence penalties. (default: :obj:`None`)tools (list[FunctionTool], optional): A list of tools the model maycall. Currently, only functions are supported as a tool. Use thisto provide a list of functions the model may generate JSON inputs- for. A max of 128 functions are supported.+ for. A max of 128 functions are supported. (default: :obj:`None`)"""- temperature: float = 0.7- top_p: float = 0.7- n: int = 1- stream: bool = False- stop: Union[str, Sequence[str], NotGiven] = NOT_GIVEN- max_tokens: Union[int, NotGiven] = NOT_GIVEN- response_format: Union[Type[BaseModel], dict, NotGiven] = NOT_GIVEN- frequency_penalty: float = 0.0+ temperature: Optional[float] = None+ top_p: Optional[float] = None+ n: Optional[int] = None+ stream: Optional[bool] = None+ stop: Optional[Union[str, Sequence[str]]] = None+ max_tokens: Optional[int] = None+ response_format: Optional[Union[Type[BaseModel], dict]] = None+ frequency_penalty: Optional[float] = Nonedef as_dict(self) -> dict[str, Any]:r"""Convert the current configuration to a dictionary.diff --git a/camel/configs/togetherai_config.py b/camel/configs/togetherai_config.pyindex eee197bb9..1a25e0a6c 100644--- a/camel/configs/togetherai_config.py+++ b/camel/configs/togetherai_config.py@@ -13,12 +13,11 @@# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========from __future__ import annotations-from typing import Any, Sequence, Union+from typing import Any, Optional, Sequence, Unionfrom pydantic import Fieldfrom camel.configs.base_config import BaseConfig-from camel.types import NOT_GIVEN, NotGivenclass TogetherAIConfig(BaseConfig):@@ -29,14 +28,14 @@ class TogetherAIConfig(BaseConfig):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:`0.2`)+ (default: :obj:`None`)top_p (float, optional): An alternative to sampling with temperature,called nucleus sampling, where the model considers the results ofthe tokens with top_p probability mass. So :obj:`0.1` means onlythe tokens comprising the top 10% probability mass are considered.- (default: :obj:`1.0`)+ (default: :obj:`None`)n (int, optional): How many chat completion choices to generate for- each input message. (default: :obj:`1`)+ each input message. (default: :obj:`None`)response_format (object, optional): An object specifying the formatthat the model must output. Compatible with GPT-4 Turbo and allGPT-3.5 Turbo models newer than gpt-3.5-turbo-1106. Setting to@@ -52,7 +51,7 @@ class TogetherAIConfig(BaseConfig):max context length.stream (bool, optional): If True, partial message deltas will be sentas data-only server-sent events as they become available.- (default: :obj:`False`)+ (default: :obj:`None`)stop (str or list, optional): Up to :obj:`4` sequences where the APIwill stop generating further tokens. (default: :obj:`None`)max_tokens (int, optional): The maximum number of tokens to generate@@ -63,12 +62,12 @@ class TogetherAIConfig(BaseConfig)::obj:`2.0`. Positive values penalize new tokens based on whetherthey appear in the text so far, increasing the model's likelihoodto talk about new topics. See more information about frequency and- presence penalties. (default: :obj:`0.0`)+ presence penalties. (default: :obj:`None`)frequency_penalty (float, optional): Number between :obj:`-2.0` and:obj:`2.0`. Positive values penalize new tokens based on theirexisting frequency in the text so far, decreasing the model'slikelihood to repeat the same line verbatim. See more information- about frequency and presence penalties. (default: :obj:`0.0`)+ about frequency and presence penalties. (default: :obj:`None`)logit_bias (dict, optional): Modify the likelihood of specified tokensappearing in the completion. Accepts a json object that maps tokens(specified by their token ID in the tokenizer) to an associated@@ -80,20 +79,20 @@ class TogetherAIConfig(BaseConfig):exclusive selection of the relevant token. (default: :obj:`{}`)user (str, optional): A unique identifier representing your end-user,which can help OpenAI to monitor and detect abuse.- (default: :obj:`""`)+ (default: :obj:`None`)"""- temperature: float = 0.2 # openai default: 1.0- top_p: float = 1.0- n: int = 1- stream: bool = False- stop: Union[str, Sequence[str], NotGiven] = NOT_GIVEN- max_tokens: Union[int, NotGiven] = NOT_GIVEN- presence_penalty: float = 0.0- response_format: Union[dict, NotGiven] = NOT_GIVEN- frequency_penalty: float = 0.0+ temperature: Optional[float] = None # openai default: 1.0+ top_p: Optional[float] = None+ n: Optional[int] = None+ stream: Optional[bool] = None+ stop: Optional[Union[str, Sequence[str]]] = None+ max_tokens: Optional[int] = None+ presence_penalty: Optional[float] = None+ response_format: Optional[dict] = None+ frequency_penalty: Optional[float] = Nonelogit_bias: dict = Field(default_factory=dict)- user: str = ""+ user: Optional[str] = Nonedef as_dict(self) -> dict[str, Any]:config_dict = super().as_dict()diff --git a/camel/configs/vllm_config.py b/camel/configs/vllm_config.pyindex b3d8fb842..b65b9373a 100644--- a/camel/configs/vllm_config.py+++ b/camel/configs/vllm_config.py@@ -18,7 +18,6 @@ from typing import Optional, Sequence, Unionfrom pydantic import Fieldfrom camel.configs.base_config import BaseConfig-from camel.types import NOT_GIVEN, NotGiven# flake8: noqa: E501@@ -32,14 +31,14 @@ class VLLMConfig(BaseConfig):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:`0.2`)+ (default: :obj:`None`)top_p (float, optional): An alternative to sampling with temperature,called nucleus sampling, where the model considers the results ofthe tokens with top_p probability mass. So :obj:`0.1` means onlythe tokens comprising the top 10% probability mass are considered.- (default: :obj:`1.0`)+ (default: :obj:`None`)n (int, optional): How many chat completion choices to generate for- each input message. (default: :obj:`1`)+ each input message. (default: :obj:`None`)response_format (object, optional): An object specifying the formatthat the model must output. Compatible with GPT-4 Turbo and allGPT-3.5 Turbo models newer than gpt-3.5-turbo-1106. Setting to@@ -55,7 +54,7 @@ class VLLMConfig(BaseConfig):max context length.stream (bool, optional): If True, partial message deltas will be sentas data-only server-sent events as they become available.- (default: :obj:`False`)+ (default: :obj:`None`)stop (str or list, optional): Up to :obj:`4` sequences where the APIwill stop generating further tokens. (default: :obj:`None`)max_tokens (int, optional): The maximum number of tokens to generate@@ -66,12 +65,12 @@ class VLLMConfig(BaseConfig)::obj:`2.0`. Positive values penalize new tokens based on whetherthey appear in the text so far, increasing the model's likelihoodto talk about new topics. See more information about frequency and- presence penalties. (default: :obj:`0.0`)+ presence penalties. (default: :obj:`None`)frequency_penalty (float, optional): Number between :obj:`-2.0` and:obj:`2.0`. Positive values penalize new tokens based on theirexisting frequency in the text so far, decreasing the model'slikelihood to repeat the same line verbatim. See more information- about frequency and presence penalties. (default: :obj:`0.0`)+ about frequency and presence penalties. (default: :obj:`None`)logit_bias (dict, optional): Modify the likelihood of specified tokensappearing in the completion. Accepts a json object that maps tokens(specified by their token ID in the tokenizer) to an associated@@ -80,10 +79,10 @@ class VLLMConfig(BaseConfig):The exact effect will vary per model, but values between:obj:` -1`and :obj:`1` should decrease or increase likelihood of selection;values like :obj:`-100` or :obj:`100` should result in a ban or- exclusive selection of the relevant token. (default: :obj:`{}`)+ exclusive selection of the relevant token. (default: :obj:`None`)user (str, optional): A unique identifier representing your end-user,which can help OpenAI to monitor and detect abuse.- (default: :obj:`""`)+ (default: :obj:`None`)logprobs: Whether to return log probabilities of the output tokens ornot. If true, returns the log probabilities of each output tokenreturned in the `logits` of `message`. (default: :obj:`None`)@@ -93,17 +92,17 @@ class VLLMConfig(BaseConfig):this parameter is used. (default: :obj:`None`)"""- temperature: float = 0.2 # openai default: 1.0- top_p: float = 1.0- n: int = 1- stream: bool = False- stop: Union[str, Sequence[str], NotGiven] = NOT_GIVEN- max_tokens: Union[int, NotGiven] = NOT_GIVEN- presence_penalty: float = 0.0- response_format: Union[dict, NotGiven] = NOT_GIVEN- frequency_penalty: float = 0.0+ temperature: Optional[float] = None # openai default: 1.0+ top_p: Optional[float] = None+ n: Optional[int] = None+ stream: Optional[bool] = None+ stop: Optional[Union[str, Sequence[str]]] = None+ max_tokens: Optional[int] = None+ presence_penalty: Optional[float] = None+ response_format: Optional[dict] = None+ frequency_penalty: Optional[float] = Nonelogit_bias: dict = Field(default_factory=dict)- user: str = ""+ user: Optional[str] = Nonelogprobs: Optional[bool] = Nonetop_logprobs: Optional[int] = Nonediff --git a/camel/configs/yi_config.py b/camel/configs/yi_config.pyindex 6873d6fc9..90778669d 100644--- a/camel/configs/yi_config.py+++ b/camel/configs/yi_config.py@@ -16,7 +16,6 @@ from __future__ import annotationsfrom typing import Optional, Unionfrom camel.configs.base_config import BaseConfig-from camel.types import NOT_GIVEN, NotGivenclass YiConfig(BaseConfig):@@ -37,22 +36,22 @@ class YiConfig(BaseConfig):max_tokens (int, optional): Specifies the maximum number of tokensthe model can generate. This sets an upper limit, but does notguarantee that this number will always be reached.- (default: :obj:`5000`)+ (default: :obj:`None`)top_p (float, optional): Controls the randomness of the generatedresults. Lower values lead to less randomness, while higher- values increase randomness. (default: :obj:`0.9`)+ values increase randomness. (default: :obj:`None`)temperature (float, optional): Controls the diversity and focus ofthe generated results. Lower values make the output more focused,while higher values make it more diverse. (default: :obj:`0.3`)stream (bool, optional): If True, enables streaming output.- (default: :obj:`False`)+ (default: :obj:`None`)"""tool_choice: Optional[Union[dict[str, str], str]] = None- max_tokens: Union[int, NotGiven] = NOT_GIVEN- top_p: float = 0.9- temperature: float = 0.3- stream: bool = False+ max_tokens: Optional[int] = None+ top_p: Optional[float] = None+ temperature: Optional[float] = None+ stream: Optional[bool] = NoneYI_API_PARAMS = {param for param in YiConfig.model_fields.keys()}diff --git a/camel/configs/zhipuai_config.py b/camel/configs/zhipuai_config.pyindex 5f1a11bef..a3b481a95 100644--- a/camel/configs/zhipuai_config.py+++ b/camel/configs/zhipuai_config.py@@ -16,7 +16,6 @@ from __future__ import annotationsfrom typing import Optional, Sequence, Unionfrom camel.configs.base_config import BaseConfig-from camel.types import NOT_GIVEN, NotGivenclass ZhipuAIConfig(BaseConfig):@@ -29,15 +28,15 @@ class ZhipuAIConfig(BaseConfig):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:`0.2`)+ (default: :obj:`None`)top_p (float, optional): An alternative to sampling with temperature,called nucleus sampling, where the model considers the results ofthe tokens with top_p probability mass. So :obj:`0.1` means onlythe tokens comprising the top 10% probability mass are considered.- (default: :obj:`0.6`)+ (default: :obj:`None`)stream (bool, optional): If True, partial message deltas will be sentas data-only server-sent events as they become available.- (default: :obj:`False`)+ (default: :obj:`None`)stop (str or list, optional): Up to :obj:`4` sequences where the APIwill stop generating further tokens. (default: :obj:`None`)max_tokens (int, optional): The maximum number of tokens to generate@@ -60,11 +59,11 @@ class ZhipuAIConfig(BaseConfig):are present."""- temperature: float = 0.2- top_p: float = 0.6- stream: bool = False- stop: Union[str, Sequence[str], NotGiven] = NOT_GIVEN- max_tokens: Union[int, NotGiven] = NOT_GIVEN+ temperature: Optional[float] = None+ top_p: Optional[float] = None+ stream: Optional[bool] = None+ stop: Optional[Union[str, Sequence[str]]] = None+ max_tokens: Optional[int] = Nonetool_choice: Optional[Union[dict[str, str], str]] = None