Zwea Htet commited on
Commit
06ea9a8
·
1 Parent(s): ae5391f

added a new model

Browse files
Files changed (4) hide show
  1. data/calregs.txt +0 -0
  2. index.json +0 -0
  3. models/langOpen.py +14 -0
  4. requirements.txt +2 -1
data/calregs.txt ADDED
The diff for this file is too large to render. See raw diff
 
index.json CHANGED
The diff for this file is too large to render. See raw diff
 
models/langOpen.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ from langchain.embeddings.openai import OpenAIEmbeddings
4
+ from langchain.vectorstores import FAISS
5
+
6
+ embedding_function = OpenAIEmbeddings()
7
+
8
+ def initialize_index(index_name):
9
+ if os.path.exists(index_name):
10
+ return FAISS.load_local("./", embedding_function, index_name=index_name)
11
+ else:
12
+ faiss = FAISS.from_texts("./data/calregs.txt")
13
+ faiss.save_local("./")
14
+ return faiss
requirements.txt CHANGED
@@ -15,4 +15,5 @@ numpy
15
  langchain
16
  python-dotenv
17
  python-multipart
18
- httpx
 
 
15
  langchain
16
  python-dotenv
17
  python-multipart
18
+ httpx
19
+ openai