/ schema.py
schema.py
 1  from pydantic import BaseModel
 2  from typing import List, Dict, Literal, Optional
 3  
 4  class FunctionCall(BaseModel):
 5      arguments: dict
 6      """
 7      The arguments to call the function with, as generated by the model in JSON
 8      format. Note that the model does not always generate valid JSON, and may
 9      hallucinate parameters not defined by your function schema. Validate the
10      arguments in your code before calling your function.
11      """
12  
13      name: str
14      """The name of the function to call."""
15  
16  class FunctionDefinition(BaseModel):
17      name: str
18      description: Optional[str] = None
19      parameters: Optional[Dict[str, object]] = None
20  
21  class FunctionSignature(BaseModel):
22      function: FunctionDefinition
23      type: Literal["function"]