Skip to content

Commit d793701

Browse files
authored
Docugen-Microagents: simplify instructions and env setup (#106)
* simplify env setup Signed-off-by: alexsin368 <alex.sin@intel.com> * update table, fix typo Signed-off-by: alexsin368 <alex.sin@intel.com> * add note on --enable-auto-tool-choice, fix inference endpoint Signed-off-by: alexsin368 <alex.sin@intel.com> * update note Signed-off-by: alexsin368 <alex.sin@intel.com> --------- Signed-off-by: alexsin368 <alex.sin@intel.com>
1 parent 94d529b commit d793701

4 files changed

Lines changed: 108 additions & 262 deletions

File tree

Lines changed: 80 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,85 @@
1-
# Docker Compose Configuration
1+
# API Configuration
2+
BACKEND_PORT=8000
3+
FRONTEND_PORT=3000
4+
5+
# ==========================================
6+
# Inference API Configuration
7+
# ==========================================
8+
# Note: model names must match one of the deployed models with Enterprise Inference.
9+
# INFERENCE_API_ENDPOINT: URL to your inference service (without /v1 suffix). Uncomment ONE of the below.
10+
# - For GenAI Gateway:
11+
#INFERENCE_API_ENDPOINT=https://api.example.com
12+
# - For APISIX Gateway (default), requires the model name in the URL path:
13+
INFERENCE_API_ENDPOINT=https://api.example.com/Qwen3-4B-Instruct-2507
14+
15+
# INFERENCE_API_TOKEN: Authentication token/API key for the inference service
16+
# - For GenAI Gateway: Your GenAI Gateway API key
17+
# - For APISIX Gateway: Your APISIX authentication token
18+
INFERENCE_API_TOKEN=your-pre-generated-token-here
219

3-
# Local URL Endpoint (only needed for non-public domains)
20+
# ==========================================
21+
# Docker Network Configuration
22+
# ==========================================
423
# If using a local domain like api.example.com mapped to localhost, set to the domain without https://
524
# Otherwise, set to: not-needed
625
LOCAL_URL_ENDPOINT=not-needed
726

8-
BACKEND_PORT=8000
9-
FRONTEND_PORT=3000
27+
# ==========================================
28+
# Micro-Agent Model Configuration
29+
# ==========================================
30+
# All agents use Qwen3-4B-Instruct (optimized SLM for code analysis)
31+
# You can customize individual agent models if needed
32+
33+
CODE_EXPLORER_MODEL=Qwen/Qwen3-4B-Instruct-2507
34+
API_REFERENCE_MODEL=Qwen/Qwen3-4B-Instruct-2507
35+
CALL_GRAPH_MODEL=Qwen/Qwen3-4B-Instruct-2507
36+
ERROR_ANALYSIS_MODEL=Qwen/Qwen3-4B-Instruct-2507
37+
ENV_CONFIG_MODEL=Qwen/Qwen3-4B-Instruct-2507
38+
DEPENDENCY_ANALYZER_MODEL=Qwen/Qwen3-4B-Instruct-2507
39+
PLANNER_MODEL=Qwen/Qwen3-4B-Instruct-2507
40+
MERMAID_MODEL=Qwen/Qwen3-4B-Instruct-2507
41+
QA_VALIDATOR_MODEL=Qwen/Qwen3-4B-Instruct-2507
42+
WRITER_MODEL=Qwen/Qwen3-4B-Instruct-2507
43+
44+
# ==========================================
45+
# Repository Analysis Limits
46+
# ==========================================
47+
# All limits are configurable to suit your needs
48+
TEMP_REPO_DIR=./tmp/repos
49+
MAX_REPO_SIZE=10737418240 # 10GB in bytes
50+
MAX_FILE_SIZE=1000000 # 1MB in bytes
51+
MAX_FILES_TO_SCAN=500 # Maximum number of files to analyze
52+
MAX_LINES_PER_FILE=500 # Line budget per file (pattern_window strategy extracts ~150-300 lines focusing on key patterns)
53+
54+
# ==========================================
55+
# Agent Execution Settings
56+
# ==========================================
57+
AGENT_TEMPERATURE=0.7 # Model temperature (0.0-1.0)
58+
AGENT_MAX_TOKENS=1000 # Maximum tokens per agent response
59+
AGENT_TIMEOUT=300 # Agent timeout in seconds (5 minutes)
60+
61+
# ==========================================
62+
# GitHub Integration (MCP)
63+
# ==========================================
64+
# Required for automatic PR creation
65+
# Generate token at: https://github.com/settings/tokens
66+
# Required scopes: repo (full access to repositories)
67+
GITHUB_TOKEN=your_github_personal_access_token_here
68+
69+
# ==========================================
70+
# Server Configuration
71+
# ==========================================
72+
API_PORT=5001
73+
HOST=0.0.0.0
74+
75+
# ==========================================
76+
# CORS Settings
77+
# ==========================================
78+
# Add your frontend URL if different from defaults
79+
CORS_ORIGINS=["http://localhost:3000", "http://localhost:3001", "http://localhost:5173"]
80+
81+
# ==========================================
82+
# Security Configuration
83+
# ==========================================
84+
# SSL Verification: Set to false only for development with self-signed certificates
85+
VERIFY_SSL=true

sample_solutions/Docugen-Microagents/README.md

Lines changed: 27 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -238,17 +238,19 @@ Before you begin, ensure you have the following installed:
238238

239239
- **Docker and Docker Compose** (required for running the application containers)
240240
- **Docker daemon running** (required for PR Agent's GitHub MCP server container)
241-
- **Enterprise inference endpoint access** (token-based authentication)
241+
- **Enterprise Inference endpoint access** (token-based authentication, see below for models and configs)
242242

243-
### Required Model
243+
#### Deploy Required Models
244244

245-
This application requires the following model to be deployed on your inference endpoint:
245+
See the table below for supported models, hardware, and gateway configuration.
246246

247-
- **Qwen/Qwen3-4B-Instruct-2507** - Small language model optimized for Intel Xeon processors with 8K context window
247+
| Model | Xeon w/APISIX/Keycloak | Xeon w/GenAI Gateway | Gaudi w/APISIX/Keycloak | Gaudi w/GenAI Gateway |
248+
|---|:---:|:---:|:---:|:---:|
249+
| **Qwen/Qwen3-4B-Instruct-2507** | ✅ Validated on Dell XE7740 | ✅ Validated on Dell XE7740 | ✅ Validated on Dell XE7740 | ✅ Validated on Dell XE7740 |
248250

249-
All nine AI agents (Code Explorer, API Reference, Call Graph, Error Analysis, Environment Config, Dependency Analyzer, Planner, Mermaid Generator, and QA Validator) use this model for efficient documentation generation.
251+
>**Note** When deploying, the model must have the `--enable-auto-tool-choice` and `--tool-call-parser "hermes"` arguments for the AI agents to use the model endpoint. On Xeon deployments, it is included, but on Gaudi it is not (as of Enterprise Inference release v1.4.0). This needs to be added into the core/helm-charts/vllm folder's `gaudi3_values.yaml` or `gaudi-values.yaml` as a new model config before deploying the model. If the model config is already there, disregard this note.
250252
251-
**Note:** This model must be available through your GenAI Gateway or APISIX Gateway deployment before running the application.
253+
All nine AI agents (Code Explorer, API Reference, Call Graph, Error Analysis, Environment Config, Dependency Analyzer, Planner, Mermaid Generator, and QA Validator) use this model for efficient documentation generation.
252254

253255
### Required API Configuration
254256

@@ -257,36 +259,15 @@ All nine AI agents (Code Explorer, API Reference, Call Graph, Error Analysis, En
257259
This application supports multiple inference deployment patterns:
258260

259261
**GenAI Gateway**: Provide your GenAI Gateway URL and API key
260-
- **URL format**: `https://api.example.com`
261-
- To generate the GenAI Gateway API key, use the [generate-vault-secrets.sh](https://github.com/opea-project/Enterprise-Inference/blob/main/core/scripts/generate-vault-secrets.sh) script
262-
- The API key is the `litellm_master_key` value from the generated `vault.yml` file
262+
- URL format: https://api.example.com
263+
- To generate the GenAI Gateway API key, use the [generate-vault-secrets.sh](https://github.com/opea-project/Enterprise-Inference/blob/main/core/scripts/generate-vault-secrets.sh) script
264+
- The API key is the litellm_master_key value from the generated vault.yml file
263265

264266
**APISIX Gateway**: Provide your APISIX Gateway URL and authentication token
265-
- **URL format**: `https://api.example.com/Qwen3-4B-Instruct`
266-
- **Note**: APISIX requires the model name in the URL path (without company/family prefixes)
267-
- 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
268-
- The token is generated using Keycloak client credentials
269-
270-
**Configuration requirements:**
271-
- **INFERENCE_API_ENDPOINT**: URL to your inference service (example: `https://api.example.com`)
272-
- **INFERENCE_API_TOKEN**: Authentication token/API key for your chosen service
273-
274-
275-
### Local Development Configuration
276-
277-
**For Local Testing Only (Optional)**
278-
279-
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):
280-
281-
1. Edit `api/.env` and set:
282-
```bash
283-
LOCAL_URL_ENDPOINT=api.example.com
284-
```
285-
(Use the domain name from your INFERENCE_API_ENDPOINT without `https://`)
286-
287-
2. This allows Docker containers to resolve your local domain correctly.
288-
289-
**Note:** For public domains or cloud-hosted endpoints, leave the default value `not-needed`.
267+
- URL format: https://api.example.com/Llama-3.1-8B-Instruct
268+
- Note: APISIX requires the model name in the URL path
269+
- 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
270+
- The token is generated using Keycloak client credentials
290271

291272
### GitHub Personal Access Token (Optional)
292273

@@ -323,152 +304,27 @@ cd Enterprise-Inference/sample_solutions/Docugen-Microagents
323304

324305
### Set up the Environment
325306

326-
This application requires **two `.env` files** for proper configuration:
327-
328-
1. **Root `.env` file** (for Docker Compose variables)
329-
2. **`api/.env` file** (for backend application configuration)
330-
331-
#### Step 1: Create Root `.env` File
332-
333-
```bash
334-
# From the Docugen-Microagents directory
335-
cat > .env << EOF
336-
# Docker Compose Configuration
337-
338-
# Local URL Endpoint (only needed for non-public domains)
339-
# If using a local domain like api.example.com mapped to localhost, set to the domain without https://
340-
# Otherwise, set to: not-needed
341-
LOCAL_URL_ENDPOINT=not-needed
342-
343-
BACKEND_PORT=8000
344-
FRONTEND_PORT=3000
345-
346-
EOF
347-
```
348-
349-
OR
350-
351-
Copy from the example file and edit with your credentials as required.
307+
This application requires an `.env` file in the root directory for proper configuration. Create it using [.env.example](./.env.example) with the commands below:
352308

353309
```bash
354310
cp .env.example .env
355311
```
356-
357-
**Note:** If using a local domain (e.g., `api.example.com` mapped to localhost), replace `not-needed` with your domain name (without `https://`).
358-
359-
#### Step 2: Create `api/.env` File
360-
361-
Copy from the example file and edit with your actual credentials:
362-
363-
```bash
364-
cp api/.env.example api/.env
365-
```
366-
367-
Then edit `api/.env` to set your `INFERENCE_API_ENDPOINT` and `INFERENCE_API_TOKEN`.
368-
369-
Or manually create `api/.env` with:
370-
371-
```bash
372-
# ==========================================
373-
# Inference API Configuration
374-
# ==========================================
375-
# INFERENCE_API_ENDPOINT: URL to your inference service (without /v1 suffix)
376-
#
377-
# **GenAI Gateway**: Provide your GenAI Gateway URL and API key
378-
# - URL format: https://genai-gateway.example.com
379-
# - To generate the GenAI Gateway API key, use the [generate-vault-secrets.sh] script
380-
# - The API key is the litellm_master_key value from the generated vault.yml file
381-
#
382-
# **APISIX Gateway**: Provide your APISIX Gateway URL and authentication token
383-
# - For APISIX, include the model name in the INFERENCE_API_ENDPOINT path
384-
# - Example: https://apisix-gateway.example.com/Qwen3-4B-Instruct
385-
# - To generate the APISIX authentication token, use the [generate-token.sh] script
386-
# - The token is generated using Keycloak client credentials
387-
#
388-
# INFERENCE_API_TOKEN: Authentication token/API key for the inference service
389-
INFERENCE_API_ENDPOINT=https://api.example.com
390-
INFERENCE_API_TOKEN=your-pre-generated-token-here
391-
392-
# ==========================================
393-
# Docker Network Configuration
394-
# ==========================================
395-
# LOCAL_URL_ENDPOINT: Required if using local domain mapping (e.g., api.example.com -> localhost)
396-
# Set to your domain name (without https://) or leave as "not-needed" if using public URLs
397-
LOCAL_URL_ENDPOINT=not-needed
398-
399-
# ==========================================
400-
# Micro-Agent Model Configuration
401-
# ==========================================
402-
# All agents use Qwen3-4B-Instruct (optimized SLM for code analysis)
403-
# You can customize individual agent models if needed
404-
405-
CODE_EXPLORER_MODEL=Qwen/Qwen3-4B-Instruct-2507
406-
API_REFERENCE_MODEL=Qwen/Qwen3-4B-Instruct-2507
407-
CALL_GRAPH_MODEL=Qwen/Qwen3-4B-Instruct-2507
408-
ERROR_ANALYSIS_MODEL=Qwen/Qwen3-4B-Instruct-2507
409-
ENV_CONFIG_MODEL=Qwen/Qwen3-4B-Instruct-2507
410-
DEPENDENCY_ANALYZER_MODEL=Qwen/Qwen3-4B-Instruct-2507
411-
PLANNER_MODEL=Qwen/Qwen3-4B-Instruct-2507
412-
MERMAID_MODEL=Qwen/Qwen3-4B-Instruct-2507
413-
QA_VALIDATOR_MODEL=Qwen/Qwen3-4B-Instruct-2507
414-
WRITER_MODEL=Qwen/Qwen3-4B-Instruct-2507
415-
416-
# ==========================================
417-
# Repository Analysis Limits
418-
# ==========================================
419-
# All limits are configurable to suit your needs
420-
TEMP_REPO_DIR=./tmp/repos
421-
MAX_REPO_SIZE=10737418240 # 10GB in bytes
422-
MAX_FILE_SIZE=1000000 # 1MB in bytes
423-
MAX_FILES_TO_SCAN=500 # Maximum number of files to analyze
424-
MAX_LINES_PER_FILE=500 # Line budget per file (pattern_window strategy extracts ~150-300 lines focusing on key patterns)
425-
426-
# ==========================================
427-
# Agent Execution Settings
428-
# ==========================================
429-
AGENT_TEMPERATURE=0.7 # Model temperature (0.0-1.0)
430-
AGENT_MAX_TOKENS=1000 # Maximum tokens per agent response
431-
AGENT_TIMEOUT=300 # Agent timeout in seconds (5 minutes)
432-
433-
# ==========================================
434-
# GitHub Integration (MCP)
435-
# ==========================================
436-
# Required for automatic PR creation
437-
# Generate token at: https://github.com/settings/tokens
438-
# Required scopes: repo (full access to repositories)
439-
GITHUB_TOKEN=your_github_personal_access_token_here
440-
441-
# ==========================================
442-
# Server Configuration
443-
# ==========================================
444-
API_PORT=5001
445-
HOST=0.0.0.0
446-
447-
# ==========================================
448-
# CORS Settings
449-
# ==========================================
450-
# Add your frontend URL if different from defaults
451-
CORS_ORIGINS=["http://localhost:3000", "http://localhost:3001", "http://localhost:5173"]
452-
453-
# ==========================================
454-
# Security Configuration
455-
# ==========================================
456-
# SSL Verification: Set to false only for development with self-signed certificates
457-
VERIFY_SSL=true
458-
```
459-
460-
**Note:** All nine AI agents (Code Explorer, API Reference, Call Graph, Error Analysis, Env Config, Dependency Analyzer, Planner, Mermaid Generator, QA Validator) plus PR Agent use Qwen/Qwen3-4B-Instruct-2507 optimized for Intel Xeon processors
312+
Then modify it as needed, with special consideration to certain environment variables mentioned below. Read through the .env file for full instructions.
461313

462314
**Important Configuration Notes:**
463315

464316
- **INFERENCE_API_ENDPOINT**: Your actual inference service URL (replace `https://api.example.com`)
465-
- For APISIX/Keycloak deployments, the model name must be included in the endpoint URL (e.g., `https://api.example.com/Qwen3-4B-Instruct`)
317+
- For APISIX/Keycloak deployments, the model name must be included in the endpoint URL (e.g., `https://api.example.com/Qwen3-4B-Instruct-2507`)
466318
- **INFERENCE_API_TOKEN**: Your actual pre-generated authentication token
467-
- **Model Names**: Use the exact model names from your inference service
468-
- **LOCAL_URL_ENDPOINT**: Only needed if using local domain mapping
469-
- **SSL Verification**: set to false only for development with self-signed certificates
470-
471-
**Note**: The docker-compose.yml file automatically loads environment variables from both `.env` (root) and `./api/.env` (backend) files.
319+
- **LOCAL_URL_ENDPOINT**: Only needed if using local domain mapping (i.e. `api.example.com` mapped to localhost) for Docker containers to resolve correctly.
320+
- Use the domain name from INFERENCE_API_ENDPOINT without `https://`
321+
- For public domains or cloud-hosted endpoints, leave the default value `not-needed`
322+
- **Model Names**: Use the exact model name i.e. model card from Hugging Face
323+
- **VERIFY_SSL**: Controls SSL certificate verification (default: `true`)
324+
- Set to `false` only for development environments with self-signed certificates
325+
- Keep as `true` for production environments
326+
327+
**Note**: The docker-compose.yaml file automatically loads environment variables from `.env` for the backend service.
472328

473329
### Running the Application
474330

0 commit comments

Comments
 (0)