Skip to content

Commit 83daddd

Browse files
committed
Added README for Save Insights Azure Function
1 parent 32a37e8 commit 83daddd

File tree

2 files changed

+62
-1
lines changed

2 files changed

+62
-1
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# JobAssistAI Save Insights Azure Function
2+
3+
## Overview
4+
5+
This Azure Function allows job coaches to store important insights they encounter during work. These insights can be any random but useful information that might help future job coaches, especially when the original job coach is absent. When a user clicks **Save Insight** in the UI, this function is triggered. The function generates a vector representation of the details using **Azure OpenAI's `text-embedding-ada-002` model** for future AI-powered searches and stores the insights with id, category, details and details vector in **Azure Cosmos DB**.
6+
7+
## Features
8+
9+
- **HTTP Triggered**: Invoked via HTTP request.
10+
- **Azure OpenAI (text-embedding-ada-002) Integration**: Creates a vector representation of the `details`.
11+
- **Insight Document structure**:
12+
13+
```python
14+
insight = {
15+
"id": str(uuid.uuid4()), # Unique ID for the insight
16+
"category": category, # Category of the insight provided by Job Coach
17+
"details": details, # Details of the insight provided by Job Coach
18+
"detailsVector": details_vector # Vector representation of the details
19+
}
20+
```
21+
- **Azure Cosmos DB**: Stores insights in Azure Cosmos DB for effecient retreival.
22+
- **JSON-based Input & Text Output**: Accepts `category` and `details` in JSON format and returns response message in text format.
23+
- **Modular Design**: Organized into reusable modules for configuration, clients.
24+
25+
## Directory Structure
26+
```
27+
jobassistai-save-insights/
28+
├── function_app.py # Main entry point with the Azure Function
29+
├── config.py # Environment variables and configuration
30+
├── clients.py # Client initializations (OpenAI and Cosmos)
31+
├── requirements.txt # Python dependencies
32+
├── README.md # Project documentation (this file)
33+
└── host.json # Azure Functions configuration (auto-generated or customized)
34+
```
35+
36+
## Prerequisites
37+
38+
- **Azure Subscription**: Access to Azure AI services.
39+
- **Azure OpenAI**: The `text-embedding-ada-002` model is deployed and accessible.
40+
- **Azure Cosmos DB**: The database must be configured to store insights.
41+
- **Python 3.12**: Compatible with Azure Functions Python runtime.
42+
- **Azure Functions Core Tools**: For local testing and deployment.
43+
44+
## Usage
45+
46+
1. **HTTP Trigger**: Send a HTTP trigger with category and details as JSON payload.
47+
2. **Processing**:
48+
- The function generates embeddings of details using `text-embedding-ada-002`.
49+
- Saves insights in Azure Cosmos DB.
50+
3. **Output**: Generated response is returned to the caller in JSON format.
51+
52+
## Dependencies
53+
54+
See `requirements.txt`:
55+
- `azure-functions>=1.18.0`
56+
- `python-dotenv>=1.0.0`
57+
- `azure.cosmos`
58+
- `openai>=1.0.0`

azure-functions/jobassistai-save-insights/requirements.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
# The Python Worker is managed by Azure Functions platform
33
# Manually managing azure-functions-worker may cause unexpected issues
44

5-
azure-functions
5+
azure-functions>=1.18.0
6+
python-dotenv>=1.0.0
7+
azure.cosmos
8+
openai>=1.0.0

0 commit comments

Comments
 (0)