Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mixedbread ai integration #152

Merged
merged 5 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions integrations/mixedbread-ai.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
layout: integration
name: mixedbread ai
description: Use mixedbread's models as well as top open-source models in seconds
authors:
- name: mixedbread ai
socials:
github: mixedbread-ai
website: mixedbread.ai
pypi: https://pypi.org/project/mixedbread_ai_haystack/
repo: https://github.com/mixedbread-ai/mixedbread-ai-haystack
type: Model Provider
report_issue: https://github.com/mixedbread-ai/mixedbread-ai-haystack/issues
logo: /logos/mixedbread-ai.png
toc: true
---

# mixedbread ai haytack 2.0 integration
juliuslipp marked this conversation as resolved.
Show resolved Hide resolved

mixedbread ai offers a seamless integration for users to employ both mixedbread's models and top open-source models effortlessly. Our platform stands out with its capability to re-rank, provide multi-modal embeddings, classifiers, and more. We're on a mission to make AI accessible to everyone, and we're excited to bring our state-of-the-art models to the Haystack community.

### **Table of Contents**

- [Installation](#installation)
- [Usage](#usage)


## Installation

Install the mixedbread ai integration with a simple pip command:

```bash
pip install mixedbread_ai_haystack
```

## Usage

You can use mixedbread's embedding models with the [MixedbreadAiTextEmbedder](https://github.com/mixedbread-ai/mixedbread-ai-haystack/blob/main/mixedbread_ai_haystack/embedders/text_embedder.py) and [MixedbreadAiDocumentEmbedder](https://github.com/mixedbread-ai/mixedbread-ai-haystack/blob/main/mixedbread_ai_haystack/embedders/document_embedder.py).
juliuslipp marked this conversation as resolved.
Show resolved Hide resolved

For documents you can use MixedbreadAiDocumentEmbedder and for queries you can use MixedbreadAiTextEmbedder. Once you've selected the component for your specific use case, initialize the component with the model name and mixedbread ai API key. You can also set the environment variable `MIXEDBREAD_API_KEY` instead of passing the api key as an argument.
juliuslipp marked this conversation as resolved.
Show resolved Hide resolved

Here's a basic example:
juliuslipp marked this conversation as resolved.
Show resolved Hide resolved

```python
from haystack import Document, Pipeline
from haystack.document_stores.in_memory import InMemoryDocumentStore
from haystack.components.writers import DocumentWriter
from mixedbread_ai_haystack.embedders import MixedbreadAiDocumentEmbedder

document_store = InMemoryDocumentStore(embedding_similarity_function="cosine")

documents = [Document(content="Sample text for love"), Document(content="and not for hate"), Document(content="Sample text for mixedbread ai integration")]

indexing_pipeline = Pipeline()
indexing_pipeline.add_component("embedder", MixedbreadAiDocumentEmbedder(api_key="MIXEDBREAD_API_KEY", model="UAE-Large-V1"))
indexing_pipeline.add_component("writer", DocumentWriter(document_store=document_store))
indexing_pipeline.connect("embedder", "writer")

indexing_pipeline.run({"embedder": {"documents": documents}})
```

Leverage the power of mixedbread ai to bring state-of-the-art ai capabilities to your applications effortlessly.
Binary file added logos/mixedbread-ai.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.