langchain/docs
keval dekivadiya 06f47678ae
community[minor]: Add TextEmbed Embedding Integration (#22946)
**Description:**

**TextEmbed** is a high-performance embedding inference server designed
to provide a high-throughput, low-latency solution for serving
embeddings. It supports various sentence-transformer models and includes
the ability to deploy image and text embedding models. TextEmbed offers
flexibility and scalability for diverse applications.

- **PyPI Package:** [TextEmbed on
PyPI](https://pypi.org/project/textembed/)
- **Docker Image:** [TextEmbed on Docker
Hub](https://hub.docker.com/r/kevaldekivadiya/textembed)
- **GitHub Repository:** [TextEmbed on
GitHub](https://github.com/kevaldekivadiya2415/textembed)

**PR Description**
This PR adds functionality for embedding documents and queries using the
`TextEmbedEmbeddings` class. The implementation allows for both
synchronous and asynchronous embedding requests to a TextEmbed API
endpoint. The class handles batching and permuting of input texts to
optimize the embedding process.

**Example Usage:**

```python
from langchain_community.embeddings import TextEmbedEmbeddings

# Initialise the embeddings class
embeddings = TextEmbedEmbeddings(model="your-model-id", api_key="your-api-key", api_url="your_api_url")

# Define a list of 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."
]

# Define a query
query = "What is the cultural heritage of India?"

# Embed all documents
document_embeddings = embeddings.embed_documents(documents)

# Embed the query
query_embedding = embeddings.embed_query(query)

# Print embeddings for each document
for i, embedding in enumerate(document_embeddings):
    print(f"Document {i+1} Embedding:", embedding)

# Print the query embedding
print("Query Embedding:", query_embedding)

---------

Co-authored-by: Eugene Yurtsev <eugene@langchain.dev>
2024-07-19 17:30:25 +00:00
..
api_reference docs: readthedocs deprecation fix (#24321) 2024-07-16 20:32:51 +00:00
data 👥 Update LangChain people data (#23697) 2024-07-01 17:42:55 +00:00
docs community[minor]: Add TextEmbed Embedding Integration (#22946) 2024-07-19 17:30:25 +00:00
scripts docs[patch]: Remove deprecated Airbyte loaders from listings (#23927) 2024-07-10 02:21:25 +00:00
src docs: chain migration guide (#23844) 2024-07-05 16:37:34 -07:00
static docs[patch]: Update intro diagram (#24290) 2024-07-15 22:04:42 -07:00
.gitignore
.yarnrc.yml
babel.config.js
docusaurus.config.js docs: rm discord (#23985) 2024-07-08 14:27:58 -07:00
ignore-step.sh infra: docs ignore step in script (#24090) 2024-07-10 15:18:00 -07:00
Makefile docs: remove couchbase from docs linking (#24277) 2024-07-15 17:34:41 +00:00
package.json docs[patch]: Adds feedback input after thumbs up/down (#23141) 2024-06-18 16:08:22 -07:00
README.md
sidebars.js docs[minor]: Hide langserve pages (#23618) 2024-06-28 08:25:08 -07:00
vercel_build.sh
vercel_requirements.txt package: security update urllib3 to @1.26.19 (#23366) 2024-06-24 19:44:39 +00:00
vercel.json infra: docs ignore step in script (#24090) 2024-07-10 15:18:00 -07:00
yarn.lock docs[patch]: Adds feedback input after thumbs up/down (#23141) 2024-06-18 16:08:22 -07:00

LangChain Documentation

For more information on contributing to our documentation, see the Documentation Contributing Guide