#function calling with decorators and nested schema

10 messages · Page 1 of 1 (latest)

wary wadi
#

Hi everyone,
I am trying to use the decorators and pass a pydantic schema for the arguments. When I do that, I will only get a response for top level parameters, but not for any nested parameters.

@user_proxy.register_for_execution() @destination_expert.register_for_llm(description="a categorized list of places to visit.") def get_destination_details(destination: DestinationSchema) -> DestinationSchema: print("get_destination_details results:") print(destination) return(destination)

So I have: Destination > Categories > Places
But I only get a response for fields in the Destination schema, not Categories or Places.

How can I get a response that includes data for the complete model?

shrewd pewter
#

@wooden rock

wooden rock
#

@wary wadi sorry for the late reply, I overlooked the message. Could you please share the definition of DestinationSchema class and the actual call suggestion?

wary wadi
#

Thanks @wooden rock, here are the schemas for Destination, Categories and Place:

`# Pydantic Schema for Place
class PlaceSchema(BaseModel):
placeType: str = Field(..., description="The type of the place")
placeName: str = Field(..., description="The name of the place")
placeDescription: str = Field(..., description="Description of the place")

Pydantic Schema for Category

class CategorySchema(BaseModel):
categoryName: str = Field(..., description="Name of the category")
categoryDescription: str = Field(..., description="Description of the category")
places: List[PlaceSchema] = Field(..., description="List of places")

Pydantic Schema for Destination

class DestinationSchema(BaseModel):
destinationLocationName: str = Field(..., description="Name of the destination location")
destinationTitle: Optional[str] = Field(..., description="Title for the destination")
destinationDescription: Optional[str] = Field(..., description="Description of the destination")
categories: List[CategorySchema] = Field(..., description="List of categories")`

wooden rock
#

which model do you use?

wary wadi
#

Snd this is the actual call suggetion:

***** Suggested function Call: get_destination_details ***** Arguments: { "destinationTitle": "Astoria", "destinationDescription": "Astoria, a charming neighborhood in Queens, New York, is known for its Greek cuisine, vibrant arts scene, and beautiful parks. It's a perfect destination for foodies, art lovers, and outdoor enthusiasts." } ************************************************************

Thanks for your help! I am not only new to Autogen, but to programming in general.

#

openai gpt4

wooden rock
#

@guido 🔝