Skip to main content

llama-index embeddings deepinfra integration

Project description

LlamaIndex Embeddings Integration: Deepinfra

With this integration, you can use the Deepinfra embeddings model to get embeddings for your text data. Here is the link to the embeddings models.

First, you need to sign up on the Deepinfra website and get the API token. You can copy model_ids over the model cards and start using them in your code.

Installation

pip install llama-index llama-index-embeddings-deepinfra

Usage

from dotenv import load_dotenv, find_dotenv
from llama_index.embeddings.deepinfra import DeepInfraEmbeddingModel

# Load environment variables
_ = load_dotenv(find_dotenv())

# Initialize model with optional configuration
model = DeepInfraEmbeddingModel(
    model_id="BAAI/bge-large-en-v1.5",  # Use custom model ID
    api_token="YOUR_API_TOKEN",  # Optionally provide token here
    normalize=True,  # Optional normalization
    text_prefix="text: ",  # Optional text prefix
    query_prefix="query: ",  # Optional query prefix
)

# Example usage
response = model.get_text_embedding("hello world")

# Batch requests
texts = ["hello world", "goodbye world"]
response = model.get_text_embedding_batch(texts)

# Query requests
response = model.get_query_embedding("hello world")


# Asynchronous requests
async def main():
    text = "hello world"
    response = await model.aget_text_embedding(text)


if __name__ == "__main__":
    import asyncio

    asyncio.run(main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

File details

Details for the file llama_index_embeddings_deepinfra-0.2.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_embeddings_deepinfra-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2300de7b84d731143d47c750cc0886d7175cb2b7de752d05a81ae44ff4af7947
MD5 86b3e2e754e2f0689011fbad86c50ba2
BLAKE2b-256 7dee7014da58187dbc21714bdefc6d2b6d801d9a50bb45c5536aa0a7f1716a9e

See more details on using hashes here.

File details

Details for the file llama_index_embeddings_deepinfra-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_embeddings_deepinfra-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 833c0d0c40d31f0faef27cde21a66b0aa972e711cda47cc9c176280f024d3b01
MD5 f6703c653e01f4bcda699ec9c890efe7
BLAKE2b-256 89ce8d5bf3bf464d0758b7b41a203ba5e934edc1a7fce0efef98e2f1ab91bdec

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page