Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
1133827
chore: remove sample data files and documentation
AldenBodak Sep 9, 2025
3f85f32
feat: add SSOE branding with logo and updated page title
AldenBodak Sep 9, 2025
be0d682
style: add company brand color variables to root element
AldenBodak Sep 9, 2025
6e385a4
feat: update app title to SSOE Knowledge Assistant and customize exam…
AldenBodak Sep 9, 2025
91c5f92
feat: add meta description tag for SSOE Knowledge Assistant
AldenBodak Sep 9, 2025
d438bd6
style: update header design with light theme and improved navigation …
AldenBodak Sep 9, 2025
60a9fa4
Merge branch 'Azure-Samples:main' into main
AldenBodak Sep 9, 2025
dd711c5
refactor: replace hardcoded colors with CSS variables for consistent …
AldenBodak Sep 9, 2025
9abd7b9
feat: update prompt examples to use structural engineering context in…
AldenBodak Sep 9, 2025
407cd17
chore: update gitignore to exclude data directory except README and g…
AldenBodak Sep 9, 2025
8a9f760
chore: update favicon to ssoe logo
AldenBodak Sep 9, 2025
58dc662
Merge pull request #1 from Actual-Reality/alden/eng-1006-branding-pas…
AldenBodak Sep 9, 2025
8bb951c
content: update example questions to focus on seismic engineering topics
AldenBodak Sep 9, 2025
a778508
feat: add PatentsBERTa embedding service with custom container deploy…
AldenBodak Sep 10, 2025
15e1d8a
feat: integrate PatentsBERTa embedding service with custom container …
AldenBodak Sep 10, 2025
3892901
docs: add PatentsBERTa integration deployment guide
AldenBodak Sep 10, 2025
8d5f1f8
test: add test suite for PatentsBERTa embedding service with health, …
AldenBodak Sep 10, 2025
4bf5c60
docs: add comprehensive test suite instructions for PatentsBERTa service
AldenBodak Sep 10, 2025
c42da54
feat: add API key authentication to PatentsBERTa embedding service
AldenBodak Sep 11, 2025
22f0bfa
test: update test suite to check api key access
AldenBodak Sep 11, 2025
a914023
docs: add API key authentication to documentation
AldenBodak Sep 11, 2025
a1c497d
feat: add input validation and constants for PatentsBERTa embedding s…
AldenBodak Sep 11, 2025
98cbd32
feat: add immutable image tagging for PatentsBERTa container deployments
AldenBodak Sep 11, 2025
ea533b3
Merge pull request #2 from Actual-Reality/alden/eng-1036-update-embed…
AldenBodak Sep 11, 2025
14feed7
Merge branch 'Azure-Samples:main' into main
AldenBodak Sep 11, 2025
0a358ba
fix: removed role assignment that was causing deployment error
AldenBodak Sep 11, 2025
8539185
Merge branch 'Azure-Samples:main' into main
AldenBodak Sep 11, 2025
488839c
feat: Integrate Microsoft 365 Agents SDK
cursoragent Sep 19, 2025
560e392
Refactor: Replace RAG logic with backend API calls
cursoragent Sep 19, 2025
9ecc770
Add mock backend and integration tests
cursoragent Sep 19, 2025
0387c9a
Merge pull request #3 from Actual-Reality/cursor/plan-m365-agents-sdk…
JustinBeaudry Sep 19, 2025
cf0be78
feat: Implement Teams specific handlers and adapters
cursoragent Sep 19, 2025
7e61cca
Checkpoint before follow-up message
cursoragent Sep 19, 2025
35228ea
feat: Make Teams UI environment-driven for structural engineering
cursoragent Sep 19, 2025
f761bf7
feat: Make all Teams UI text environment-driven for structural engine…
cursoragent Sep 19, 2025
2bad836
Checkpoint before follow-up message
cursoragent Sep 19, 2025
7010be1
refactor: Centralize Teams UI text in constants file
cursoragent Sep 19, 2025
e7116f0
refactor: Convert to proper pytest testing framework
cursoragent Sep 19, 2025
1557a2a
Merge pull request #4 from Actual-Reality/cursor/plan-m365-agents-sdk…
JustinBeaudry Sep 19, 2025
be8ab9c
Phase 3: Enhanced Microsoft 365 Authentication and Authorization
cursoragent Sep 19, 2025
4be5eaf
Merge pull request #5 from Actual-Reality/cursor/plan-m365-agents-sdk…
JustinBeaudry Sep 19, 2025
9b49efe
Integrate application updates without embedded secrets
saisushaman Nov 12, 2025
08a0ec6
testing functionality and RAG
saisushaman Nov 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .env.patentsberta.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# PatentsBERTa Embedding Configuration Example
# Copy this file to .env and update with your values

