You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
978 B
42 lines
978 B
from pydantic import BaseModel, Field
|
|
from typing import List
|
|
|
|
|
|
class FunctionSchema(BaseModel):
|
|
name: str = Field(
|
|
...,
|
|
title="Name",
|
|
description="The name of the function.",
|
|
)
|
|
description: str = Field(
|
|
...,
|
|
title="Description",
|
|
description="The description of the function.",
|
|
)
|
|
parameters: BaseModel = Field(
|
|
...,
|
|
title="Parameters",
|
|
description="The parameters of the function.",
|
|
)
|
|
|
|
|
|
class OpenAIFunctionCallSchema(BaseModel):
|
|
"""
|
|
Represents the schema for an OpenAI function call.
|
|
|
|
Attributes:
|
|
type (str): The type of the function.
|
|
function (List[FunctionSchema]): The function to call.
|
|
"""
|
|
|
|
type: str = Field(
|
|
"function",
|
|
title="Type",
|
|
description="The type of the function.",
|
|
)
|
|
function: List[FunctionSchema] = Field(
|
|
...,
|
|
title="Function",
|
|
description="The function to call.",
|
|
)
|