Spaces:
Running
Running
vaishnav commited on
Commit ·
4651a01
1
Parent(s): 03d5ee5
use google embeddings and add cache clearance feature
Browse files- app.py +3 -8
- stores/chroma.py +1 -1
app.py
CHANGED
|
@@ -23,6 +23,7 @@ llm_svc = LLMService(logger, config.SYSTEM_PROMPT, store.get_chroma_instance().a
|
|
| 23 |
def respond(user_input, history):
|
| 24 |
if user_input == "clear_chat_history_aisdb_override":
|
| 25 |
llm_svc.store={}
|
|
|
|
| 26 |
response = llm_svc.conversational_rag_chain().invoke(
|
| 27 |
{"input": user_input},
|
| 28 |
config={"configurable": {"session_id": "abc"}},
|
|
@@ -32,12 +33,6 @@ def respond(user_input, history):
|
|
| 32 |
|
| 33 |
if __name__ == '__main__':
|
| 34 |
logging.info("Starting AIVIz Bot")
|
|
|
|
| 35 |
|
| 36 |
-
|
| 37 |
-
chat_interface = gr.ChatInterface(
|
| 38 |
-
fn=respond,
|
| 39 |
-
title="AISDb Bot",
|
| 40 |
-
description="LLM's are prone to hallucinations"
|
| 41 |
-
)
|
| 42 |
-
|
| 43 |
-
chat_interface.launch(share=True)
|
|
|
|
| 23 |
def respond(user_input, history):
|
| 24 |
if user_input == "clear_chat_history_aisdb_override":
|
| 25 |
llm_svc.store={}
|
| 26 |
+
return "Memory Cache cleared"
|
| 27 |
response = llm_svc.conversational_rag_chain().invoke(
|
| 28 |
{"input": user_input},
|
| 29 |
config={"configurable": {"session_id": "abc"}},
|
|
|
|
| 33 |
|
| 34 |
if __name__ == '__main__':
|
| 35 |
logging.info("Starting AIVIz Bot")
|
| 36 |
+
chatbot = gr.Chatbot(placeholder="<strong>AISDb Chatbot</strong><br>Ask Me Anything")
|
| 37 |
|
| 38 |
+
gr.ChatInterface(fn=respond, type="messages",title="AISDb ChatBot", chatbot=chatbot).launch(share=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stores/chroma.py
CHANGED
|
@@ -5,7 +5,7 @@ from langchain_chroma import Chroma
|
|
| 5 |
class ChromaDB:
|
| 6 |
def __init__(self, embeddings):
|
| 7 |
self._persistent_directory = "embeddings"
|
| 8 |
-
model_name = "
|
| 9 |
model_kwargs = {'device': 'cpu'}
|
| 10 |
encode_kwargs = {'normalize_embeddings': False}
|
| 11 |
self.embeddings = embeddings
|
|
|
|
| 5 |
class ChromaDB:
|
| 6 |
def __init__(self, embeddings):
|
| 7 |
self._persistent_directory = "embeddings"
|
| 8 |
+
model_name = "models/text-embedding-004"
|
| 9 |
model_kwargs = {'device': 'cpu'}
|
| 10 |
encode_kwargs = {'normalize_embeddings': False}
|
| 11 |
self.embeddings = embeddings
|