-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathget_embedding_function.py
More file actions
33 lines (24 loc) · 875 Bytes
/
get_embedding_function.py
File metadata and controls
33 lines (24 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from langchain_community.embeddings import ollama
# from langchain_community.embeddings import HuggingFaceEmbeddings
"""
It is very important to get the Ollama embedding function in this way.
The following import contains embedding function that works with Chroma db:
from langchain_community.embeddings import ollama
This does not:
from langchain_community.embeddings import OllamaEmbeddings
"""
# def get_embedding_function():
# ollama_emb = ollama.OllamaEmbeddings(
# base_url='https://llm-sdsc-ollama.nrp-nautilus.io',
# model='nomic-embed-text'
# )
#
# return ollama_emb
def get_embedding_function():
ollama_emb = ollama.OllamaEmbeddings(model='nomic-embed-text')
return ollama_emb
def get_hg_embedding_function():
# vectorizer = HuggingFaceEmbeddings(model_name="all-MiniLM-L6-v2")
#
# return vectorizer
pass