π€Customer Service Bot
Customer Service ChatBot
Import the required libraries
from beyondllm import source,retrieve,embeddings,llms,generatorSetup API keys
import os
from getpass import getpass
os.environ['OPENAI_API_KEY'] = getpass("OpenAI API Key:")Load the Source Data
Here we will use a Website as the source data. Reference: https://www.lacworldwide.com.my/en/protein-and-fitness_whey-protein/optimum-nutrition/gold-standard-100-whey-double-rich-chocolate-06100030.html?catId=protein-and-fitness
The goal is to have a customer service chatbot that can answer to the query based on the product data given.
data = source.fit(path="https://www.lacworldwide.com.my/en/protein-and-fitness_whey-protein/optimum-nutrition/gold-standard-100-whey-double-rich-chocolate-06100030.html?catId=protein-and-fitness", dtype="url", chunk_size=512,chunk_overlap=0)Embedding model
We use OpenAIEmbeddings, an embedding model from OpenAI.
embed_model = embeddings.OpenAIEmbeddings()Auto retriever to retrieve documents
Large Language Model
Define Custom System Prompt
Define the system prompt, that instructs the model to behave as a customer bot
Run Generator Model
Output
Last updated