A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://python.langchain.com/docs/integrations/text_embedding/textembed below:

TextEmbed - Embedding Inference Server

TextEmbed - Embedding Inference Server

TextEmbed is a high-throughput, low-latency REST API designed for serving vector embeddings. It supports a wide range of sentence-transformer models and frameworks, making it suitable for various applications in natural language processing.

Features Getting Started Prerequisites

Ensure you have Python 3.10 or higher installed. You will also need to install the required dependencies.

Installation via PyPI
  1. Install the required dependencies:

  2. Start the TextEmbed server with your desired models:

    python -m textembed.server --models sentence-transformers/all-MiniLM-L12-v2 --workers 4 --api-key TextEmbed 

For more information, please read the documentation.

Import
from langchain_community.embeddings import TextEmbedEmbeddings
embeddings = TextEmbedEmbeddings(
model="sentence-transformers/all-MiniLM-L12-v2",
api_url="http://0.0.0.0:8000/v1",
api_key="TextEmbed",
)
Embed your documents

documents = [
"Data science involves extracting insights from data.",
"Artificial intelligence is transforming various industries.",
"Cloud computing provides scalable computing resources over the internet.",
"Big data analytics helps in understanding large datasets.",
"India has a diverse cultural heritage.",
]


query = "What is the cultural heritage of India?"

document_embeddings = embeddings.embed_documents(documents)


query_embedding = embeddings.embed_query(query)

import numpy as np

scores = np.array(document_embeddings) @ np.array(query_embedding).T
dict(zip(documents, scores))
{'Data science involves extracting insights from data.': 0.05121298956322118,
'Artificial intelligence is transforming various industries.': -0.0060612142358469345,
'Cloud computing provides scalable computing resources over the internet.': -0.04877402795301714,
'Big data analytics helps in understanding large datasets.': 0.016582168576929422,
'India has a diverse cultural heritage.': 0.7408992963028144}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4