bool) or that they are Pydantic objects.class OptionalFavFood(BaseModel):    """Either a food or null."""    food: Optional[str] = Field(        None,        description="Either the name of a food or null. Should be null if the food isn't known.",    )def record_person(name: str, age: int, fav_food: OptionalFavFood) -> str:    """Record some basic identifying information about a person.    Args:        name: The person's name.        age: The person's age in years.        fav_food: An OptionalFavFood object that either contains the person's favorite food or a null value. Food should be null if it's not known.    """    return f"Recording person {name} of age {age} with favorite food {fav_food.food}!"chain = create_openai_fn_chain([record_person], llm, prompt, verbose=True)chain.run(    "The most important thing to remember about Tommy, my 12 year old, is that he'll do anything for apple pie.")            > Entering new LLMChain chain...    Prompt after formatting:    System: You are a world class algorithm for recording entities.    Human: Make calls to the relevant function to record the entities in the following input: The most important thing to remember about Tommy, my 12 year old, is that he'll do anything for apple pie.    Human: Tip: Make sure to answer in the correct format        > Finished chain.    {'name': 'Tommy', 'age': 12, 'fav_food': {'food': 'apple pie'}}If we pass in multiple Python functions or OpenAI functions, then the returned output will be of the form:{"name": "<<function_name>>", "arguments": {<<function_arguments>>}}def record_dog(name: str, color: str, fav_food: OptionalFavFood) -> str:    """Record some basic identifying information about a dog.    Args:        name: The dog's name.        color: The dog's color.        fav_food: An OptionalFavFood object that either contains the dog's favorite food or a null value. Food should be null if it's not known.    """    return f"Recording dog {name} of color {color} with favorite food
This walkthrough demonstrates how to incorporate OpenAI function-calling API's in a chain. We'll go over:
This walkthrough demonstrates how to incorporate OpenAI function-calling API's in a chain. We'll go over: ->: bool) or that they are Pydantic objects.class OptionalFavFood(BaseModel):    """Either a food or null."""    food: Optional[str] = Field(        None,        description="Either the name of a food or null. Should be null if the food isn't known.",    )def record_person(name: str, age: int, fav_food: OptionalFavFood) -> str:    """Record some basic identifying information about a person.    Args:        name: The person's name.        age: The person's age in years.        fav_food: An OptionalFavFood object that either contains the person's favorite food or a null value. Food should be null if it's not known.    """    return f"Recording person {name} of age {age} with favorite food {fav_food.food}!"chain = create_openai_fn_chain([record_person], llm, prompt, verbose=True)chain.run(    "The most important thing to remember about Tommy, my 12 year old, is that he'll do anything for apple pie.")            > Entering new LLMChain chain...    Prompt after formatting:    System: You are a world class algorithm for recording entities.    Human: Make calls to the relevant function to record the entities in the following input: The most important thing to remember about Tommy, my 12 year old, is that he'll do anything for apple pie.    Human: Tip: Make sure to answer in the correct format        > Finished chain.    {'name': 'Tommy', 'age': 12, 'fav_food': {'food': 'apple pie'}}If we pass in multiple Python functions or OpenAI functions, then the returned output will be of the form:{"name": "<<function_name>>", "arguments": {<<function_arguments>>}}def record_dog(name: str, color: str, fav_food: OptionalFavFood) -> str:    """Record some basic identifying information about a dog.    Args:        name: The dog's name.        color: The dog's color.        fav_food: An OptionalFavFood object that either contains the dog's favorite food or a null value. Food should be null if it's not known.    """    return f"Recording dog {name} of color {color} with favorite food