Skip to content

Commit e5e0305

Browse files
committed
added openAI function readme
1 parent c4fb447 commit e5e0305

File tree

1 file changed

+13
-9
lines changed
  • azure-functions/jobassistai-http-trigger-openai

1 file changed

+13
-9
lines changed

azure-functions/jobassistai-http-trigger-openai/README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22

33
## Overview
44

5-
This Azure Function integrates with **Azure OpenAI** to generate responses based on a predefined **system prompt** and a **user prompt**. It is designed to be reusable for various OpenAI-powered requests and is currently used for task breakdown in JobAssistAI application.
5+
This Azure Function integrates with **Azure OpenAI** to generate responses based on a predefined **system prompt** and a **user prompt**. It supports two main HTTP-triggered endpoints for different use cases:
6+
7+
1. **Basic OpenAI Integration**: Standard function to process user prompts with a system prompt.
8+
2. **OpenAI with Azure Search Integration**: Extended function that queries Azure Search data sources and provides citations in the response.
69

710
## Features
811

912
- **HTTP Triggered**: Invoked via HTTP request.
10-
- **Dynamic Prompting**: Uses `system_prompt_mapping.json` to retrieve the appropriate system prompt based on the provided system role.
13+
- **Dynamic Prompting**: Retrieves system prompt based on the system role from `system_prompt_mapping.json`.
1114
- **Azure OpenAI Integration**: Calls Azure OpenAI API to generate structured responses.
15+
- **Azure Search Integration**: The second endpoint integrates with Azure Search to include citations in the response.
1216
- **JSON-based Input & Output**: Accepts input in JSON format and returns structured AI-generated responses.
13-
- **Modular Design**: Organized into reusable modules for configuration, clients and system prompt mapping.
14-
- **Reusability**: Enable reusability by adding a new system role in `system_prompt_mapping.json` and sending HTTP requests with this system role and user prompt.
17+
- **Modular Design**: Organized into reusable modules for configuration, clients, and system prompt mapping.
1518

1619
## Directory Structure
1720
```
@@ -33,12 +36,13 @@ jobassistai-http-trigger-openai/
3336

3437
## Usage
3538

36-
1. **HTTP Trigger**: Send a HTTP trigger with system role and user prompt.
39+
1. HTTP Trigger: Send an HTTP request with a `system_role` and `user_prompt` (and optional data_sources for the second endpoint).
3740
2. **Processing**:
38-
- The function extracts system role and user prompt from the request.
39-
- References `system_prompt_mapping.json` to retrieve the appropriate system prompt based on the provided system role.
40-
- Calls Azure OpenAI to generate a structured response based on the combined system and user prompts.
41-
3. **Output**: Generated response is returned to the caller in JSON format.
41+
- The function extracts `system_role` and `user_prompt` from the request.
42+
- The system prompt is retrieved from `system_prompt_mapping.json` based on the `system_role`.
43+
- The Azure OpenAI API is called to generate a structured response.
44+
- If the second endpoint is used, additional data sources (like Azure Search) are queried, and citations are included in the response.
45+
3. **Output**: The generated response, along with citations if applicable, is returned in JSON format.
4246

4347
## Dependencies
4448

0 commit comments

Comments
 (0)