# Enable PatentsBERTa embeddings
OPENAI_HOST=patentsberta

# PatentsBERTa service configuration
PATENTSBERTA_ENDPOINT=https://patentsberta-embeddings.YOUR_REGION.azurecontainerapps.io
PATENTSBERTA_API_KEY=your-secure-api-key-here # Required for API authentication

# Embedding configuration for PatentsBERTa (768 dimensions)
AZURE_OPENAI_EMB_DIMENSIONS=768
AZURE_OPENAI_EMB_MODEL_NAME=PatentSBERTa

# Search index configuration
AZURE_SEARCH_FIELD_NAME_EMBEDDING=embedding_patentsberta

# Keep existing Azure configuration
AZURE_SUBSCRIPTION_ID=your-subscription-id
AZURE_RESOURCE_GROUP=rg-ai-master-engineer
AZURE_LOCATION=eastus

# Azure Search Service
AZURE_SEARCH_SERVICE=your-search-service
AZURE_SEARCH_INDEX=your-search-index
AZURE_SEARCH_KEY=your-search-key

# Azure Storage
AZURE_STORAGE_ACCOUNT=your-storage-account
AZURE_STORAGE_CONTAINER=content
AZURE_STORAGE_KEY=your-storage-key

# Azure OpenAI (still needed for chat completions)
AZURE_OPENAI_SERVICE=your-openai-service
AZURE_OPENAI_CHATGPT_DEPLOYMENT=your-chat-deployment
AZURE_OPENAI_CHATGPT_MODEL=gpt-4
AZURE_OPENAI_API_VERSION=2024-06-01

# Optional: Document Intelligence for advanced parsing
AZURE_DOCUMENTINTELLIGENCE_SERVICE=your-doc-intelligence-service

# Optional: Vision services for multimodal
AZURE_VISION_ENDPOINT=https://your-vision-service.cognitiveservices.azure.com/
49 changes: 47 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,13 @@ celerybeat.pid
# SageMath parsed files
*.sage.py

# Environments
# Environments and secrets
.env
.env.*
*.env
*.key
*.secret
*.pem
.venv
.evalenv
env/
Expand All @@ -119,6 +124,14 @@ ENV/
env.bak/
venv.bak/

# API keys and credentials
*_key
*_secret
*_token
credentials.json
secrets.json
agents/verify_credentials.py

# Spyder project settings
.spyderproject
.spyproject
Expand Down Expand Up @@ -149,5 +162,37 @@ node_modules
static/

data/**/*.md5

