|
117 | 117 | " description=\"List of message parts that make up the message content.\")\n", |
118 | 118 | "\n", |
119 | 119 | " class Config:\n", |
120 | | - " extra = \"allow\"\n", |
121 | | - "\n", |
122 | | - "class ToolType(str, Enum):\n", |
123 | | - " FUNCTION = \"function\"\n", |
124 | | - " CUSTOM = \"custom\"\n", |
125 | | - "\n", |
126 | | - "class ToolDefinition(BaseModel):\n", |
127 | | - " \"\"\"\n", |
128 | | - " Represents a tool definition.\n", |
129 | | - " \"\"\"\n", |
130 | | - " type: Union[ToolType, str] = Field(description=\"Type of the tool.\")\n", |
131 | | - " name: str = Field(description=\"Name of the tool.\")\n", |
132 | | - " description: str = Field(description=\"Description of the tool.\")\n", |
133 | | - " parameters: Any = Field(description=\"Format of the tool parameters. Maybe it is a JSON schema.\")\n", |
134 | | - " response: Any = Field(description=\"Format of the tool response. Maybe it is a JSON schema.\")\n", |
135 | | - "\n", |
136 | | - " class Config:\n", |
137 | | - " extra = \"allow\"\n" |
| 120 | + " extra = \"allow\"" |
138 | 121 | ] |
139 | 122 | }, |
140 | 123 | { |
|
156 | 139 | "metadata": {}, |
157 | 140 | "outputs": [], |
158 | 141 | "source": [ |
| 142 | + "class ToolType(str, Enum):\n", |
| 143 | + " FUNCTION = \"function\"\n", |
| 144 | + " CUSTOM = \"custom\"\n", |
| 145 | + "\n", |
| 146 | + "class JSONSchema(BaseModel):\n", |
| 147 | + " \"\"\"\n", |
| 148 | + " Represents a JSON schema to define the format of the tool parameters or response.\n", |
| 149 | + " \"\"\"\n", |
| 150 | + " type: str = Field(description=\"Type of the overall data.\")\n", |
| 151 | + "\n", |
| 152 | + " class Config:\n", |
| 153 | + " extra = \"allow\"\n", |
| 154 | + "\n", |
| 155 | + "class ToolDefinition(BaseModel):\n", |
| 156 | + " \"\"\"\n", |
| 157 | + " Represents a tool definition.\n", |
| 158 | + " \"\"\"\n", |
| 159 | + " type: Union[ToolType, str] = Field(description=\"Type of the tool.\")\n", |
| 160 | + " name: str = Field(description=\"Name of the tool.\")\n", |
| 161 | + " description: str = Field(description=\"Description of the tool.\")\n", |
| 162 | + " parameters: Optional[Union[JSONSchema, Any]] = Field(\n", |
| 163 | + " description=(\n", |
| 164 | + " \"Format of the tool parameters the function expects. \"\n", |
| 165 | + " \"The RECOMMENDED data type is JSON Schema. \"\n", |
| 166 | + " )\n", |
| 167 | + " )\n", |
| 168 | + " response: Optional[Union[JSONSchema, Any]] = Field(\n", |
| 169 | + " description=(\n", |
| 170 | + " \"Format of the tool response the function returns. \"\n", |
| 171 | + " \"The RECOMMENDED data type is JSON Schema. \"\n", |
| 172 | + " )\n", |
| 173 | + " )\n", |
| 174 | + "\n", |
| 175 | + " class Config:\n", |
| 176 | + " extra = \"allow\"\n", |
| 177 | + "\n", |
159 | 178 | "class InputMessages(RootModel[List[ChatMessage]]):\n", |
160 | 179 | " \"\"\"\n", |
161 | 180 | " Represents the list of input messages sent to the model.\n", |
|
0 commit comments