AI agent master branch with llama-index
2.3K
Build locally:
docker build -f Dockerfile -t ai-agent .
Run locally:
docker run --rm -p 8080:80 --env-file .env ai-agent
Mimic Azure web app resource specs:
docker run --rm -p 8080:80 --env-file .env --cpus="2.0" --memory="8g" ai-agent
Azurite Local Blob connection string:
DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://host.docker.internal:10000/devstoreaccount1;
| Environment Variable | Description | Used With |
|---|---|---|
| DatabaseType | Database type options: 'mysql', 'mssql', 'snowflake', 'redshift', 'postgresql', 'bigquery' | All |
| DataSource | For 'snowflake' analogue of the 'Account' db parameter | All |
| Account | Alternative to DataSource for snowflake connections | snowflake |
| Warehouse | Warehouse identifier | snowflake |
| DbSchema | Database schema | snowflake |
| DbName | Database name | All |
| DbUser | Database username | All |
| DbPassword | Database password | All |
| DbPort | Database port number | mysql, postgresql |
| ActiveDirectoryAuthentication | Enables Azure Active Directory token-based authentication instead of username/password. Accepts: true, True, 1 | mssql, mysql, postgresql |
| ClientIdOfUserAssignedIdentity | Client ID of a user-assigned managed identity in Azure. When set, uses this identity for AD token retrieval; otherwise falls back to system-assigned identity. Also triggers AD auth if set, even without ActiveDirectoryAuthentication | mssql, mysql, postgresql |
| ApiEndPoint | API endpoint URL | All |
| ApiToken | API authentication token | All |
| StaticEndPoint | Static endpoint URL | All |
| client_email | Service account email | bigquery |
| token_uri | Token URI | bigquery |
| private_key | Private key for authentication | bigquery |
| project_id | Google Cloud project ID | bigquery |
| Environment Variable | Description |
|---|---|
| FromYear | Starting year from which to measure trusted data |
| ToYear | The final year up to which trusted data is measured (inclusive) |
| CorridorsMode | 1 = standard mode (flat corridors over given time period, minimum 1 year of data); 2 = seasonal mode (monthly calculated corridors, minimum 2 years' of data) |
| WindowSize | Size of the rolling window when using seasonal corridors mode (default = 5) |
| BoundarySensitivity | Sensitivity for the lower and upper bounds for anomaly detection (mean +- BoundarySensitivity * standard deviation) |
| EmailAddress | Email address for sending anomaly detection email |
| EmailPassword | Password for senders email (app password may need to be used for gmail and outlook accounts) |
| RecipientEmail | Email addresses of recipients (separated by comma (no space)) |
| AzureAppName | Azure app name where interactive graph files are stored |
| OpenAiAPI | API key for OpenAI integration (informative emails) |
| OpenAiBase | Base URL for OpenAI integration |
| OpenAiType | Type of OpenAI service (e.g. azure) |
| OpenAiVersion | OpenAI version |
| OpenAiName | Name of OpenAI model to be used |
| SystemMessage | System Message for OpenAI for initial context and instructions given to OpenAI model |
| Frequency | Frequency (in days) for which the anomaly detection should take place |
| Environment Variable | Description |
|---|---|
| LanguageModelProvider | Provider of the language model (accepts: GCP, AWS, AzureOpenAI, HuggingFace) More to be added. |
| LanguageModelName | Name of the LLM ID, e.g. global.anthropic.claude-sonnet-4-5-20250929-v1:0 (If using Sage Maker this will be the Sage Maker endpoint of your model.) |
| LanguageModelApiKey | Authentication secret: - AzureOpenAI/Gemini: API key- AWS and SageMaker: AWS Secret Access Key |
| LanguageModelEndpoint | Provider-specific endpoint or identifier. - For AzureOpenAI: The Azure OpenAI resource endpoint URL.- For AWS and SageMaker: AWS Access Key ID. |
| LanguageModelVersion | Version of the LLM. - For AzureOpenAI: The model version (e.g. 2025-12-01)- For AWS and SageMaker: The model region (e.g. us-east-2) |
| AzureModelDeploymentName | The deployment name of the Azure-based language model |
| LanguageModelContext | System prompt/context given to the LLM for answering document queries |
| LanguageModelMaxTokens | Maximum number of tokens the LLM can generate in a response (default: 2048) |
| LanguageModelTimeout | Timeout in seconds for LLM requests (default: 300) |
| LanguageModelTemperature | Controls how creative or predictable the AI responses are. Lower values make responses more focused and accurate. (default: 0.4) |
| Streaming | Enable streaming responses from the bot; Options: true, false (default: false) |
| EmbeddingModel | Embedding model used for vectorising documents and queries (default: BAAI/bge-small-en-v1.5) |
| AzureStorageAccName | Name of the Azure Storage account containing document files |
| AzureBlobContainerName | Name of the Azure Blob Storage container where documents are stored |
| AzureStorageSasToken | Optional; SAS token for Azure Blob Storage authentication. Falls back to Managed Identity if not provided |
| ChunkSize | Number of words per text chunk when splitting documents for embedding (standard RAG mode only) (default: 200) |
| MaxChunkSize | Maximum number of words per text chunk - If a sentence ender is not found after ChunkSize and before MaxChunkSize, the chunk will be split at MaxChunkSize (standard RAG mode only) (default: 500) |
| SentenceEnders | When true, chunks break at sentence endings (!, ?, .) that come after word count, rather than strictly at word count (standard RAG mode only) (default: true) |
| GraphRag | When true uses Graph RAG mode, when false uses standard vector search (default: false) |
| VerboseGraph | When true adds more verbose graph RAG answer containing sources and patterns (default: false) |
| AzureModelsStorageAccName | Storage account name for model storage - embedding & LLM models are stored here (default: nlsqlstorage) |
| AzureModelsBlobContainerName | Container name for model storage (default: models) |
| AzureModelsStorageSasToken | |
| StoreHuggingFaceModels | When true Hugging Face models will be storred in local models storage after download - if present stored models will be used instead of Hugging Face models (default: true) |
| RagSearchResults | Number or results returned to the LLM (Standard RAG and Graph RAG modes) (default: 5) |
| GraphChunkSize | Chunk size in tokens for splitting Graph RAG documents (default: 50000) |
| GraphMultistepReasoning | Number of recursive reasoning steps for graph queries (default: 1) |
| CustomGraphTemplate | Uses a custom Graph RAG prompt template for Graph RAG queries (default: See below) |
| FormatPrompt | Part of the system prompt related to response formatting (default: see below) |
| EmbeddingModelProvider | Provider of the embedding model (accepts: AzureOpenAI, HuggingFace) (default: HuggingFace) |
| EmbeddingModelApiKey | The API key of the embedding model (AzureOpenAI only) (default: defaults to LanguageModelApiKey environment variable value) |
| EmbeddingModelVersion | The version of the embedding model (AzureOpenAI only) (default: defaults to LanguageModelVersion environment variable value) |
| EmbeddingModelEndpoint | The endpoint of the embedding model (AzureOpenAI only) (dafault: defaults to LanguageModelEndpoint environment variable value) |
| AzureEmbeddingModelDeploymentName | The deployment name of the Azure-based embedding model |
| GraphModelProvider | Provider of the language model used for building Knowledge Graph and Graph triples (accepts: GCP, AWS, AzureOpenAI, HuggingFace). (default: defaults to LanguageModelProvider if not set.) |
| GraphModelName | Name/ID of the LLM used for Knowledge Graph Building. (default: defaults to LanguageModelName if not set.) |
| GraphModelEndpoint | Provider-specific endpoint for the Knowledge Graph Building model. For AzureOpenAI: the Azure OpenAI resource endpoint URL. (default: defaults to LanguageModelEndpoint if not set.) |
| GraphModelApiKey | Authentication secret for the Knowledge Graph Building model. For AzureOpenAI: API key. (default: defaults to LanguageModelApiKey if not set.) |
| GraphModelVersion | Version of the Graph RAG LLM. For AzureOpenAI: the model version (e.g. 2024-02-01). (default: defaults to LanguageModelVersion if not set.) |
| GraphModelTimeout | Timeout in seconds for Graph RAG LLM requests (default: 300) |
| GraphModelMaxTokens | Maximum number of tokens the Graph RAG LLM can generate in a response (default: 8000) |
| AzureGraphModelDeploymentName | The deployment name of the Azure-based language model for Knowledge Graph building |
| ConversationMemory | If true the language model with retain converstaion history as context for future responses (default: false) |
| MaxMemoryTokens | The maximum number of tokens reserved for conversation memory (only applies if ConversationMemory is true) (default: 4000) |
| AwsS3BucketName | The S3 bucket to read/write from |
| AwsAccessKeyId | AWS access key |
| AwsSecretAccessKey | AWS secret key |
| AwsRegionAWS | AWS region (default: us-east-1) |
| HF_HOME | The base directory for internal Hugging Face model storage (default: /home/huggingface) |
| HF_TOKEN | (Optional) Hugging Face API token for models that require a authentication. |
| LLAMA_INDEX_CACHE_DIR | The base directory for internal Llama Index model storage (default: /home/llama_index) |
| RUN_TEST | When true runs assertion tests accross all Talk to Docs functions (default: false) |
| RUN_INTEGRATION_TESTS | When true initial cloud-based integration tests will run (default: false) |
| RUN_E2E_TESTS | When true end-to-end request/response tests will run after app initialization. (default: false) |
| DIRECT_LINE_SECRET | The Direct Line secret needed for end-to-end tests |
| INIT_TIMEOUT_SECONDS | How long - in seconds - the app will poll initialization for end-to-end tests (default: 600) |
You must always respond in Markdown and plain text only. Never respond in JSON, code blocks containing JSON, or any other structured data format. Do not include any pre-response tags, metadata, system notes, or explanations about formatting. Respond directly to the user’s request without any introductory or wrapper text.
{% chat role="system" %}
{system_prompt}
## Response Format Rules\n{format_prompt}
{% endchat %}
{% chat role="user" %}
Context: {{ context_str }}
User Query: {{ query_str }}
{% endchat %}
{system_prompt} is where LanguageModelContext value will be injected.{format_prompt} is where FormatPrompt value will be injected.GCP)AWS)AzureOpenAI)HuggingFace)SageMaker)Here are some embedding models that have been tested with the app:
| Model | Embedding Dimensions |
|---|---|
| BAAI/bge-small-en-v1.5 | 384 |
| nomic-ai/nomic-embed-text-v1.5 | 768 |
| nomic-ai/nomic-embed-text-v2-moe | 768 |
Notes:
Standard tests
Cloud integration tests
true. These tests cover document storage downloads and uploads, as well as LLM and Embedding models requests and responses.End-to-end tests
true and after the full application initialization process is complete. These test cover the entire talk-to-docs flow and will pass if a proper final response is recieved via a Direct Line request.| Environment Variable | Description |
|---|---|
| connections__serviceConnection__settings__clientId | Azure Application ID for Microsoft Teams bot authentication |
| connections__serviceConnection__settings__clientSecret | Azure Application secret for Microsoft Teams bot authentication - Remove this env for UserAssignedMSI |
| connections__serviceConnection__settings__tenantId | Azure Active Directory Tenant ID for the bot |
| connectionsMap__0__connection | Connection name for the application (default: serviceConnection) |
| connectionsMap__0__serviceUrl | URL of the application connection (default: *) |
| TalkToDocs | Controls bot mode; "true" = Talk-to-Docs only, "false" = NLSQL only, "" = both (NLSQL with Talk-to-Docs fallback) |
| DEV | When true launches the app in development mode for using local Azurite Blob storage |
| AZURE_STORAGE_CONNECTION_STRING | Connection string for connecting to local Azurite storage (development mode) |
| DEBUG | Enable verbose debug logging; Options: true, false (default: false) |
Content type
Image
Digest
sha256:b58dcaa3c…
Size
1.2 GB
Last updated
7 months ago
docker pull denissa4/aiagent-master