Skip to content

BT-eng/tender-engine

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎯 Tender AI - Secured by Azure

A production-ready AI-powered tender recommendation system built on Microsoft Azure, designed to match companies with relevant government tenders using advanced vector search and GPT-4 analysis.

πŸ‘₯ Authors

  • Sameer Ankalgi - AI Engineer - MSFT
  • Hao Zhang - AI Engineer - MSFT
  • Naya Giannakopoulou - Lead Architect - MSFT_InnoLabs

πŸ—οΈ Azure Architecture

Tender AI Architecture

Architecture Overview

The Tender AI application follows a modern, cloud-native architecture pattern leveraging Azure's AI and data services for intelligent tender matching:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        Azure Cloud Platform                     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                     β”‚
β”‚  β”‚ Azure Container β”‚    β”‚   Azure OpenAI  β”‚                     β”‚
β”‚  β”‚      Apps       │◄──►│   (GPT-4o +     β”‚                     β”‚
β”‚  β”‚   (Streamlit)   β”‚    β”‚  text-embed-3)  β”‚                     β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                     β”‚
β”‚           β”‚                       β”‚                             β”‚
β”‚           β–Ό                       β–Ό                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                     β”‚
β”‚  β”‚  Azure Cosmos   β”‚    β”‚   EU TED API    β”‚                     β”‚
β”‚  β”‚ DB (Vector DB)  β”‚    β”‚ (Tender Source) β”‚                     β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                     β”‚
β”‚           β”‚                                                     β”‚
β”‚           β–Ό                                                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                   β”‚
β”‚  β”‚          Support Services               β”‚                   β”‚
β”‚  β”‚  β€’ Azure Key Vault (Secrets)           β”‚                   β”‚
β”‚  β”‚  β€’ Azure Container Registry (Images)   β”‚                   β”‚
β”‚  β”‚  β€’ Application Insights (Monitoring)   β”‚                   β”‚
β”‚  β”‚  β€’ Azure Monitor (Logging)             β”‚                   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Core Azure Services

  • πŸš€ Azure Container Apps: Serverless container hosting with auto-scaling
  • 🧠 Azure OpenAI: GPT-4o for intelligent analysis and text-embedding-3-small for vector embeddings
  • πŸ“Š Azure Cosmos DB: Vector-enabled NoSQL database for tender and company data with similarity search
  • πŸ”’ Azure Key Vault: Secure secrets and API key management
  • πŸ“¦ Azure Container Registry: Secure container image storage and distribution
  • πŸ“ˆ Application Insights: End-to-end observability and performance monitoring
  • πŸ“‹ Azure Monitor: Centralized logging, metrics, and alerting

πŸš€ Features

  • πŸ” EU Tender Discovery: Direct integration with official EU TED API for real-time tender data
  • 🏒 Company Profile Management: Structured company data with vector embeddings in Cosmos DB
  • πŸ’‘ Intelligent Matching: Vector similarity search powered by Azure OpenAI embeddings
  • πŸ“Š Production Monitoring: Real-time metrics, distributed tracing, and performance insights
  • πŸ”’ Enterprise Security: Managed identities, RBAC, and Key Vault integration
  • ⚑ Auto-scaling: Container Apps with automatic resource optimization based on demand
  • 🌍 Multi-region Support: Deployable across Azure regions with geo-redundancy options

πŸ“‹ Prerequisites

  • Azure CLI (az) version 2.60+
  • Azure Developer CLI (azd) version 1.16+
  • Docker (optional - Azure can build images in the cloud)
  • Azure subscription with appropriate permissions for:
    • Resource group creation
    • Azure OpenAI service deployment
    • Cosmos DB provisioning
    • Container Apps environment setup

πŸ› οΈ Quick Start

1. Clone and Initialize

git clone https://github.com/heisenberg-alt/tender-engine.git
cd tender-engine
azd init

2. Configure Environment Variables

Copy the environment template and fill in your Azure credentials:

cp .env.example .env

Edit .env with your Azure configuration:

# Azure Configuration
AZURE_OPENAI_ENDPOINT=https://your-openai-resource.openai.azure.com/
AZURE_OPENAI_API_KEY=your_azure_openai_key
AZURE_OPENAI_DEPLOYMENT_NAME=gpt-4o
AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME=text-embedding-3-small

# Cosmos DB Configuration  
COSMOS_DB_ENDPOINT=https://your-cosmos-account.documents.azure.com:443/
COSMOS_DB_KEY=your_cosmos_db_key
COSMOS_DB_DATABASE_NAME=tender-recommender

# EU TED API (provided for development)
EU_TED_API_KEY=your_eu_ted_api_key_here

3. Deploy to Azure

azd up

This command will:

  • πŸ—οΈ Create all Azure resources using Bicep templates
  • πŸ“¦ Build and deploy the container image to Azure Container Registry
  • βš™οΈ Configure environment variables and secrets in Key Vault
  • πŸ“Š Set up monitoring and logging with Application Insights
  • πŸš€ Deploy the application to Azure Container Apps

4. Configure Deployment

During deployment, you'll be prompted for:

  • Environment Name: Unique identifier for your deployment (e.g., tender-prod)
  • Azure Region: Choose your preferred region (e.g., eastus, westeurope)
  • Azure Subscription: Select your target subscription

