Files
landing_page/qdrant-landing/content/documentation/integrations/aleph-alpha.md
T
3215985d1d Improved Nested Docs and Link Grouping Support (#147)
* added a table of content

* wide layout for docs, styles for the table of content

* fixes for docs layout

* wide footer at the docs section

* added support for nested docs, added toggling groups of links, delimiters, external links

* external link icon

* added active state for nested links, styles for the external link icon

* styles fix

* remove doc sync

* update directory structure and doc titles

* fix outstanding links

* fix more links for merge

* Revert "fix more links for merge"

This reverts commit 46c9ccaf1b7765f2cda8dc85d625fa6b4e3f5436.

* Revert "fix outstanding links"

This reverts commit 28e6380b74f1ab74690c8184551f186656d6d4e9.

* fix remaining broken links

* move how-to tutorials in the different page

* split tutorials

* fix link

* upd github edit link

* skip empty index pages

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
Co-authored-by: David Sertic <62056091+davidmyriel@users.noreply.github.com>
2023-05-29 15:11:40 +02:00

58 lines
1.6 KiB
Markdown

---
title: Aleph Alpha
weight: 900
---
Aleph Alpha is a multimodal and multilingual embeddings' provider. Their API allows creating the embeddings for text and images, both
in the same latent space. They maintain an [official Python client](https://github.com/Aleph-Alpha/aleph-alpha-client) that might be
installed with pip:
```bash
pip install aleph-alpha-client
```
There is both synchronous and asynchronous client available. Obtaining the embeddings for an image and storing it into Qdrant might
be done in the following way:
```python
import qdrant_client
from aleph_alpha_client import (
Prompt,
AsyncClient,
SemanticEmbeddingRequest,
SemanticRepresentation,
ImagePrompt
)
from qdrant_client.http.models import Batch
aa_token = "<< your_token >>"
model = "luminous-base"
qdrant_client = qdrant_client.QdrantClient()
async with AsyncClient(token=aa_token) as client:
prompt = ImagePrompt.from_file("./path/to/the/image.jpg")
prompt = Prompt.from_image(prompt)
query_params = {
"prompt": prompt,
"representation": SemanticRepresentation.Symmetric,
"compress_to_size": 128,
}
query_request = SemanticEmbeddingRequest(**query_params)
query_response = await client.semantic_embed(
request=query_request, model=model
)
qdrant_client.upsert(
collection_name="MyCollection",
points=Batch(
ids=[1],
vectors=[query_response.embedding],
)
)
```
If we wanted to create text embeddings with the same model, we wouldn't use `ImagePrompt.from_file`, but simply provide the input
text into the `Prompt.from_text` method.