cohere-python

Форк
0
55 строк · 1.9 Кб
1
# This file was auto-generated by Fern from our API Definition.
2

3
import datetime as dt
4
import typing
5

6
from ..core.datetime_utils import serialize_datetime
7
from .tool_parameter_definitions_value import ToolParameterDefinitionsValue
8

9
try:
10
    import pydantic.v1 as pydantic  # type: ignore
11
except ImportError:
12
    import pydantic  # type: ignore
13

14

15
class Tool(pydantic.BaseModel):
16
    name: str = pydantic.Field()
17
    """
18
    The name of the tool to be called. Valid names contain only the characters `a-z`, `A-Z`, `0-9`, `_` and must not begin with a digit.
19
    """
20

21
    description: str = pydantic.Field()
22
    """
23
    The description of what the tool does, the model uses the description to choose when and how to call the function.
24
    """
25

26
    parameter_definitions: typing.Optional[typing.Dict[str, ToolParameterDefinitionsValue]] = pydantic.Field(
27
        default=None
28
    )
29
    """
30
    The input parameters of the tool. Accepts a dictionary where the key is the name of the parameter and the value is the parameter spec. Valid parameter names contain only the characters `a-z`, `A-Z`, `0-9`, `_` and must not begin with a digit.
31
    
32
    ```
33
    {
34
      "my_param": {
35
        "description": <string>,
36
        "type": <string>, // any python data type, such as 'str', 'bool'
37
        "required": <boolean>
38
      }
39
    }
40
    ```
41
    """
42

43
    def json(self, **kwargs: typing.Any) -> str:
44
        kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
45
        return super().json(**kwargs_with_defaults)
46

47
    def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
48
        kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
49
        return super().dict(**kwargs_with_defaults)
50

51
    class Config:
52
        frozen = True
53
        smart_union = True
54
        extra = pydantic.Extra.allow
55
        json_encoders = {dt.datetime: serialize_datetime}
56

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.