πŸ—οΈ Infrastructure as Code

The infrastructure is defined using Bicep templates in the infra/ directory:

infra/
β”œβ”€β”€ main.bicep              # Main orchestration template
β”œβ”€β”€ resources.bicep         # Azure resources definitions
└── main.parameters.json    # Environment-specific parameters

Key Infrastructure Features

  • πŸ” Vector Search: Cosmos DB configured with vector indexing for similarity search
  • πŸ”’ Security: Managed identities, Key Vault integration, and RBAC permissions
  • πŸ“Š Observability: Application Insights with automatic instrumentation and custom metrics
  • 🌐 Networking: Container Apps with CORS configuration and health checks
  • πŸ“ˆ Scalability: Auto-scaling based on CPU, memory, and HTTP request metrics
  • 🏷️ Resource Tagging: Consistent tagging for cost management and governance

πŸ“ Project Structure

tender-engine/
β”œβ”€β”€ app.py                      # Streamlit application entrypoint
β”œβ”€β”€ azure.yaml                  # Azure Developer CLI configuration
β”œβ”€β”€ Dockerfile                  # Container image definition
β”œβ”€β”€ requirements.txt            # Python dependencies (Azure-focused)
β”œβ”€β”€ .env.example               # Environment variables template
β”œβ”€β”€ agents/
β”‚   β”œβ”€β”€ company_agent.py       # Company profile management
β”‚   └── tender_agent.py        # EU TED API integration & tender processing
β”œβ”€β”€ llm/
β”‚   └── azure_recommender_llm.py # Azure OpenAI integration
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ config.py              # Configuration management
β”‚   └── tender_crawler.py      # EU TED API crawler with Swiss support
β”œβ”€β”€ vectorstore/
β”‚   └── cosmos_vector_store.py # Azure Cosmos DB vector operations
β”œβ”€β”€ infra/                     # Bicep infrastructure templates
β”‚   β”œβ”€β”€ main.bicep
β”‚   β”œβ”€β”€ resources.bicep
β”‚   └── main.parameters.json
└── data/
    └── raw_tenders/           # Local tender data storage

🧠 How It Works

1. EU Tender Data Ingestion

  • Direct API Integration: Connects to official EU TED API for real-time tender data
  • Structured Processing: Extracts and normalizes tender information (title, description, CPV codes, deadlines)
  • Vector Embedding: Uses Azure OpenAI text-embedding-3-small to create semantic embeddings
  • Cosmos DB Storage: Stores tender data with vector indexes for similarity search

2. Company Profile Management

  • Profile Creation: Companies input expertise areas, certifications, and capabilities
  • Semantic Analysis: Azure OpenAI analyzes company descriptions and generates embeddings
  • Vector Storage: Company profiles stored in Cosmos DB with searchable vector representations

3. Intelligent Matching

# Vector similarity search with Azure OpenAI
embeddings = azure_openai.get_embeddings(company_profile)
similar_tenders = cosmos_db.vector_search(embeddings, similarity_threshold=0.7)

# GPT-4o analysis for detailed recommendations
recommendation = gpt4o.analyze_match(company_profile, tender_data)

4. Real-time Recommendations

  • Vector Similarity: Fast similarity search using Cosmos DB vector indexes
  • AI Analysis: GPT-4o provides detailed match reasoning and recommendations
  • Scoring System: Multi-factor scoring based on expertise, location, company size, and past performance

πŸ–₯️ Local Development

Run Locally with Docker

# Build the container
docker build -t tender-engine .

# Run with environment variables
docker run -p 8501:8501 --env-file .env tender-engine

Run with Python

# Install dependencies
pip install -r requirements.txt

# Run the Streamlit app
streamlit run app.py

The application will be available at http://localhost:8501

πŸ“Š Monitoring and Observability

Application Insights Integration

  • πŸ“ˆ Custom Metrics: Track tender matches, API response times, and user interactions
  • πŸ” Distributed Tracing: End-to-end request tracking across Azure services
  • ⚠️ Error Monitoring: Automatic error detection and alerting
  • πŸ“Š Performance Analytics: Real-time performance dashboards

Key Metrics Tracked

  • Tender processing rate
  • Company profile creation frequency
  • Vector search performance
  • OpenAI API usage and costs
  • Container resource utilization

πŸ”’ Security Features

  • οΏ½ Managed Identity: Passwordless authentication between Azure services
  • �️ Key Vault Integration: Secure storage of API keys and connection strings
  • πŸ›‘οΈ RBAC Permissions: Least-privilege access control
  • πŸ”’ Network Security: Private endpoints and secure communication
  • πŸ“‹ Compliance: GDPR-compliant data handling and retention policies

🌍 Deployment Environments

  • Development: azd env new dev - Single-region, cost-optimized
  • Staging: azd env new staging - Production-like with reduced capacity
  • Production: azd env new prod - Multi-region, high-availability setup

🀝 Contributing

We welcome contributions! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™‹β€β™‚οΈ Support

For questions or support:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 88.5%
  • Bicep 11.3%
  • Dockerfile 0.2%