Unleashing the Power of Open Source Text Embeddings with open-text-embeddings

Lim Chee Kin
3 min readNov 13, 2023

Introduction

In the dynamic landscape of Large Language Model (LLM), harnessing the capabilities of OpenAI’s API has become a staple for many open source projects. The OpenAI’s API-compatible completions and chat/completions endpoints are well-supported, but there's a gap when it comes to the embeddings endpoint. In this article, we delve into the groundbreaking open-text-embeddings package, a project with a mission to bridge this gap and revolutionize the integration of open source text embeddings in your applications.

Disclaimer: I’m the creator of the open-text-embeddings package.

Project Goal: Paving the Way for embeddings Support

The primary objective of the open-text-embeddings project is clear: create an OpenAI API-compatible version of the embeddings endpoint. This entails seamless support for open source sentence-transformer models and other models, including those championed by LangChain's HuggingFaceEmbeddings, HuggingFaceInstructEmbeddings, and HuggingFaceBgeEmbeddings classes.

Supported Text Embeddings Models: A Comprehensive Compilation

The project has meticulously tested a compilation of open-source models via the embeddings endpoint. Explore the power of:

These models have undergone rigorous testing and verification, ensuring seamless performance with the endpoint. To experience the capabilities of these models firsthand, simply click on the “Test It Yourself” link. These models are conveniently hosted on public HuggingFace Docker Spaces, made possible by the generous computing resources provided by HuggingFace Spaces.

Understanding Model Discrepancies: A Crucial Insight

It’s not immediately apparent that using models like BAAI/bge-* and intfloat/e5-* with the embeddings endpoint can yield different results based on the input format. Consider this: a JSON input as a string vs. a JSON input as a list of strings. The nuances are critical, and the project emphasizes the importance of adhering to specific guidelines to ensure optimal performance.

Demo: Hands-On Exploration

Ready to experience the power of open-text-embeddings firsthand? Dive into the browser-based demo, accessible with a single click. Open in Colab

Standalone FastAPI Server: Empowering Local Inference

Want to run the embeddings endpoint locally as a standalone FastAPI server? The step-by-step guide provides you with everything you need. From installing dependencies to choosing models, configuring options like normalization and GPU usage, you’ll have full control over the server’s performance based on your specific requirements.

AWS Lambda Deployment: Seamless Cloud Integration

Take your embeddings to the cloud! Deploying the embeddings endpoint as an AWS Lambda Function is made simple with GitHub Actions. Fork the repository, add your AWS credentials to secrets, and trigger GitHub Actions to deploy or remove the Lambda Function. It’s a hassle-free way to extend the reach of your applications.

Exciting Announcement: open-text-embeddings 1.0.3 Released Today!

We’re thrilled to announce the release of open-text-embeddings version 1.0.3, available today on November 13, 2023. This release brings enhanced stability, improved performance, and additional features to make your open source text embedding experience even more seamless. Check out the latest release on the project's GitHub repository and stay tuned for more exciting updates.

Conclusion: Embrace the Future of Text Embeddings

In conclusion, the open-text-embeddings package opens doors to a new era of text embeddings capabilities. By seamlessly integrating the embeddings endpoint into your projects, you unlock the true potential of open source text embeddings. The comprehensive guide provided here empowers you to explore, experiment, and elevate your LLM applications. Embrace the future of text processing with open-text-embeddings. Your journey starts now!

--

--

Lim Chee Kin

A business-minded full stack developer. Experienced in Java technology, interested on DApps, Solidity, Flutter, online marketing and algorithmic trading.