Skip to content

Commit ee80ace

Browse files
authored
Initial commit
1 parent d7e9613 commit ee80ace

36 files changed

+5897
-1
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Nicholas Moore
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 123 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,123 @@
1-
# aoai-rag-example-scenario
1+
<<<<<<< HEAD
2+
# aoai-rag-example-scenarios
3+
=======
4+
# Example Scenario: Enterprise Chatbot with Azure OpenAI, Azure AI Search, and Streamlit (RAG Pattern)
5+
6+
## Overview
7+
8+
This project demonstrates a small-scale proof-of-concept deployment of an enterprise chatbot leveraging the power of Azure OpenAI and Azure AI Search, built and deployed using Streamlit. Utilizing the Retrieval-Augmented Generation (RAG) pattern, the chatbot combines the strengths of both services:
9+
10+
- `Azure OpenAI`: Provides the large language model (LLM) capabilities for generating human-like responses based on user queries.
11+
- `Azure AI Search`: Enables efficient retrieval of relevant information from your enterprise knowledge base or data sources.
12+
- `Streamlit`: Facilitates a lightweight and user-friendly deployment experience, making the chatbot readily accessible through a web interface.
13+
14+
The RAG pattern implemented here utilizes Azure AI Search to retrieve the most relevant information based on the user's query. This retrieved information is then fed into the Azure OpenAI LLM, which generates a comprehensive and informative response tailored to the specific context.
15+
16+
This project serves as a valuable foundation for small-scale proof-of-concept for enterprises seeking to:
17+
18+
- Implement AI-powered chatbots for improved user engagement and information access.
19+
- Leverage the combined power of Azure OpenAI and Azure AI Search for intelligent text processing and retrieval.
20+
- Build and deploy chatbots efficiently and seamlessly using Streamlit.
21+
22+
## Getting Started
23+
24+
### Create an environment using venv
25+
26+
1. Create a python environment using venv. In your terminal, type:
27+
28+
```bash
29+
python3 -m venv .venv
30+
```
31+
32+
2. Activate the environment. In your terminal, type:
33+
34+
- On Windows:
35+
36+
```bash
37+
.venv\Scripts\activate
38+
```
39+
40+
- On macOS and Linux:
41+
42+
```bash
43+
source .venv/bin/activate
44+
```
45+
46+
3. Install the required packages. In your terminal, type:
47+
48+
```bash
49+
pip install -r environment/requirements.txt
50+
```
51+
52+
4. Login to Azure using the Azure CLI. In your terminal, type:
53+
54+
```bash
55+
az login --tenant <your-tenant> --use-device-code
56+
```
57+
58+
### Set environment variables
59+
60+
To run this project, you need to configure the following environment variables. These can be stored in a .env file in the root of the project.
61+
62+
- `AZURE_SUBSCRIPTION_ID`: The Azure subscription ID to use for the deployment. For example, `00000000-0000-0000-0000-000000000000`.
63+
- `AZURE_RESOURCE_GROUP_NAME`: The name of the resource group to use for the deployment. For example, `my-resource-group`.
64+
- `AZURE_OPENAI_API_BASE`: The base URL for the Azure OpenAI API. For example, `https://my-resource.openai.azure.com/`.
65+
- `AZURE_OPENAI_API_VERSION`: The version of the Azure OpenAI API. You must set this to `2023-09-01-preview`.
66+
- `AZURE_OPENAI_API_TYPE`: The type of the Azure OpenAI API. You must set this to `azure`.
67+
- `AZURE_OPENAI_CHAT_DEPLOYMENT`: The name of the Azure OpenAI deployment to use for chat. For example, `gpt-35-turbo-16k-0613`.
68+
- `AZURE_OPENAI_CHAT_MODEL`: The name of the Azure OpenAI model to use for chat. For example, `gpt-35-turbo-16k`.
69+
- `AZURE_OPENAI_EMBEDDING_DEPLOYMENT`: The name of the Azure OpenAI deployment to use for embedding. For example, `text-embedding-ada-002-2`.
70+
- `AZURE_OPENAI_EMBEDDING_MODEL`: The name of the Azure OpenAI model to use for embedding. For example, `text-embedding-ada-002`.
71+
- `AZURE_OPENAI_EVALUATION_DEPLOYMENT`: The name of the Azure OpenAI deployment to use for evaluation. For example, `gpt-35-turbo-16k-0613`.
72+
- `AZURE_OPENAI_EVALUATION_MODEL`: The name of the Azure OpenAI model to use for evaluation. For example, `gpt-35-turbo-16k`.
73+
- `AZURE_AI_SEARCH_ENDPOINT`: The endpoint for the Azure AI Search service. For example, `https://my-resource.search.windows.net/`.
74+
- `AZURE_AI_SEARCH_INDEX_NAME`: The name of the Azure AI Search index that will store the vector embeddings of the extracted content. For example, `contoso-index`.
75+
- `AZURE_AI_SEARCH_INDEXER_NAME`: The name of the Azure AI Search indexer that will populate the search index with the extracted content. For example, `contoso-indexer`.
76+
- `AZURE_AI_SEARCH_DATASOURCE_NAME`: The name of the Azure AI Search data source that will connect the search service with the storage container. For example, `contoso-datasource`.
77+
- `AZURE_AI_SEARCH_SKILLSET_NAME`: The name of the Azure AI Search skillset that will chunk documents and generate embeddings. For example, `contoso-skillset`.
78+
- `AZURE_AI_SEARCH_INDEXER_BATCH_SIZE`: The number of documents to process in a single batch. For example, `500`.
79+
- `AZURE_AI_SEARCH_VECTOR_EMBEDDING_DIMENSION`: The dimension of the vector embeddings generated by the skillset. For example, `1536`.
80+
- `AZURE_AI_SEARCH_DATASTORE_NAME`: The name of Azure Storage account that will be registered as an Azure AI Search data source. For example, `contoso-datastore`.
81+
- `AZURE_AI_SEARCH_DATASTORE_CONTAINER_NAME`: The name of the Azure Storage container that stores the data that will be used to populate the index. For example, `contoso-container`.
82+
- `AZURE_AI_SEARCH_DATASTORE_CONTAINER_PATH`: The path to the data that will be used to populate the index. For example, `data/`.
83+
84+
### Configure the Azure AI Search service
85+
86+
To run this project, you need to configure the Azure AI Search service. You can do this using the Azure portal or the Azure CLI. This will populate Azure AI Search with a data source, an index, an indexer, and a skillset.
87+
88+
All templates are provided in the `src/search/templates` folder and values for the variables, for example `{{ AZURE_OPENAI_API_BASE }}` are populated based on the environment variables.
89+
90+
To create these artifacts to configure the Azure AI Search service, you can use the following command:
91+
92+
```bash
93+
python -m ./src/search/main.py --search_templates_dir ./src/search/templates/
94+
```
95+
96+
### Run streamlit app
97+
98+
To run the streamlit app locally for testing purposes, you can use the following command:
99+
100+
```bash
101+
streamlit run ./src/app/main.py --client.toolbarMode='minimal'
102+
```
103+
104+
Open your web browser and navigate to `http://localhost:8501` to access the chatbot.
105+
106+
![Streamlit Chat App](./.github/docs/images/image-01.png)
107+
108+
If you want to deploy this app to Azure, you can containerise it using the `Dockerfile` and deploy it to a suitable Azure service, such as Azure App Service or Azure Container Apps.
109+
110+
## Resources
111+
112+
- [Azure OpenAI](https://learn.microsoft.com/en-us/azure/ai-services/openai/)
113+
- [Azure AI Search](https://learn.microsoft.com/en-us/azure/search/)
114+
- [Streamlit](https://streamlit.io/)
115+
- [Azure OpenAI Service REST API reference](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference)
116+
- [Securely use Azure OpenAI on your data](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/use-your-data-securely)
117+
- [Introduction to prompt engineering](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/prompt-engineering)
118+
- [Prompt engineering techniques](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/advanced-prompt-engineering?pivots=programming-language-chat-completions)
119+
120+
## License
121+
122+
Details on licensing for the project can be found in the [LICENSE](./LICENSE) file.
123+
>>>>>>> development
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
# Information about product item_number: 1
2+
TrailMaster X4 Tent, price $250,
3+
4+
## Brand
5+
OutdoorLiving
6+
7+
## Category
8+
Tents
9+
10+
## Features
11+
- Polyester material for durability
12+
- Spacious interior to accommodate multiple people
13+
- Easy setup with included instructions
14+
- Water-resistant construction to withstand light rain
15+
- Mesh panels for ventilation and insect protection
16+
- Rainfly included for added weather protection
17+
- Multiple doors for convenient entry and exit
18+
- Interior pockets for organizing small items
19+
- Reflective guy lines for improved visibility at night
20+
- Freestanding design for easy setup and relocation
21+
- Carry bag included for convenient storage and transportation
22+
23+
## Technical Specs
24+
**Best Use**: Camping
25+
**Capacity**: 4-person
26+
**Season Rating**: 3-season
27+
**Setup**: Freestanding
28+
**Material**: Polyester
29+
**Waterproof**: Yes
30+
**Floor Area**: 80 square feet
31+
**Peak Height**: 6 feet
32+
**Number of Doors**: 2
33+
**Color**: Green
34+
**Rainfly**: Included
35+
**Rainfly Waterproof Rating**: 2000mm
36+
**Tent Poles**: Aluminum
37+
**Pole Diameter**: 9mm
38+
**Ventilation**: Mesh panels and adjustable vents
39+
**Interior Pockets**: Yes (4 pockets)
40+
**Gear Loft**: Included
41+
**Footprint**: Sold separately
42+
**Guy Lines**: Reflective
43+
**Stakes**: Aluminum
44+
**Carry Bag**: Included
45+
**Dimensions**: 10ft x 8ft x 6ft (length x width x peak height)
46+
**Packed Size**: 24 inches x 8 inches
47+
**Weight**: 12 lbs
48+
49+
## TrailMaster X4 Tent User Guide
50+
51+
### Introduction
52+
53+
Thank you for choosing the TrailMaster X4 Tent. This user guide provides instructions on how to set up, use, and maintain your tent effectively. Please read this guide thoroughly before using the tent.
54+
55+
### Package Contents
56+
57+
Ensure that the package includes the following components:
58+
59+
- TrailMaster X4 Tent body
60+
- Tent poles
61+
- Rainfly (if applicable)
62+
- Stakes and guy lines
63+
- Carry bag
64+
- User Guide
65+
66+
If any components are missing or damaged, please contact our customer support immediately.
67+
68+
### Tent Setup
69+
70+
#### Step 1: Selecting a Suitable Location
71+
72+
- Find a level and clear area for pitching the tent.
73+
- Remove any sharp objects or debris that could damage the tent floor.
74+
75+
#### Step 2: Unpacking and Organizing Components
76+
77+
- Lay out all the tent components on the ground.
78+
- Familiarize yourself with each part, including the tent body, poles, rainfly, stakes, and guy lines.
79+
80+
#### Step 3: Assembling the Tent Poles
81+
82+
- Connect the tent poles according to their designated color codes or numbering.
83+
- Slide the connected poles through the pole sleeves or attach them to the tent body clips.
84+
85+
#### Step 4: Setting up the Tent Body
86+
87+
- Begin at one end and raise the tent body by pushing up the poles.
88+
- Ensure that the tent body is evenly stretched and centered.
89+
- Secure the tent body to the ground using stakes and guy lines as needed.
90+
91+
#### Step 5: Attaching the Rainfly (if applicable)
92+
93+
- If your tent includes a rainfly, spread it over the tent body.
94+
- Attach the rainfly to the tent corners and secure it with the provided buckles or clips.
95+
- Adjust the tension of the rainfly to ensure proper airflow and weather protection.
96+
97+
#### Step 6: Securing the Tent
98+
99+
- Stake down the tent corners and guy out the guy lines for additional stability.
100+
- Adjust the tension of the guy lines to provide optimal stability and wind resistance.
101+
102+
### Tent Takedown and Storage
103+
104+
#### Step 1: Removing Stakes and Guy Lines
105+
106+
- Remove all stakes from the ground.
107+
- Untie or disconnect the guy lines from the tent and store them separately.
108+
109+
#### Step 2: Taking Down the Tent Body
110+
111+
- Start by collapsing the tent poles carefully.
112+
- Remove the poles from the pole sleeves or clips.
113+
- Collapse the tent body and fold it neatly.
114+
115+
#### Step 3: Disassembling the Tent Poles
116+
117+
- Disconnect and separate the individual pole sections.
118+
- Store the poles in their designated bag or sleeve.
119+
120+
#### Step 4: Packing the Tent
121+
122+
- Fold the tent body tightly and place it in the carry bag.
123+
- Ensure that the rainfly and any other components are also packed securely.
124+
125+
### Tent Care and Maintenance
126+
127+
- Clean the tent regularly with mild soap and water.
128+
- Avoid using harsh chemicals or abrasive cleaners.
129+
- Allow the tent to dry completely before storing it.
130+
- Store the tent in a cool, dry place away from direct sunlight.
131+
132+
## Cautions
133+
1. **Avoid Uneven or Rocky Surfaces**: Do not place the tent on uneven or rocky surfaces.
134+
2. **Stay Clear of Hazardous Areas**: Avoid setting up the tent near hazardous areas.
135+
3. **No Open Flames or Heat Sources**: Do not use open flames, candles, or any other flammable heat sources near the tent.
136+
4. **Avoid Overloading**: Do not exceed the maximum weight capacity or overload the tent with excessive gear or equipment.
137+
5. **Don't Leave Unattended**: Do not leave the tent unattended while open or occupied.
138+
6. **Avoid Sharp Objects**: Keep sharp objects away from the tent to prevent damage to the fabric or punctures.
139+
7. **Avoid Using Harsh Chemicals**: Do not use harsh chemicals or abrasive cleaners on the tent, as they may damage the material.
140+
8. **Don't Store Wet**: Do not store the tent when it is wet or damp, as it can lead to mold, mildew, or fabric deterioration.
141+
9. **Avoid Direct Sunlight**: Avoid prolonged exposure of the tent to direct sunlight, as it can cause fading or weakening of the fabric.
142+
10. **Don't Neglect Maintenance**: Regularly clean and maintain the tent according to the provided instructions to ensure its longevity and performance.
143+
144+
## Warranty Information
145+
Thank you for purchasing the TrailMaster X4 Tent. We are confident in the quality and durability of our product. This warranty provides coverage for any manufacturing defects or issues that may arise during normal use of the tent. Please read the terms and conditions of the warranty below:
146+
147+
1. **Warranty Coverage**: The TrailMaster X4 Tent is covered by a **2-year limited warranty** from the date of purchase. This warranty covers manufacturing defects in materials and workmanship.
148+
149+
2. **What is Covered**:
150+
- Seam or fabric tears that occur under normal use and are not a result of misuse or abuse.
151+
- Issues with the tent poles, zippers, buckles, or other hardware components that affect the functionality of the tent.
152+
- Problems with the rainfly or other included accessories that impact the performance of the tent.
153+
154+
3. **What is Not Covered**:
155+
- Damage caused by misuse, abuse, or improper care of the tent.
156+
- Normal wear and tear or cosmetic damage that does not affect the functionality of the tent.
157+
- Damage caused by extreme weather conditions, natural disasters, or acts of nature.
158+
- Any modifications or alterations made to the tent by the user.
159+
160+
4. **Claim Process**:
161+
- In the event of a warranty claim, please contact our customer support (contact details provided in the user guide) to initiate the process.
162+
- Provide proof of purchase, including the date and place of purchase, along with a detailed description and supporting evidence of the issue.
163+
164+
5. **Resolution Options**:
165+
- Upon receipt of the warranty claim, our customer support team will assess the issue and determine the appropriate resolution.
166+
- Options may include repair, replacement of the defective parts, or, if necessary, replacement of the entire tent.
167+
168+
6. **Limitations and Exclusions**:
169+
- Our warranty is non-transferable and applies only to the original purchaser of the TrailMaster X4 Tent.
170+
- The warranty does not cover any incidental or consequential damages resulting from the use or inability to use the tent.
171+
- Any unauthorized repairs or alterations void the warranty.
172+
173+
### Contact Information
174+
175+
If you have any questions or need further assistance, please contact our customer support:
176+
177+
- Customer Support Phone: +1-800-123-4567
178+
- Customer Support Email: [email protected]
179+
180+
## Return Policy
181+
- **If Membership status "None ":** Returns are accepted within 30 days of purchase, provided the tent is unused, undamaged and in its original packaging. Customer is responsible for the cost of return shipping. Once the returned item is received, a refund will be issued for the cost of the item minus a 10% restocking fee. If the item was damaged during shipping or if there is a defect, the customer should contact customer service within 7 days of receiving the item.
182+
- **If Membership status "Gold":** Returns are accepted within 60 days of purchase, provided the tent is unused, undamaged and in its original packaging. Free return shipping is provided. Once the returned item is received, a full refund will be issued. If the item was damaged during shipping or if there is a defect, the customer should contact customer service within 7 days of receiving the item.
183+
- **If Membership status "Platinum":** Returns are accepted within 90 days of purchase, provided the tent is unused, undamaged and in its original packaging. Free return shipping is provided, and a full refund will be issued. If the item was damaged during shipping or if there is a defect, the customer should contact customer service within 7 days of receiving the item.
184+
185+
## Reviews
186+
1) **Rating:** 5
187+
**Review:** I am extremely happy with my TrailMaster X4 Tent! It's spacious, easy to set up, and kept me dry during a storm. The UV protection is a great addition too. Highly recommend it to anyone who loves camping!
188+
189+
2) **Rating:** 3
190+
**Review:** I bought the TrailMaster X4 Tent, and while it's waterproof and has a spacious interior, I found it a bit difficult to set up. It's a decent tent, but I wish it were easier to assemble.
191+
192+
3) **Rating:** 5
193+
**Review:** The TrailMaster X4 Tent is a fantastic investment for any serious camper. The easy setup and spacious interior make it perfect for extended trips, and the waterproof design kept us dry in heavy rain.
194+
195+
4) **Rating:** 4
196+
**Review:** I like the TrailMaster X4 Tent, but I wish it came in more colors. It's comfortable and has many useful features, but the green color just isn't my favorite. Overall, it's a good tent.
197+
198+
5) **Rating:** 5
199+
**Review:** This tent is perfect for my family camping trips. The spacious interior and convenient storage pocket make it easy to stay organized. It's also super easy to set up, making it a great addition to our gear.
200+
201+
## FAQ
202+
1) Can the TrailMaster X4 Tent be used in winter conditions?
203+
The TrailMaster X4 Tent is designed for 3-season use and may not be suitable for extreme winter conditions with heavy snow and freezing temperatures.
204+
205+
2) How many people can comfortably sleep in the TrailMaster X4 Tent?
206+
The TrailMaster X4 Tent can comfortably accommodate up to 4 people with room for their gear.
207+
208+
3) Is there a warranty on the TrailMaster X4 Tent?
209+
Yes, the TrailMaster X4 Tent comes with a 2-year limited warranty against manufacturing defects.
210+
211+
4) Are there any additional accessories included with the TrailMaster X4 Tent?
212+
The TrailMaster X4 Tent includes a rainfly, tent stakes, guy lines, and a carry bag for easy transport.
213+
214+
5) Can the TrailMaster X4 Tent be easily carried during hikes?
215+
Yes, the TrailMaster X4 Tent weighs just 12lbs, and when packed in its carry bag, it can be comfortably carried during hikes.
216+

0 commit comments

Comments
 (0)