kdevoe commited on
Commit
ad99cb0
·
verified ·
1 Parent(s): fc64087

Test run with both openai call and vector db

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -18,6 +18,22 @@ embedding = OpenAIEmbeddings(openai_api_key=openai_api_key)
18
  persist_directory = './chroma_db'
19
  vectordb = Chroma(persist_directory=persist_directory, embedding_function=embedding)
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  # Streamed response emulator
23
  def response_generator():
 
18
  persist_directory = './chroma_db'
19
  vectordb = Chroma(persist_directory=persist_directory, embedding_function=embedding)
20
 
21
+ llm_name = "gpt-3.5-turbo"
22
+
23
+ llm = ChatOpenAI(model_name=llm_name, temperature=0,
24
+ openai_api_key=openai_api_key)
25
+
26
+ qa_chain = RetrievalQA.from_chain_type(
27
+ llm,
28
+ retriever=vectordb.as_retriever()
29
+ )
30
+
31
+ question = "production is broken how do I fix it?"
32
+
33
+ result = qa_chain({"query": question})
34
+
35
+ print(result['result'])
36
+
37
 
38
  # Streamed response emulator
39
  def response_generator():