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.3.0.tar.gz
.
File metadata
- Download URL: llama_index_embeddings_deepinfra-0.3.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6271692651dc33bde3caf84c7565550760283fde00bb21e751f0b63758345345 |
|
MD5 | c1a2194ce41f36525aed6abf4f4d5950 |
|
BLAKE2b-256 | 6522a775f9809493087db759a43323fecc5ffcdf100188d9b706c8a2a82260d7 |
File details
Details for the file llama_index_embeddings_deepinfra-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_embeddings_deepinfra-0.3.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 938c3bd89fbab8080916b4c828faa9503b857654886fe01cf9be0f165cbc309a |
|
MD5 | a046d7d11abe164ddceda9bb05544243 |
|
BLAKE2b-256 | 9ae7951e76028fde06bde70fdada0decfae4fa87afc0aeca12c707d1ddeb5849 |