Spaces:
Sleeping
Sleeping
add the embedding config file
Browse files- api/db/embedding.py +10 -0
api/db/embedding.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from collections import namedtuple
|
2 |
+
from langchain.embeddings import OpenAIEmbeddings, ElasticsearchEmbeddings, SentenceTransformerEmbeddings
|
3 |
+
|
4 |
+
Embedding = namedtuple("Embedding",["embedding", "dimension", "distance"])
|
5 |
+
|
6 |
+
EMBEDDINGS = {
|
7 |
+
'SENTENCE': Embedding(SentenceTransformerEmbeddings(),768, "Cosine"),
|
8 |
+
'OPEN_AI': Embedding(OpenAIEmbeddings(), 1563, "Cosine"),
|
9 |
+
}
|
10 |
+
|