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

llama_index_embeddings_deepinfra-0.5.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

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

File metadata

  • Download URL: llama_index_embeddings_deepinfra-0.5.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_embeddings_deepinfra-0.5.0.tar.gz
Algorithm Hash digest
SHA256 f5af575075da27f3a9c23af89c9c49a7fd56a7f0afe35181ae3f8ea940d224b9
MD5 595df8c00bff178a42b96231d2d1fbd2
BLAKE2b-256 14ee580fa9c740b016ebef27ba654bf4bcd7f67c24c0bb14968feba494be5d72

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llama_index_embeddings_deepinfra-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_embeddings_deepinfra-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e566eb8fc02ec220cff21bccc709bd705f2fc7414760a58772b57c428efbc544
MD5 873a5722775617ec03006adcb6e0bbde
BLAKE2b-256 4654a3693355abadbce9232cd388e8ecce8d115e78c0ff30049e9a60c289b6a9

See more details on using hashes here.

Supported by

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