SFBU Customer Support System
TEXT
Content Table
Environment Setup
Data Processing and Embeddings
Conversational Retrieval Chain Setup
Business Logic
Web-based User Interfaces
Appendix
Environment Setup
Importing libraries and dependencies, including langchain, dotenv, and more.
Initializing API keys for OpenAI and Google, allowing secure access to external services.
Defining example sentences, such as queries for educational program information.
Introduction to the OpenAI API, which powers conversational AI in the code.
Environment Setup - packages
from langchain.embeddings.openai import OpenAIEmbeddings
import openai
import os
import sys
import requests
sys.path.append('../..')
from dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv()) # read local .env file
openai.api_key = os.environ['API_KEY']
goog_api_key = os.environ['GOOG_API_KEY']
Data Processing and Embeddings
sentence1 = "What are the application requirements for the MSCS program at SFBU?"
sentence2 = "Can you outline the core curriculum for the SFBU MSCS program?"
Data Processing and Embeddings
SETTING UP A VECTOR STORE (CHROMA) FOR ENHANCED RETRIEVAL
ConversationalRetrievalChain
What is a Conversational Retrieval Chain?
A Conversational Retrieval Chain is a crucial component in our project.
It enables our system to provide dynamic and context-aware responses in conversations.
Key Features:
Memory Integration: The chain incorporates a memory component for storing and retrieving conversation history.
Chat Model: It employs a powerful chat model, GPT-3.5 Turbo from OpenAI, for generating responses.
Retriever: Utilizes a vector store (Chroma) for enhanced context retrieval.
ConversationalRetrievalChain - Customization
Our conversational AI is powered by GPT-3.5 Turbo, an advanced language model from OpenAI.
It's a versatile and highly capable model known for its natural language understanding.
Our AI taps into the extensive knowledge of our pretrained ChromaDB vector store.
Sourced from official school documents and videos, this database enriches our responses with context-aware insights.
This ensures the accuracy and reliability of the information we provide.
ConversationalRetrievalChain - Testing
Business Logic
Initialization and Loading Data
Constructor sets up parameters and loads conversational data.
Resetting the Database
call_load_db() clears history and reloads the conversational chain.
User Interaction and Responses
convchain(query) handles queries and updates conversation history.
Clearing Conversation History
clr_history() resets the chat history, maintaining a clean slate.
User interface
Flask Web Application
Utilizes Flask to create a web-based interface for user interaction.
Chatbot Integration
Interacts with the chatbot logic implemented in the 'cbfs' module.
Submitting Questions
Users can submit questions via a web form.
Viewing Replies
Replies are displayed on the web interface for user feedback.
Starting New Chats
Option to clear conversation history and begin a fresh chat.
User interface - Effect
User interface – Start new chat(forget context)
Appendix