cmagganas commited on
Commit
e07a544
1 Parent(s): 99bedac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -16,4 +16,20 @@ import chainlit as cl
16
 
17
  import build_langchain_vector_store
18
 
19
- exec(open("build_langchain_vector_store.py").read())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  import build_langchain_vector_store
18
 
19
+ build_langchain_vector_store
20
+
21
+ from langchain.vectorstores import Chroma
22
+ from langchain.embeddings import OpenAIEmbeddings
23
+ import openai
24
+ import os
25
+
26
+ openai.api_key = os.getenv("OPENAI_API_KEY")
27
+ openai.api_base = 'https://api.openai.com/v1' # default
28
+
29
+ embedding_model_name = "text-embedding-ada-002"
30
+ embedding_model = OpenAIEmbeddings(model=embedding_model_name)
31
+ read_vector_store = Chroma(
32
+ persist_directory="langchain-chroma-pulze-docs", embedding_function=embedding_model
33
+ )
34
+ query_results = read_vector_store.similarity_search("How do I use Pulze?")
35
+ print(query_results[0].page_content)