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

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.py
index 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 Field
from camel.configs.base_config import BaseConfig
-from camel.types import NOT_GIVEN, NotGiven
+from camel.types import NotGiven
class 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 to
dynamically 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.
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 API
will 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 their
existing frequency in the text so far, decreasing the model's
likelihood 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 whether
they appear in the text so far, increasing the model's likelihood
to 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 may
call. Currently, only functions are supported as a tool. Use this
to provide a list of functions the model may generate JSON inputs
for. A max of 128 functions are supported.
"""
- 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]] = None
logit_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] = None
AIML_API_PARAMS = {param for param in AIMLConfig.model_fields.keys()}
diff --git a/camel/configs/anthropic_config.py b/camel/configs/anthropic_config.py
index 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, Optional
from camel.configs.base_config import BaseConfig
-from camel.types import NotGiven
class AnthropicConfig(BaseConfig):
@@ -29,59 +28,58 @@ class AnthropicConfig(BaseConfig):
generate before stopping. Note that Anthropic models may stop
before reaching this maximum. This parameter only specifies the
absolute maximum number of tokens to generate.
- (default: :obj:`8192`)
+ (default: :obj:`None`)
stop_sequences (List[str], optional): Custom text sequences that will
cause the model to stop generating. The models will normally stop
when they have naturally completed their turn. If the model
encounters one of these custom sequences, the response will be
terminated and the stop_reason will be "stop_sequence".
- (default: :obj:`[]`)
+ (default: :obj:`None`)
temperature (float, optional): Amount of randomness injected into the
response. Defaults to 1. Ranges from 0 to 1. Use temp closer to 0
for analytical / multiple choice, and closer to 1 for creative
and 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, we
compute the cumulative distribution over all the options for each
subsequent token in decreasing probability order and cut it off
once 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 each
subsequent 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 describing
metadata about the request. Can include user_id as an external
identifier 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 enabling
Claude's extended thinking. When enabled, responses include
thinking 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 should
use the provided tools. The model can use a specific tool, any
available 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] = None
def as_dict(self) -> dict[str, Any]:
config_dict = super().as_dict()
# Create a list of keys to remove to avoid modifying dict
keys_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 enabled
thinking_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 is
diff --git a/camel/configs/cohere_config.py b/camel/configs/cohere_config.py
index 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 the
model can cite to generate a more accurate reply. Each document is
either 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. The
higher the value, the stronger a penalty is applied to previously
present 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. Similar
to `frequency_penalty`, except that this penalty is applied
equally 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 are
considered 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, with
total probability mass of `p`, are considered for generation at
each 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] = None
documents: Optional[list] = None
max_tokens: Optional[int] = None
stop_sequences: Optional[List[str]] = None
seed: 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] = None
COHERE_API_PARAMS = {param for param in CohereConfig().model_fields.keys()}
diff --git a/camel/configs/deepseek_config.py b/camel/configs/deepseek_config.py
index 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 the
generated 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 the
returned 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) as
they 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 where
the 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 they
appear 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 existing
frequency 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 may
call. Currently, only functions are supported as a tool. Use
this to provide a list of functions the model may generate JSON
@@ -70,31 +70,31 @@ class DeepSeekConfig(BaseConfig):
{"type": "function", "function": {"name": "my_function"}} forces
the model to call that tool. "none" is the default when no tools
are present. "auto" is the default if tools are present.
- (default: :obj:`"auto"`)
+ (default: :obj:`None`)
logprobs (bool, optional): Whether to return log probabilities of
the output tokens or not. If true, returns the log probabilities
of 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 specifying
the number of most likely tokens to return at each token
position, each with an associated log probability. logprobs
must 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] = None
stop: Optional[Union[str, Sequence[str]]] = None
max_tokens: Optional[int] = None
- presence_penalty: float = 0.0
+ presence_penalty: Optional[float] = None
response_format: Optional[Union[Type[BaseModel], dict]] = None
- frequency_penalty: float = 0.0
+ frequency_penalty: Optional[float] = None
tool_choice: Optional[Union[dict[str, str], str]] = None
- logprobs: bool = False
+ logprobs: Optional[bool] = None
top_logprobs: Optional[int] = None
def __init__(self, include_usage: bool = True, **kwargs):
diff --git a/camel/configs/gemini_config.py b/camel/configs/gemini_config.py
index 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 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:`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 format
that the model must output. Compatible with GPT-4 Turbo and all
GPT-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 sent
as 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 API
will 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] = None
stop: Optional[Union[str, Sequence[str]]] = None
max_tokens: Optional[int] = None
response_format: Optional[Union[Type[BaseModel], dict]] = None
diff --git a/camel/configs/groq_config.py b/camel/configs/groq_config.py
index 5cfaf88d9..61fd8d719 100644
--- a/camel/configs/groq_config.py
+++ b/camel/configs/groq_config.py
@@ -16,7 +16,6 @@ from __future__ import annotations
from typing import Optional, Sequence, Union
from camel.configs.base_config import BaseConfig
-from camel.types import NOT_GIVEN, NotGiven
class 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 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:`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 format
that the model must output. Compatible with GPT-4 Turbo and all
GPT-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 sent
as 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 API
will 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 whether
they appear in the text so far, increasing the model's likelihood
to 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 their
existing frequency in the text so far, decreasing the model's
likelihood 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 may
call. Currently, only functions are supported as a tool. Use this
to 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]] = None
GROQ_API_PARAMS = {param for param in GroqConfig.model_fields.keys()}
diff --git a/camel/configs/internlm_config.py b/camel/configs/internlm_config.py
index 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 of
the 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 the
generated 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 to
generate the maximum number of tokens.
- (default: :obj:`NOT_GIVEN`)
+ (default: :obj:`None`)
tools (list, optional): Specifies an array of tools that the model can
call. It can contain one or more tool objects. During a function
call 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] = None
max_tokens: Optional[int] = None
tool_choice: Optional[Union[dict[str, str], str]] = None
diff --git a/camel/configs/litellm_config.py b/camel/configs/litellm_config.py
index 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]] = None
diff --git a/camel/configs/mistral_config.py b/camel/configs/mistral_config.py
index 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 token
is 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 the
response.
tool_choice (str, optional): Controls which (if
@@ -58,9 +58,9 @@ class MistralConfig(BaseConfig):
max_tokens: Optional[int] = None
stop: Optional[Union[str, list[str]]] = None
random_seed: Optional[int] = None
- safe_prompt: bool = False
+ safe_prompt: Optional[bool] = None
response_format: Optional[Union[Dict[str, str], Any]] = None
- tool_choice: Optional[str] = "auto"
+ tool_choice: Optional[str] = None
@field_validator("response_format", mode="before")
@classmethod
diff --git a/camel/configs/moonshot_config.py b/camel/configs/moonshot_config.py
index 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 on
whether they appear in the text so far.
- (default: :obj:`0.0`)
+ (default: :obj:`None`)
frequency_penalty (float, optional): Penalty for new tokens based on
their frequency in the text so far.
- (default: :obj:`0.0`)
+ (default: :obj:`None`)
stop (Optional[Union[str, List[str]]], optional): Up to 4 sequences
where the API will stop generating further tokens.
(default: :obj:`None`)
"""
- temperature: float = 0.3
+ temperature: Optional[float] = None
max_tokens: Optional[int] = None
- stream: bool = False
+ stream: Optional[bool] = None
tools: 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] = None
stop: Optional[Union[str, List[str]]] = None
diff --git a/camel/configs/nvidia_config.py b/camel/configs/nvidia_config.py
index e90ea673f..385a5a319 100644
--- a/camel/configs/nvidia_config.py
+++ b/camel/configs/nvidia_config.py
@@ -18,7 +18,7 @@ from typing import List, Optional, Union
from pydantic import Field
from camel.configs.base_config import BaseConfig
-from camel.types import NOT_GIVEN, NotGiven
+from camel.types import NotGiven
class 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 on
whether 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 on
their 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 tokens
to 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.py
index 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, Union
from pydantic import BaseModel
from camel.configs.base_config import BaseConfig
-from camel.types import NOT_GIVEN, NotGiven
class 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 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:`1.0`)
+ (default: :obj:`None`)
response_format (object, optional): An object specifying the format
that the model must output. Compatible with GPT-4 Turbo and all
GPT-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 sent
as 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 API
will 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 whether
they appear in the text so far, increasing the model's likelihood
to 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 their
existing frequency in the text so far, decreasing the model's
likelihood 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] = None
OLLAMA_API_PARAMS = {param for param in OllamaConfig.model_fields.keys()}
diff --git a/camel/configs/openai_config.py b/camel/configs/openai_config.py
index 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 may
call. Currently, only functions are supported as a tool. Use this
to 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 is
ignored. (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] = None
diff --git a/camel/configs/openrouter_config.py b/camel/configs/openrouter_config.py
index 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 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`)
+ (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 format
that the model must output. Compatible with GPT-4 Turbo and all
GPT-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 sent
as 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 API
will 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 whether
they appear in the text so far, increasing the model's likelihood
to 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 their
existing frequency in the text so far, decreasing the model's
likelihood 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 may
call. Currently, only functions are supported as a tool. Use this
to provide a list of functions the model may generate JSON inputs
- for. A max of 128 functions are supported. (default: :obj: `None`)
+ for. A max of 128 functions are supported. (default: :obj:`None`)
tool_choice (Union[dict[str, str], str], optional): Controls which (if
any) tool is called by the model. :obj:`"none"` means the model
will not call any tool and instead generates a message.
@@ -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 default
when no tools are present. :obj:`"auto"` is the default if tools
- are present. (default: :obj: `None`)
+ are present. (default: :obj:`None`)
"""
temperature: Optional[float] = None
diff --git a/camel/configs/qwen_config.py b/camel/configs/qwen_config.py
index 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 and
focus of the generated results. Lower values make the output more
focused, while higher values make it more diverse.
- (default: :obj:`0.3`)
+ (default: :obj:`None`)
top_p (float, optional): Controls the diversity and focus of
the 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 repetition
content in the generated results. Positive values reduce the
repetition of content, while negative values increase it.
- (default: :obj:`0.0`)
+ (default: :obj:`None`)
response_format (Optional[Dict[str, str]], optional): Specifies the
format 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 to
include 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] = None
response_format: Optional[Dict[str, str]] = None
max_tokens: Optional[int] = None
seed: Optional[int] = None
diff --git a/camel/configs/reka_config.py b/camel/configs/reka_config.py
index 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 to
only 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 token
is 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 whether
they appear in the text so far, increasing the model's likelihood
to 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 their
existing frequency in the text so far, decreasing the model's
likelihood 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 search
engine 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] = None
stop: Optional[Union[str, list[str]]] = None
seed: 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] = None
def as_dict(self) -> dict[str, Any]:
config_dict = super().as_dict()
diff --git a/camel/configs/samba_config.py b/camel/configs/samba_config.py
index 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 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:`0.95`)
+ (default: :obj:`None`)
top_k (int, optional): Only sample from the top K options for each
subsequent token. Used to remove "long tail" low probability
responses.
- (default: :obj:`50`)
+ (default: :obj:`None`)
max_tokens (Optional[int], optional): The maximum number of tokens to
generate, e.g. 100.
- (default: :obj:`2048`)
+ (default: :obj:`None`)
repetition_penalty (Optional[float], optional): The parameter for
repetition penalty. 1.0 means no penalty.
- (default: :obj:`1.0`)
+ (default: :obj:`None`)
stop (Optional[Union[str,list[str]]]): Stop generation if this token
is detected. Or if one of these tokens is detected when providing
a string list.
- (default: :obj:`""`)
+ (default: :obj:`None`)
stream (Optional[bool]): If True, partial message deltas will be sent
as 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] = None
def as_dict(self) -> dict[str, Any]:
config_dict = super().as_dict()
diff --git a/camel/configs/sglang_config.py b/camel/configs/sglang_config.py
index fe5251935..37826e952 100644
--- a/camel/configs/sglang_config.py
+++ b/camel/configs/sglang_config.py
@@ -16,7 +16,6 @@ from __future__ import annotations
from typing import Any, Dict, List, Optional, Sequence, Union
from camel.configs.base_config import BaseConfig
-from camel.types import NOT_GIVEN, NotGiven
class 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 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:`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 their
existing frequency in the text so far, decreasing the model's
likelihood 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 whether
they appear in the text so far, increasing the model's likelihood
to 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 in
chunks. 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 generate
in the chat completion. The total length of input tokens and
generated 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 be
defined as a dictionary following OpenAI's function calling
specification 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] = None
tools: Optional[Union[List[Dict[str, Any]]]] = None
diff --git a/camel/configs/siliconflow_config.py b/camel/configs/siliconflow_config.py
index 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, Union
from pydantic import BaseModel
from camel.configs.base_config import BaseConfig
-from camel.types import NOT_GIVEN, NotGiven
+from camel.types import NOT_GIVEN
class 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 to
dynamically 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 API
will 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 their
existing frequency in the text so far, decreasing the model's
likelihood 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 may
call. Currently, only functions are supported as a tool. Use this
to provide a list of functions the model may generate JSON inputs
- for. A max of 128 functions are supported.
+ 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] = None
def 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.py
index 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, Union
from pydantic import Field
from camel.configs.base_config import BaseConfig
-from camel.types import NOT_GIVEN, NotGiven
class 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 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:`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 format
that the model must output. Compatible with GPT-4 Turbo and all
GPT-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 sent
as 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 API
will 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 whether
they appear in the text so far, increasing the model's likelihood
to 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 their
existing frequency in the text so far, decreasing the model's
likelihood 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 tokens
appearing 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] = None
logit_bias: dict = Field(default_factory=dict)
- user: str = ""
+ user: Optional[str] = None
def as_dict(self) -> dict[str, Any]:
config_dict = super().as_dict()
diff --git a/camel/configs/vllm_config.py b/camel/configs/vllm_config.py
index b3d8fb842..b65b9373a 100644
--- a/camel/configs/vllm_config.py
+++ b/camel/configs/vllm_config.py
@@ -18,7 +18,6 @@ from typing import Optional, Sequence, Union
from pydantic import Field
from 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 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:`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 format
that the model must output. Compatible with GPT-4 Turbo and all
GPT-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 sent
as 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 API
will 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 whether
they appear in the text so far, increasing the model's likelihood
to 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 their
existing frequency in the text so far, decreasing the model's
likelihood 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 tokens
appearing 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 or
not. If true, returns the log probabilities of each output token
returned 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] = None
logit_bias: dict = Field(default_factory=dict)
- user: str = ""
+ user: Optional[str] = None
logprobs: Optional[bool] = None
top_logprobs: Optional[int] = None
diff --git a/camel/configs/yi_config.py b/camel/configs/yi_config.py
index 6873d6fc9..90778669d 100644
--- a/camel/configs/yi_config.py
+++ b/camel/configs/yi_config.py
@@ -16,7 +16,6 @@ from __future__ import annotations
from typing import Optional, Union
from camel.configs.base_config import BaseConfig
-from camel.types import NOT_GIVEN, NotGiven
class YiConfig(BaseConfig):
@@ -37,22 +36,22 @@ class YiConfig(BaseConfig):
max_tokens (int, optional): Specifies the maximum number of tokens
the model can generate. This sets an upper limit, but does not
guarantee that this number will always be reached.
- (default: :obj:`5000`)
+ (default: :obj:`None`)
top_p (float, optional): Controls the randomness of the generated
results. 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 of
the 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] = None
YI_API_PARAMS = {param for param in YiConfig.model_fields.keys()}
diff --git a/camel/configs/zhipuai_config.py b/camel/configs/zhipuai_config.py
index 5f1a11bef..a3b481a95 100644
--- a/camel/configs/zhipuai_config.py
+++ b/camel/configs/zhipuai_config.py
@@ -16,7 +16,6 @@ from __future__ import annotations
from typing import Optional, Sequence, Union
from camel.configs.base_config import BaseConfig
-from camel.types import NOT_GIVEN, NotGiven
class 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 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:`0.6`)
+ (default: :obj:`None`)
stream (bool, optional): If True, partial message deltas will be sent
as 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 API
will 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] = None
tool_choice: Optional[Union[dict[str, str], str]] = None