|
11 | 11 | # See the License for the specific language governing permissions and
|
12 | 12 | # limitations under the License.
|
13 | 13 | # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
14 |
| -from typing import Optional |
| 14 | +from typing import Dict, Optional, Union |
15 | 15 |
|
16 | 16 | from camel.configs.base_config import BaseConfig
|
17 | 17 |
|
18 | 18 |
|
19 | 19 | class BedrockConfig(BaseConfig):
|
20 |
| - r"""Defines the parameters for generating chat completions using Bedrock |
| 20 | + r"""Defines the parameters for generating chat completions using OpenAI |
21 | 21 | compatibility.
|
22 | 22 |
|
23 | 23 | Args:
|
24 |
| - maxTokens (int, optional): The maximum number of tokens. |
25 |
| - temperatue (float, optional): Controls the randomness of the output. |
26 |
| - top_p (float, optional): Use nucleus sampling. |
| 24 | + max_tokens (int, optional): The maximum number of tokens to generate |
| 25 | + in the chat completion. The total length of input tokens and |
| 26 | + generated tokens is limited by the model's context length. |
| 27 | + (default: :obj:`None`) |
| 28 | + temperature (float, optional): Sampling temperature to use, between |
| 29 | + :obj:`0` and :obj:`2`. Higher values make the output more random, |
| 30 | + while lower values make it more focused and deterministic. |
| 31 | + (default: :obj:`None`) |
| 32 | + top_p (float, optional): An alternative to sampling with temperature, |
| 33 | + called nucleus sampling, where the model considers the results of |
| 34 | + the tokens with top_p probability mass. So :obj:`0.1` means only |
| 35 | + the tokens comprising the top 10% probability mass are considered. |
| 36 | + (default: :obj:`None`) |
27 | 37 | top_k (int, optional): The number of top tokens to consider.
|
| 38 | + stream (bool, optional): If True, partial message deltas will be sent |
| 39 | + as data-only server-sent events as they become available. |
| 40 | + (default: :obj:`None`) |
| 41 | + tools (list[FunctionTool], optional): A list of tools the model may |
| 42 | + call. Currently, only functions are supported as a tool. Use this |
| 43 | + to provide a list of functions the model may generate JSON inputs |
| 44 | + for. A max of 128 functions are supported. |
| 45 | + tool_choice (Union[dict[str, str], str], optional): Controls which (if |
| 46 | + any) tool is called by the model. :obj:`"none"` means the model |
| 47 | + will not call any tool and instead generates a message. |
| 48 | + :obj:`"auto"` means the model can pick between generating a |
| 49 | + message or calling one or more tools. :obj:`"required"` means the |
| 50 | + model must call one or more tools. Specifying a particular tool |
| 51 | + via {"type": "function", "function": {"name": "my_function"}} |
| 52 | + forces the model to call that tool. :obj:`"none"` is the default |
| 53 | + when no tools are present. :obj:`"auto"` is the default if tools |
| 54 | + are present. |
| 55 | + reasoning_effort(str, optional): A parameter specifying the level of |
| 56 | + reasoning used by certain model types. Valid values are :obj: |
| 57 | + `"low"`, :obj:`"medium"`, or :obj:`"high"`. If set, it is only |
| 58 | + applied to the model types that support it (e.g., :obj:`o1`, |
| 59 | + :obj:`o1mini`, :obj:`o1preview`, :obj:`o3mini`). If not provided |
| 60 | + or if the model type does not support it, this parameter is |
| 61 | + ignored. (default: :obj:`None`) |
28 | 62 | """
|
29 | 63 |
|
30 | 64 | max_tokens: Optional[int] = None
|
31 | 65 | temperature: Optional[float] = None
|
32 | 66 | top_p: Optional[float] = None
|
33 | 67 | top_k: Optional[int] = None
|
| 68 | + stream: Optional[bool] = None |
| 69 | + tool_choice: Optional[Union[Dict[str, str], str]] = None |
| 70 | + reasoning_effort: Optional[str] = None |
34 | 71 |
|
35 | 72 |
|
36 | 73 | BEDROCK_API_PARAMS = {param for param in BedrockConfig.model_fields.keys()}
|
0 commit comments