HeRksTAn commited on
Commit
31982fd
1 Parent(s): 074dae0

removed unused code

Browse files
Files changed (1) hide show
  1. app.py +0 -23
app.py CHANGED
@@ -2,14 +2,10 @@ import chainlit as cl
2
  import tiktoken
3
  import os
4
  from dotenv import load_dotenv
5
- # from langchain.document_loaders import PyMuPDFLoader
6
  from langchain_community.document_loaders import PyMuPDFLoader
7
  from langchain_openai import OpenAIEmbeddings
8
- # from langchain_community.chat_models import OpenAIEmbeddings
9
-
10
  from langchain_core.prompts import ChatPromptTemplate
11
  from langchain.text_splitter import RecursiveCharacterTextSplitter
12
- # from langchain.vectorstores import Pinecone
13
  from langchain_community.vectorstores import Pinecone
14
  from operator import itemgetter
15
  from langchain.schema.runnable import RunnablePassthrough
@@ -69,25 +65,8 @@ rag_prompt = ChatPromptTemplate.from_template(RAG_PROMPT)
69
 
70
  model = ChatOpenAI(model="gpt-3.5-turbo")
71
 
72
-
73
-
74
  @cl.on_chat_start
75
  async def main():
76
- # text_splitter = RecursiveCharacterTextSplitter(
77
- # chunk_size = 400,
78
- # chunk_overlap = 50,
79
- # length_function = tiktoken_len)
80
-
81
- # car_manual_chunks = text_splitter.split_documents(car_manual_data)
82
-
83
- # embedding_model = OpenAIEmbeddings(model="text-embedding-3-small")
84
- # vector_store = Pinecone.from_documents(car_manual_chunks, embedding_model, index_name=os.environ.get('index'))
85
- # retriever = vector_store.as_retriever()
86
-
87
- # rag_prompt = ChatPromptTemplate.from_template(RAG_PROMPT)
88
-
89
- # model = ChatOpenAI(model="gpt-3.5-turbo")
90
-
91
  mecanic_qa_chain = (
92
  {"context": itemgetter("question") | retriever, "question": itemgetter("question")}
93
  | RunnablePassthrough.assign(context=itemgetter("context"))
@@ -96,8 +75,6 @@ async def main():
96
 
97
  cl.user_session.set("runnable", mecanic_qa_chain)
98
 
99
-
100
-
101
  @cl.on_message
102
  async def on_message(message: cl.Message):
103
  runnable = cl.user_session.get("runnable")
 
2
  import tiktoken
3
  import os
4
  from dotenv import load_dotenv
 
5
  from langchain_community.document_loaders import PyMuPDFLoader
6
  from langchain_openai import OpenAIEmbeddings
 
 
7
  from langchain_core.prompts import ChatPromptTemplate
8
  from langchain.text_splitter import RecursiveCharacterTextSplitter
 
9
  from langchain_community.vectorstores import Pinecone
10
  from operator import itemgetter
11
  from langchain.schema.runnable import RunnablePassthrough
 
65
 
66
  model = ChatOpenAI(model="gpt-3.5-turbo")
67
 
 
 
68
  @cl.on_chat_start
69
  async def main():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  mecanic_qa_chain = (
71
  {"context": itemgetter("question") | retriever, "question": itemgetter("question")}
72
  | RunnablePassthrough.assign(context=itemgetter("context"))
 
75
 
76
  cl.user_session.set("runnable", mecanic_qa_chain)
77
 
 
 
78
  @cl.on_message
79
  async def on_message(message: cl.Message):
80
  runnable = cl.user_session.get("runnable")