Skip to content

Commit 8bde001

Browse files
authored
Multiagentqna: simplify instructions and env setup (#103)
* simplify env setup Signed-off-by: alexsin368 <alex.sin@intel.com> * change VECTOR_STORE_DIR to writable /tmp folder Signed-off-by: alexsin368 <alex.sin@intel.com> * update tables and notes Signed-off-by: alexsin368 <alex.sin@intel.com> * remove typo Signed-off-by: alexsin368 <alex.sin@intel.com> * fix typo Signed-off-by: alexsin368 <alex.sin@intel.com> --------- Signed-off-by: alexsin368 <alex.sin@intel.com>
1 parent 6a9f7da commit 8bde001

5 files changed

Lines changed: 66 additions & 194 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Inference API Configuration
2+
# Note: model names must match one of the deployed models with Enterprise Inference.
3+
# INFERENCE_API_ENDPOINT: URL to your inference service (without /v1 suffix). Uncomment ONE of the below.
4+
# - For GenAI Gateway:
5+
#INFERENCE_API_ENDPOINT=https://api.example.com
6+
# - For APISIX Gateway (default), requires the model name in the URL path:
7+
INFERENCE_API_ENDPOINT=https://api.example.com/Llama-3.1-8B-Instruct
8+
9+
# INFERENCE_API_TOKEN: Authentication token/API key for the inference service
10+
# - For GenAI Gateway: Your GenAI Gateway API key
11+
# - For APISIX Gateway: Your APISIX authentication token
12+
INFERENCE_API_TOKEN=your-pre-generated-token-here
13+
14+
# Model Configuration
15+
# IMPORTANT: Use the full model name i.e. model card
16+
INFERENCE_MODEL_NAME=meta-llama/Llama-3.1-8B-Instruct
17+
EMBEDDING_MODEL_NAME=BAAI/bge-base-en-v1.5
18+
19+
# Embedding Model API (APISIX Gateway only)
20+
# Set only when using APISIX Gateway (default). Comment out for GenAI Gateway
21+
EMBEDDING_API_ENDPOINT=https://api.example.com/bge-base-en-v1.5
22+
23+
# Local URL Endpoint (only needed for non-public domains)
24+
# If using a local domain like api.example.com mapped to localhost:
25+
# Set this to: api.example.com (domain without https://)
26+
# If using a public domain, set any placeholder value like: not-needed
27+
LOCAL_URL_ENDPOINT=not-needed
28+
29+
# SSL Verification Settings
30+
# Set to false only for dev with self-signed certs
31+
VERIFY_SSL=true

sample_solutions/MultiAgentQnA/README.md

Lines changed: 33 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,25 @@ The application consists of:
105105
Before you begin, ensure you have the following installed:
106106

107107
- **Docker and Docker Compose**
108-
- **Enterprise inference endpoint access** (token-based authentication)
108+
- **Enterprise Inference endpoint access** (token-based authentication, see below for models and configs)
109+
110+
#### Deploy Required Models
111+
112+
See the table below for supported models, hardware, and gateway configuration.
113+
114+
| Model | Xeon w/APISIX/Keycloak | Xeon w/GenAI Gateway | Gaudi w/APISIX/Keycloak | Gaudi w/GenAI Gateway |
115+
|---|:---:|:---:|:---:|:---:|
116+
| **meta-llama/Llama-3.1-8B-Instruct** ||| ✅ Validated on Dell XE7740 | ✅ Validated on Dell XE7740 |
117+
| **Qwen/Qwen3-4B-Instruct-2507** | ✅ Validated on Dell XE7740 | ✅ Validated on Dell XE7740 |||
118+
119+
In addition, an embedding model must be deployed.
120+
| Model | Xeon w/APISIX/Keycloak | Xeon w/GenAI Gateway | Gaudi w/APISIX/Keycloak | Gaudi w/GenAI Gateway |
121+
|---|:---:|:---:|:---:|:---:|
122+
| **BAAI/bge-base-en-v1.5** | ✅ Validated on Dell XE7740 | ✅ Validated on Dell XE7740 | ✅ Validated on Dell XE7740 | ✅ Validated on Dell XE7740 |
109123

110124
### Required API Configuration
111125

112-
**For Inference Service:**
126+
**For LLM Inference and Embedding Services:**
113127

114128
This application supports multiple inference deployment patterns:
115129

@@ -119,35 +133,11 @@ This application supports multiple inference deployment patterns:
119133
- The API key is the litellm_master_key value from the generated vault.yml file
120134

121135
**APISIX Gateway**: Provide your APISIX Gateway URL and authentication token
122-
- URL format: https://api.example.com/bge-base-en-v1.5 (for embedding) and https://api.example.com/Llama-3.1-8B-Instruct (for inference)
136+
- URL format: https://api.example.com/Llama-3.1-8B-Instruct
123137
- Note: APISIX requires the model name in the URL path
124138
- To generate the APISIX authentication token, use the [generate-token.sh](https://github.com/opea-project/Enterprise-Inference/blob/main/core/scripts/generate-token.sh) script
125139
- The token is generated using Keycloak client credentials
126140

127-
Configuration requirements:
128-
- INFERENCE_API_ENDPOINT: URL to your inference service (example: https://api.example.com)
129-
- INFERENCE_API_TOKEN: Authentication token/API key for your chosen service
130-
- EMBEDDING_MODEL_NAME: Embedding model name (default: BAAI/bge-base-en-v1.5)
131-
- INFERENCE_MODEL_NAME: Inference model name (default: meta-llama/Llama-3.1-8B-Instruct)
132-
- EMBEDDING_API_ENDPOINT: (Optional, for APISIX only) URL with embedding model in path
133-
- INFERENCE_MODEL_ENDPOINT: (Optional, for APISIX only) URL with inference model in path
134-
135-
### Local Development Configuration
136-
137-
**For Local Testing Only**
138-
139-
If you're testing with a local inference endpoint using a custom domain (e.g., `api.example.com` mapped to localhost in your hosts file):
140-
141-
1. Edit `api/.env` and set:
142-
```bash
143-
LOCAL_URL_ENDPOINT=inference.example.com
144-
```
145-
(Use the domain name from your INFERENCE_API_ENDPOINT without `https://`)
146-
147-
2. This allows Docker containers to resolve your local domain correctly.
148-
149-
**Note:** For public domains or cloud-hosted endpoints, leave the default value `not-needed`.
150-
151141
### Verify Docker Installation
152142

153143
```bash
@@ -173,126 +163,29 @@ cd Enterprise-Inference/sample_solutions/MultiAgentQnA
173163

174164
### Set up the Environment
175165

176-
This application requires **two `.env` files** for proper configuration:
177-
178-
1. **Root `.env` file** (for Docker Compose variables)
179-
2. **`api/.env` file** (for backend application configuration)
180-
181-
#### Step 1: Create Root `.env` File
182-
183-
```bash
184-
# From the MultiAgentQnA directory
185-
cat > .env << EOF
186-
# Docker Compose Configuration
187-
LOCAL_URL_ENDPOINT=not-needed
188-
EOF
189-
```
190-
191-
**Note:** If using a local domain (e.g., `api.example.com` mapped to localhost), replace `not-needed` with your domain name (without `https://`).
192-
193-
#### Step 2: Create `api/.env` File
194-
195-
This application requires an `api/.env` file for proper configuration. Create it with the commands below:
166+
This application requires an `.env` file in the root directory for proper configuration. Create it using [.env.example](./.env.example) with the commands below:
196167

197168
```bash
198-
# Create the api/.env file
199-
cat > api/.env << EOF
200-
# Inference API Configuration
201-
# INFERENCE_API_ENDPOINT: URL to your inference service (without /v1 suffix)
202-
#
203-
# **GenAI Gateway**: Provide your GenAI Gateway URL and API key
204-
# - URL format: https://genai-gateway.example.com
205-
# - To generate the GenAI Gateway API key, use the [generate-vault-secrets.sh] script
206-
# - The API key is the litellm_master_key value from the generated vault.yml file
207-
#
208-
# **APISIX Gateway**: Provide your APISIX Gateway URL and authentication token
209-
# - For APISIX, include the model name in the INFERENCE_API_ENDPOINT path
210-
# - Example: https://apisix-gateway.example.com/Llama-3.1-8B-Instruct
211-
# - Set EMBEDDING_API_ENDPOINT separately for the embedding model
212-
# - Example: https://apisix-gateway.example.com/bge-base-en-v1.5
213-
# - To generate the APISIX authentication token, use the [generate-token.sh] script
214-
# - The token is generated using Keycloak client credentials
215-
#
216-
# INFERENCE_API_TOKEN: Authentication token/API key for the inference service
217-
INFERENCE_API_ENDPOINT=https://your-api.example.com/
218-
INFERENCE_API_TOKEN=your-pre-generated-token-here
219-
220-
# Model Configuration
221-
EMBEDDING_MODEL_NAME=BAAI/bge-base-en-v1.5
222-
INFERENCE_MODEL_NAME=meta-llama/Llama-3.1-8B-Instruct
223-
224-
# APISIX Gateway Endpoints
225-
# Uncomment and set these when using APISIX Gateway:
226-
# IMPORTANT: Use exact APISIX route paths:
227-
# Example routes: /bge-base-en-v1.5/* and /Llama-3.1-8B-Instruct/*
228-
# INFERENCE_API_ENDPOINT=https://api.example.com/Llama-3.1-8B-Instruct
229-
# EMBEDDING_API_ENDPOINT=https://api.example.com/bge-base-en-v1.5
230-
231-
# Local URL Endpoint (only needed for non-public domains)
232-
# If using a local domain like api.example.com mapped to localhost:
233-
# Set this to: api.example.com (domain without https://)
234-
# If using a public domain, set any placeholder value like: not-needed
235-
LOCAL_URL_ENDPOINT=not-needed
236-
237-
# SSL Verification Settings
238-
# Set to false only for dev with self-signed certs
239-
VERIFY_SSL=true
240-
EOF
241-
```
242-
243-
Or manually create `api/.env` with:
244-
245-
```bash
246-
# Inference API Configuration
247-
# INFERENCE_API_ENDPOINT: URL to your inference service (without /v1 suffix)
248-
#
249-
# **GenAI Gateway**: Provide your GenAI Gateway URL and API key
250-
# - URL format: https://genai-gateway.example.com
251-
# - To generate the GenAI Gateway API key, use the [generate-vault-secrets.sh] script
252-
# - The API key is the litellm_master_key value from the generated vault.yml file
253-
#
254-
# **APISIX Gateway**: Provide your APISIX Gateway URL and authentication token
255-
# - For APISIX, include the model name in the INFERENCE_API_ENDPOINT path
256-
# - Example: https://apisix-gateway.example.com/Llama-3.1-8B-Instruct
257-
# - Set EMBEDDING_API_ENDPOINT separately for the embedding model
258-
# - Example: https://apisix-gateway.example.com/bge-base-en-v1.5
259-
# - To generate the APISIX authentication token, use the [generate-token.sh] script
260-
# - The token is generated using Keycloak client credentials
261-
#
262-
# INFERENCE_API_TOKEN: Authentication token/API key for the inference service
263-
INFERENCE_API_ENDPOINT=https://your-api.example.com/
264-
INFERENCE_API_TOKEN=your-pre-generated-token-here
265-
266-
# Model Configuration
267-
EMBEDDING_MODEL_NAME=BAAI/bge-base-en-v1.5
268-
INFERENCE_MODEL_NAME=meta-llama/Llama-3.1-8B-Instruct
269-
270-
# APISIX Gateway Endpoints
271-
# Uncomment and set these when using APISIX Gateway:
272-
# IMPORTANT: Use exact APISIX route paths:
273-
# Example routes: /bge-base-en-v1.5/* and /Llama-3.1-8B-Instruct/*
274-
# INFERENCE_API_ENDPOINT=https://your-api-endpoint.com/Llama-3.1-8B-Instruct
275-
# EMBEDDING_API_ENDPOINT=https://your-api-endpoint.com/bge-base-en-v1.5
276-
277-
# Local URL Endpoint (only needed for non-public domains)
278-
# If using a local domain like api.example.com mapped to localhost:
279-
# Set this to: api.example.com (domain without https://)
280-
# If using a public domain, set any placeholder value like: not-needed
281-
LOCAL_URL_ENDPOINT=not-needed
282-
283-
# SSL Verification Settings
284-
# Set to false only for dev with self-signed certs
285-
VERIFY_SSL=true
169+
cp .env.example .env
286170
```
171+
Then modify it as needed, with special consideration to certain environment variables mentioned below. Read through the .env file for full instructions.
287172

288173
**Important Configuration Notes:**
289174

290-
- **INFERENCE_API_ENDPOINT**: Your actual inference service URL (replace `https://your-api-endpoint.com/deployment`)
291-
- For APISIX/Keycloak deployments, the model name must be included in the endpoint URL (e.g., `https://apisix-gateway.example.com/Llama-3.1-8B-Instruct`)
175+
- **INFERENCE_API_ENDPOINT**: Your actual inference service URL (replace `https://api.example.com`)
176+
- For APISIX/Keycloak deployments, the model name must be included in the endpoint URL (e.g., `https://api.example.com/Llama-3.1-8B-Instruct`)
292177
- **INFERENCE_API_TOKEN**: Your actual pre-generated authentication token
293-
- **LOCAL_URL_ENDPOINT**: Only needed if using local domain mapping (see [Local Development Configuration](#local-development-configuration))
294-
295-
**Note**: The docker-compose.yml file automatically loads environment variables from both `.env` (root) and `./api/.env` (backend) files.
178+
- **EMBEDDING_MODEL_NAME**, **INFERENCE_MODEL_NAME**: Use the exact model name from your inference service
179+
- To check available models: `curl https://api.example.com/v1/models -H "Authorization: Bearer your-token"`
180+
- **EMBEDDING_API_ENDPOINT** (APISIX only): Your actual embedding service URL. **Comment out** for GenAI Gateway
181+
- **LOCAL_URL_ENDPOINT**: Only needed if using local domain mapping (i.e. `api.example.com` mapped to localhost) for Docker containers to resolve correctly.
182+
- Use the domain name from INFERENCE_API_ENDPOINT without `https://`
183+
- For public domains or cloud-hosted endpoints, leave the default value `not-needed`
184+
- **VERIFY_SSL**: Controls SSL certificate verification (default: `true`)
185+
- Set to `false` only for development environments with self-signed certificates
186+
- Keep as `true` for production environments
187+
188+
**Note**: The docker-compose.yaml file automatically loads environment variables from `.env` for the backend service.
296189

297190
### Running the Application
298191

@@ -378,15 +271,3 @@ docker compose down
378271
For comprehensive troubleshooting guidance, common issues, and solutions, refer to:
379272

380273
[TROUBLESHOOTING.md](TROUBLESHOOTING.md)
381-
382-
---
383-
384-
## Additional Info
385-
386-
The following models have been validated with MultiAgentQnA:
387-
388-
| Model | Hardware |
389-
|-------|----------|
390-
| **meta-llama/Llama-3.1-8B-Instruct** | Gaudi |
391-
| **Qwen/Qwen3-4B-Instruct-2507** | Xeon |
392-
| **BAAI/bge-base-en-v1.5** (embeddings) | Gaudi |

sample_solutions/MultiAgentQnA/api/.env.example

Lines changed: 0 additions & 40 deletions
This file was deleted.

sample_solutions/MultiAgentQnA/api/services/rag_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
logger = logging.getLogger(__name__)
1717

1818
# Constants
19-
VECTOR_STORE_DIR = "./rag_index"
19+
VECTOR_STORE_DIR = "/tmp/rag_index"
2020
CHUNK_SIZE = 1000 # Characters per chunk
2121
CHUNK_OVERLAP = 200 # Overlap between chunks
2222

sample_solutions/MultiAgentQnA/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
ports:
99
- "5001:5001"
1010
env_file:
11-
- ./api/.env
11+
- .env
1212
volumes:
1313
- ./api:/app
1414
networks:

0 commit comments

Comments
 (0)