Skip to content

Commit 255be9f

Browse files
authored
Merge pull request #65 from UiPath/fix/sample_llama_cloud
fix: llama cloud sample
2 parents da22624 + 6f3d6f6 commit 255be9f

4 files changed

Lines changed: 1778 additions & 1770 deletions

File tree

samples/quickstart-llamacloud/main.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import os
22

33
from dotenv import load_dotenv
4+
from llama_cloud_services import LlamaCloudIndex
45
from llama_index.core.agent.workflow import FunctionAgent
5-
from llama_index.indices.managed.llama_cloud import LlamaCloudIndex
66
from llama_index.llms.openai import OpenAI
7+
from pydantic import BaseModel, Field
78

89
load_dotenv()
910

@@ -129,6 +130,12 @@ def get_travel_recommendation(query: str) -> str:
129130
return f"Error generating travel recommendation: {str(e)}"
130131

131132

133+
class AgentResponse(BaseModel):
134+
response: str = Field(
135+
description="The agent's response using available tools to search company policies and personal preferences"
136+
)
137+
138+
132139
# Create the FunctionAgent with our tools
133140
agent = FunctionAgent(
134141
tools=[
@@ -137,6 +144,7 @@ def get_travel_recommendation(query: str) -> str:
137144
get_travel_recommendation,
138145
],
139146
llm=llm,
147+
output_cls=AgentResponse,
140148
system_prompt="""You are a helpful travel assistant that can search through company travel policies and personal preferences to provide comprehensive travel guidance.
141149
142150
You have access to three main functions:

samples/quickstart-llamacloud/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ authors = [{ name = "Tuana Celik", email = "tuana@runllama.ai" }]
66
readme = { file = "README.md", content-type = "text/markdown" }
77
requires-python = ">=3.10"
88
dependencies = [
9-
"uipath-llamaindex>=0.0.33",
9+
"uipath-llamaindex>=0.0.35",
1010
"llama-index-llms-openai>=0.2.2",
1111
"llama-cloud-services"
12-
]
12+
]
Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
{
2-
"entryPoints": [
3-
{
4-
"filePath": "agent",
5-
"uniqueId": "b2c345f2-86cd-4e4b-b2c0-625f64de97ec",
6-
"type": "agent",
7-
"input": {
8-
"type": "object",
9-
"properties": {
10-
"user_msg": {
11-
"title": "Travel Query",
12-
"type": "string",
13-
"description": "Your travel-related question or request (e.g., 'What are the travel rates for New York?', 'What are my travel preferences?', 'Give me travel recommendations for a business trip')"
14-
}
15-
},
16-
"required": [
17-
"query"
18-
]
19-
},
20-
"output": {
21-
"type": "object",
22-
"properties": {
23-
"response": {
24-
"title": "Agent Response",
25-
"type": "object",
26-
"description": "The agent's response using available tools to search company policies and personal preferences"
27-
}
28-
},
29-
"required": [
30-
"response"
31-
]
32-
}
2+
"entryPoints": [
3+
{
4+
"filePath": "agent",
5+
"uniqueId": "20074c23-0e8a-462b-8a49-b3985a61c59c",
6+
"type": "agent",
7+
"input": {
8+
"type": "object",
9+
"properties": {
10+
"user_msg": {
11+
"type": "string",
12+
"title": "Travel Query",
13+
"description": "Your travel-related question or request (e.g., 'What are the travel rates for New York?', 'What are my travel preferences?', 'Give me travel recommendations for a business trip')"
14+
}
15+
},
16+
"required": [
17+
"user_msg"
18+
]
19+
},
20+
"output": {
21+
"type": "object",
22+
"properties": {
23+
"response": {
24+
"description": "The agent's response using available tools to search company policies and personal preferences",
25+
"title": "Response",
26+
"type": "string"
27+
}
28+
},
29+
"required": [
30+
"response"
31+
]
32+
}
33+
}
34+
],
35+
"bindings": {
36+
"version": "2.0",
37+
"resources": []
3338
}
34-
],
35-
"bindings": {
36-
"version": "2.0",
37-
"resources": []
38-
}
39-
}
39+
}

0 commit comments

Comments
 (0)