You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project demonstrates how to integrate UiPath with LlamaIndex and LlamaCloud for document search and travel assistance workflows using a FunctionAgent.
4
+
5
+
## Overview
6
+
7
+
The Quickstart LlamaCloud Agent provides a FunctionAgent that can:
8
+
1. Search company travel policies and rates from the `company-policy` index
9
+
2. Search user's personal travel preferences from the `personal-preferences` index
10
+
3. Generate comprehensive travel recommendations combining both sources
11
+
4. Deploy as a UiPath agent for automation workflows
12
+
13
+
## Features
14
+
15
+
-**FunctionAgent Architecture**: Uses LlamaIndex's FunctionAgent for intelligent tool selection
16
+
-**Dual Index Search**: Searches both company policies and personal preferences
17
+
-**Smart Tool Selection**: Automatically chooses the right tools based on user queries
18
+
-**Comprehensive Travel Guidance**: Combines policy and preference information
19
+
-**UiPath Integration**: Ready for deployment to UiPath Cloud
20
+
21
+
## Prerequisites
22
+
23
+
- Python 3.10+
24
+
- UiPath Cloud account
25
+
- OpenAI API key
26
+
- LlamaCloud account with API access
27
+
28
+
## Setup
29
+
30
+
31
+
### 1. Set Up Virtual Environment
32
+
33
+
We recommend using `uv` for package management:
34
+
35
+
```bash
36
+
# Initialize a new uv project
37
+
uv init .
38
+
39
+
# Create and activate virtual environment
40
+
uv venv
41
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
42
+
```
43
+
44
+
Alternatively, use `pip`:
45
+
46
+
```bash
47
+
# Create virtual environment
48
+
python -m venv .venv
49
+
50
+
# Activate virtual environment
51
+
# On Windows PowerShell: .venv\Scripts\Activate.ps1
52
+
# On Windows CMD: .venv\Scripts\activate
53
+
# On macOS/Linux: source .venv/bin/activate
54
+
source .venv/bin/activate
55
+
56
+
# Upgrade pip
57
+
python -m pip install --upgrade pip
58
+
```
59
+
60
+
### 2. Install Dependencies
61
+
62
+
```bash
63
+
# Install the project dependencies
64
+
pip install -e .
65
+
```
66
+
67
+
### 3. Configure Environment Variables
68
+
69
+
```bash
70
+
# Copy the example environment file
71
+
cp .env.example .env
72
+
73
+
# Edit .env with your actual API keys and configuration
74
+
```
75
+
76
+
Required environment variables:
77
+
-`OPENAI_API_KEY`: Your OpenAI API key
78
+
-`LLAMACLOUD_API_KEY`: Your LlamaCloud API key
79
+
-`LLAMACLOUD_ORG_ID`: Your LlamaCloud organization ID
80
+
-`LLAMACLOUD_PROJECT_NAME`: Your LlamaCloud project name
81
+
-`LLAMACLOUD_INDEX_1_NAME`: First index name (e.g., "company_policy")
82
+
-`LLAMACLOUD_INDEX_2_NAME`: Second index name (e.g., "personal_preferences")
83
+
84
+
### 4. Configure LlamaCloud Indexes
85
+
86
+
- Set up your indexes in LlamaCloud with the names specified in your `.env` file
87
+
- You can drag and drop the files in `/sample_data` into the relevant indexes
88
+
- Update the project name and organization ID in your `.env` file
89
+
- Ensure your API key has access to the specified indexes
90
+
91
+
## Available Functions
92
+
93
+
The agent has access to three main functions:
94
+
95
+
### 1. `search_company_policy(query: str)`
96
+
Searches the company policy index for travel rates, guidelines, and company policies.
97
+
-**Use case**: "What are the travel rates for New York?"
98
+
-**Returns**: Company policy information with source files and relevance scores
99
+
100
+
### 2. `search_personal_preferences(query: str)`
101
+
Searches the personal preferences index for user's travel preferences and requirements.
102
+
-**Use case**: "What are my travel preferences?"
103
+
-**Returns**: Personal preference information with source files and relevance scores
104
+
105
+
### 3. `get_travel_recommendation(query: str)`
106
+
Generates comprehensive travel recommendations combining both company policies and personal preferences.
107
+
-**Use case**: "Give me travel recommendations for a business trip"
108
+
-**Returns**: Combined analysis from both indexes
109
+
110
+
## Usage
111
+
112
+
### Local Testing
113
+
114
+
115
+
#### Using UiPath CLI (Recommended)
116
+
117
+
```bash
118
+
# Run the agent with a query
119
+
uipath run agent '{"query": "What are the travel rates for New York?"}'
120
+
```
121
+
122
+
#### Option 3: Using Input File
123
+
124
+
Create an `input.json` file:
125
+
126
+
```json
127
+
{
128
+
"user_msg": "What are the travel rates for California?"
129
+
}
130
+
```
131
+
132
+
133
+
### UiPath Deployment
134
+
135
+
1.**Authenticate with UiPath:**
136
+
```bash
137
+
uipath auth
138
+
```
139
+
140
+
2.**Package your project:**
141
+
```bash
142
+
uipath pack
143
+
```
144
+
145
+
3.**Publish to UiPath Cloud:**
146
+
```bash
147
+
uipath publish --my-workspace
148
+
```
149
+
150
+
4.**Invoke the agent:**
151
+
```bash
152
+
uipath invoke agent '{"user_msg": "What are the travel rates for New York?"}'
153
+
```
154
+
155
+
156
+
## Example Queries
157
+
158
+
- "What are the travel rates for California?"
159
+
- "What are my travel preferences?"
160
+
- "Give me travel recommendations for a business trip to New York"
system_prompt="""You are a helpful travel assistant that can search through company travel policies and personal preferences to provide comprehensive travel guidance.
138
+
139
+
You have access to three main functions:
140
+
1. search_company_policy - Search for company travel rates, guidelines, and policies
141
+
2. search_personal_preferences - Search for user's personal travel preferences and requirements
142
+
3. get_travel_recommendation - Get comprehensive travel recommendations combining both sources
143
+
144
+
Use these tools to help users with travel-related queries, ensuring you provide accurate information from both company policies and personal preferences when relevant."""
0 commit comments