|
| 1 | +# JobAssistAI Search Insights Azure Function |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This Azure Function enables job coaches to search insights stored in **Azure Cosmos DB** using **natural language queries**. It integrates **Azure OpenAI (text-embedding-ada-002)** to generate embeddings for the query and uses **Azure AI Search** to retrieve relevant insights. Instead of returning full database entries, this function calls an existing Azure Funtion **jobassistai-http-trigger-openai** to extract and summarize the most relevant information. |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +- **HTTP Triggered**: Invoked via HTTP request. |
| 10 | +- **Azure OpenAI (text-embedding-ada-002) Integration**: Converts natural language queries into embeddings. |
| 11 | +- **Azure AI Search Integration**: Retrieves relevant information stored in Azure Cosmos DB. |
| 12 | +- **Azure Function (jobassistai-http-trigger-openai)**: Calls Azure Open AI to extract and refine the response. |
| 13 | +- **JSON-based Input & Output**: Accepts search query in JSON format and returns relevant insights in JSON format. |
| 14 | +- **Modular Design**: Organized into reusable modules for configuration, clients. |
| 15 | + |
| 16 | +## Directory Structure |
| 17 | +``` |
| 18 | +jobassistai-search-insights/ |
| 19 | +├── function_app.py # Main entry point with the Azure Function |
| 20 | +├── config.py # Environment variables and configuration |
| 21 | +├── clients.py # Client initializations (SpeechSDK) |
| 22 | +├── requirements.txt # Python dependencies |
| 23 | +├── README.md # Project documentation (this file) |
| 24 | +└── host.json # Azure Functions configuration (auto-generated or customized) |
| 25 | +``` |
| 26 | + |
| 27 | +## Prerequisites |
| 28 | + |
| 29 | +- **Azure Subscription**: Access to Azure AI services. |
| 30 | +- **Azure OpenAI**: The `text-embedding-ada-002` model is deployed and accessible. |
| 31 | +- **Azure AI Search**: The index is created and configured with data from Cosmos DB. |
| 32 | +- **Azure Function `jobassistai-http-trigger-openai`**: The function is deployed and accessible. Ensure the endpoint is configured correctly in environment variables. |
| 33 | +- **Python 3.12**: Compatible with Azure Functions Python runtime. |
| 34 | +- **Azure Functions Core Tools**: For local testing and deployment. |
| 35 | + |
| 36 | +## Usage |
| 37 | + |
| 38 | +1. **HTTP Trigger**: Send a HTTP trigger with search query as JSON payload. |
| 39 | +2. **Processing**: |
| 40 | + - The function generates embeddings using `text-embedding-ada-002`. |
| 41 | + - Calls Azure AI Search to fetch relevant results from Azure Cosmos DB. |
| 42 | + - The function calls `jobassistai-http-trigger-openai` function to summarize and extract only the most relevant details. |
| 43 | +3. **Output**: Generated response is returned to the caller in JSON format. |
| 44 | + |
| 45 | +## Dependencies |
| 46 | + |
| 47 | +See `requirements.txt`: |
| 48 | +- `azure-functions>=1.18.0` |
| 49 | +- `python-dotenv>=1.0.0` |
| 50 | +- `azure.cosmos` |
| 51 | +- `openai>=1.0.0` |
0 commit comments