Instructions to use thenlper/gte-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use thenlper/gte-large with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("thenlper/gte-large") sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Inference
- Notebooks
- Google Colab
- Kaggle
Using gte-large locally for embedding pdf documents for llama cpp model with langchain.
Hello
I am building an open source Rag to run locally with llama cpp gguf models. I am able to embed documents using llamaindex with gte large and query them but I am facing trouble doing so with langchain. I have been able to use langchain with open ai models but not with open source model, is there some documentation regarding it.
for langchain, please refer to https://python.langchain.com/docs/integrations/text_embedding/huggingfacehub/
from langchain_community.embeddings import HuggingFaceInferenceAPIEmbeddings
embeddings = HuggingFaceInferenceAPIEmbeddings(
api_key=inference_api_key, model_name="thenlper/gte-large"
)
query_result = embeddings.embed_query(text)
query_result[:3]
Thank you for your response I am able to use them.
how to use it with langchain locally instead of using api