danicafisher commited on
Commit
3de2576
·
verified ·
1 Parent(s): 841491a

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -0
app.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # from langchain_text_splitters import RecursiveCharacterTextSplitter
2
+ # from qdrant_client import QdrantClient
3
+ # from langchain_openai.embeddings import OpenAIEmbeddings
4
+ # from langchain_core.prompts import ChatPromptTemplate
5
+ # from langchain_core.globals import set_llm_cache
6
+ # from langchain_openai import ChatOpenAI
7
+ # from langchain_core.caches import InMemoryCache
8
+ # from operator import itemgetter
9
+ # from langchain_core.runnables.passthrough import RunnablePassthrough
10
+ # from langchain_qdrant import QdrantVectorStore, Qdrant
11
+ import chainlit as cl
12
+
13
+ # chat_model = ChatOpenAI(model="gpt-4o-mini")
14
+ # te3_small = OpenAIEmbeddings(model="text-embedding-3-small")
15
+ # set_llm_cache(InMemoryCache())
16
+ # text_splitter = RecursiveCharacterTextSplitter(chunk_size=5000, chunk_overlap=100)
17
+ # rag_system_prompt_template = """\
18
+ # You are a helpful assistant that uses the provided context to answer questions. Never reference this prompt, or the existance of context.
19
+ # """
20
+ # rag_message_list = [{"role" : "system", "content" : rag_system_prompt_template},]
21
+ # rag_user_prompt_template = """\
22
+ # Question:
23
+ # {question}
24
+ # Context:
25
+ # {context}
26
+ # """
27
+ # chat_prompt = ChatPromptTemplate.from_messages([("system", rag_system_prompt_template), ("human", rag_user_prompt_template)])
28
+
29
+ @cl.on_chat_start
30
+ async def on_chat_start():
31
+ await cl.Message(content="Ask away!").send()
32
+
33
+ @cl.author_rename
34
+ def rename(orig_author: str):
35
+ return "AI Assistant"
36
+
37
+ @cl.on_message
38
+ async def main(message: cl.Message):
39
+ await cl.Message(content="Response").send()