File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,23 +105,29 @@ Both classes integrate seamlessly with LlamaIndex components:
105105### Using with Agents
106106
107107``` python
108- from llama_index.core.agent import ReActAgent
109- from llama_index.core.tools import FunctionTool
110- from uipath_llamaindex.llms import UiPathOpenAI
108+ import asyncio
109+ from llama_index.core.agent.workflow import ReActAgent
110+ from uipath_llamaindex.llms import UiPathOpenAI, OpenAIModel
111111
112112def multiply (a : int , b : int ) -> int :
113- """ Multiply two integers and returns the result. """
113+ """ Multiply two integers and returns the result integer """
114114 return a * b
115115
116- multiply_tool = FunctionTool.from_defaults(fn = multiply)
116+
117+ def add (a : int , b : int ) -> int :
118+ """ Add two integers and returns the result integer"""
119+ return a + b
117120
118121# Create agent with UiPath LLM
119- agent = ReActAgent.from_tools(
120- [multiply_tool],
121- llm = UiPathOpenAI(model = OpenAIModel.GPT_4O_2024_11_20 )
122- )
122+ agent = ReActAgent(
123+ tools = [multiply, add],
124+ llm = UiPathOpenAI(model = OpenAIModel.GPT_4O_2024_11_20 ))
125+
126+ async def main ():
127+ handler = agent.run(" What is 2+(2*4)?" )
128+ response = await handler
123129
124- response = agent.chat( " What is 21 multiplied by 2? " )
130+ asyncio.run(main() )
125131```
126132
127133### Using with VectorStoreIndex
You can’t perform that action at this time.
0 commit comments