Find answers from the community

Updated 7 months ago

guys i need some guide here:

guys i need some guide here:
i didn't understand this "The output is a valid Pydantic object that we can then use to call functions/APIs" in:
https://docs.llamaindex.ai/en/stable/examples/output_parsing/openai_pydantic_program/

i already returning the valid pydantic model from OpenAIPydanticProgram.from_defaults but i get lost where to use it, i wanna feed the generated dict to another agent so it can call a functions.
L
m
3 comments
It sounds like what you actually want is just an agent with tools?
Plain Text
from llama_index.core.tools import FunctionTool
from llama_index.llms.openai import OpenAI
from llama_index.agent.openai import OpenAIAgent


# define sample Tool
def multiply(a: int, b: int) -> int:
    """Multiple two integers and returns the result integer"""
    return a * b


multiply_tool = FunctionTool.from_defaults(fn=multiply)

# initialize llm
llm = OpenAI(model="gpt-3.5-turbo")

# initialize ReAct agent
agent = OpenAIAgent.from_tools([multiply_tool], llm=llm, verbose=True)
tnx u r my savior, i am still new to llamaIndex πŸ‘€
Add a reply
Sign up and join the conversation on Discord