/data/*
!/data/.gitkeep
!/data/README.md

# Large files and data
*.pdf
!tests/test-data/*.pdf
*.zip
*.tar.gz
*.7z
*.rar

# Cache and temporary files
.cache/
*.cache
*.tmp
*.temp
*.swp
*.swo
*~

# OS files
.DS_Store
Thumbs.db
desktop.ini

# IDE files
.vscode/
.idea/
*.sublime-*

tests/test_application.py
tests/test_ollama_ocr.py
tests/test_response_accuracy.py
41 changes: 0 additions & 41 deletions SECURITY.md

This file was deleted.

7 changes: 7 additions & 0 deletions agents/.deployment
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[config]
SCM_DO_BUILD_DURING_DEPLOYMENT=true





187 changes: 187 additions & 0 deletions agents/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
# Microsoft 365 RAG Agent

This directory contains the Microsoft 365 Agents SDK client that replaces the web frontend. The agent provides AI-powered document search and chat capabilities across Microsoft 365 channels including Teams, Copilot, and web chat by calling the existing backend API.

## Architecture

```
┌─────────────────────────────────────────────────────────────┐
│ Microsoft 365 Channels │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Teams │ │ Copilot │ │ Web Chat │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Microsoft 365 Agents SDK │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Agent Application │ │
│ │ • Message Handlers │ │
│ │ • Channel Adapters │ │
│ │ • Response Formatting │ │
│ └─────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Existing Backend │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Quart API Server │ │
│ │ • /chat endpoint │ │
│ │ • /ask endpoint │ │
│ │ • RAG Approaches │ │
│ │ • Azure Services │ │
│ └─────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
```

## Project Structure

```
agents/
├── main.py # Main entry point
├── agent_app.py # Core agent application
├── config/
│ └── agent_config.py # Configuration management
├── services/
│ ├── rag_service.py # Backend API client
│ └── auth_service.py # Authentication service
├── handlers/
│ ├── message_handler.py # General message handler
│ └── teams_handler.py # Teams-specific handler
├── adapters/
│ └── response_adapter.py # Channel-specific response formatting
└── requirements.txt # Python dependencies
```

## Features

- **Multi-Channel Support**: Works with Teams, Copilot, and web chat
- **Backend Integration**: Calls existing RAG backend API
- **Authentication**: Microsoft 365 authentication and authorization
- **Rich Responses**: Adaptive cards, citations, and interactive elements
- **Conversation State**: Maintains context across conversations
- **Error Handling**: Robust error handling and logging
- **No Duplication**: Reuses existing backend logic and services

## Setup

### 1. Install Dependencies

```bash
cd agents
pip install -r requirements.txt
```

### 2. Configure Environment

```bash
cp .env.example .env
# Edit .env with your configuration values
```

### 3. Required Configuration

- **Bot Framework**: App ID and password from Azure Bot Service
- **Microsoft 365**: Tenant ID, client ID, and client secret
- **Backend API**: URL of the existing RAG backend (e.g., http://localhost:50505)

### 4. Run the Agent

```bash
python main.py
```

## Configuration

### Environment Variables

| Variable | Description | Required |
|----------|-------------|----------|
| `MICROSOFT_APP_ID` | Bot Framework app ID | Yes |
| `MICROSOFT_APP_PASSWORD` | Bot Framework app password | Yes |
| `AZURE_TENANT_ID` | Microsoft 365 tenant ID | Yes |
| `AZURE_CLIENT_ID` | Microsoft 365 client ID | Yes |
| `AZURE_CLIENT_SECRET` | Microsoft 365 client secret | Yes |
| `BACKEND_URL` | URL of the existing RAG backend | Yes |

### Agent Settings

| Variable | Description | Default |
|----------|-------------|---------|
| `AGENT_NAME` | Display name for the agent | "RAG Assistant" |
| `AGENT_DESCRIPTION` | Agent description | "AI-powered document search and chat assistant" |
| `MAX_CONVERSATION_TURNS` | Maximum conversation turns | 20 |
| `ENABLE_TYPING_INDICATOR` | Enable typing indicators | true |
| `ENABLE_TEAMS` | Enable Teams channel | true |
| `ENABLE_COPILOT` | Enable Copilot channel | true |
| `ENABLE_WEB_CHAT` | Enable web chat channel | true |

## API Endpoints

### Health Check
- **GET** `/` - Basic health check
- **GET** `/api/health` - Detailed health check

### Bot Framework
- **POST** `/api/messages` - Main Bot Framework endpoint

### Configuration
- **GET** `/api/config` - Get agent configuration (non-sensitive)

## Development

### Running Locally

1. Set up your environment variables
2. Run the agent: `python main.py`
3. Use Bot Framework Emulator to test locally

### Testing with Teams

1. Deploy to Azure
2. Register with Azure Bot Service
3. Configure Teams channel
4. Test in Teams

## Integration with Backend

The agent integrates with the existing RAG backend by:

1. **API Calls**: Calls existing `/chat` and `/chat/stream` endpoints
2. **No Duplication**: Reuses all existing RAG logic and services
3. **Authentication**: Passes through user context to backend
4. **Response Formatting**: Adapts backend responses for Microsoft 365 channels

## Next Steps

1. **Phase 2**: Test backend integration and response formatting
2. **Phase 3**: Add Teams-specific features (adaptive cards, file handling)
3. **Phase 4**: Implement Copilot integration
4. **Phase 5**: Add advanced features and monitoring

## Troubleshooting

### Common Issues

1. **Authentication Errors**: Check Microsoft 365 app registration
2. **Bot Framework Errors**: Verify app ID and password
3. **Azure Service Errors**: Check service endpoints and keys
4. **Channel Errors**: Verify channel configuration

### Logs

The agent logs to stdout with structured logging. Check logs for:
- Authentication issues
- Service connection problems
- Message processing errors
- Channel-specific issues

## Support

For issues and questions:
1. Check the logs for error details
2. Verify configuration values
3. Test with Bot Framework Emulator
4. Check Azure service status
6 changes: 6 additions & 0 deletions agents/adapters/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Adapters package





Loading
Loading