This notebook demonstrates the use of the LangChain library with Azure OpenAI to create a conversational agent capable of assisting customers of a climbing e-commerce.
We are the owners of a climbing e-store, and we want to enhance our customer experience by creating an AI assistant. This assistant leverages the Azure OpenAI service to provide real-time, intelligent support to our customers, helping them with various tasks such as product inquiries, recommendations and cart management.
- Hyper personalisation:
Customers can benefit from a personalised experience, since the AI assistant will get access to their purchase history and make relevant recommendations.
- "Add to Cart" tool
Once agreed on the item, the AI Agent will add it to customer's cart autonomously.
- Conversational user interface
Customers can benefit from a conversational, chat experience that can improve the overall experience and increase engagement, differentiating the store in the market of e-commerce.
Before running this notebook, ensure you have the following prerequisites:
-
Python 3.8+: Make sure you have Python 3.8 or higher installed on your system.
-
Node.js: this will be needed to locally run the website and backend database. You can download the latest version here
-
Azure OpenAI Service OR OpenAI account: You need access to either the Azure OpenAI service or OpenAI Account. Ensure you have the following details:
- AZURE_OPENAI_API_VERSION: The API version of the Azure OpenAI service.
- AZURE_OPENAI_ENDPOINT: The endpoint URL for the Azure OpenAI service.
- AZURE_OPENAI_API_KEY: The API key for accessing the Azure OpenAI service.
- AZURE_OPENAI_CHAT_DEPLOYMENT_NAME: The deployment name for the Azure OpenAI chat model.
Note: you can use other LLMs of your choice to run this notebook. If you are using a model different from the Azure OpenAI series, make sure to adjust the environment variables and the client library.
- Clonte the repository:
git clone <repository-url>
cd <repository-directory>- Install Dependencies
pip install -r requirements.txt- Set environment variables
os.environ["AZURE_OPENAI_API_VERSION"] = "<your-api-version>"
os.environ["AZURE_OPENAI_ENDPOINT"] = "<your-endpoint>"
os.environ["AZURE_OPENAI_API_KEY"] = "<your-api-key>"
os.environ["AZURE_OPENAI_CHAT_DEPLOYMENT_NAME"] = "<your-deployment-name>"- To run locally the
index.htmlwebsite, you have 2 options:- If you are using VS code, you can install and enable the Live Server Extension and follow the instructions on the extension main page.
- Otherwise, you can run the following command in your command line:
npm install -g http-server
cd path/to/your/index.html
http-serverYour application will run at http://localhost:8080.
- To run locally the
db.jsondatabase:
npm install -g json-server
cd path/to/your/db.json
json-server --watch db.jsonYour database will run at http://localhost:3000.