Skip to main content

llama-index embeddings xinference integration

Project description

LlamaIndex Embeddings Integration: Xinference

Xorbits Inference (Xinference) is an open-source platform to streamline the operation and integration of a wide array of AI models.

You can find a list of built-in embedding models in Xinference from its document Embedding Models

To learn more about Xinference in general, visit https://inference.readthedocs.io/en/latest/

Installation

pip install llama-index-embeddings-xinference

Usage

Parameters Description:

  • model_uid: Model uid not the model name, sometimes they may be the same (e.g., bce-embedding-base_v1).
  • base_url: base url of Xinference (e.g., http://localhost:9997).
  • timeout: request timeout set (default 60s).
  • prompt: Text to embed.

Text Embedding Example

from llama_index.embeddings.xinference import XinferenceEmbedding

xi_model_uid = "xinference model uid"
xi_base_url = "xinference base url"

xi_embed = XinferenceEmbedding(
    model_uid=xi_model_uid,
    base_url=xi_base_url,
    timeout=60,
)


def text_embedding(prompt: str):
    embeddings = xi_embed.get_query_embedding(prompt)
    print(embeddings)


async def async_text_embedding(prompt: str):
    embeddings = await xi_embed.aget_query_embedding(prompt)
    print(embeddings)

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_xinference-0.1.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_embeddings_xinference-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b0e3b9b257b73e52ce0af1b7860a3234b4eda0e3ce9ac4dab05615804edf8aed
MD5 963d4853e83c4b25e81e72e8a8f28607
BLAKE2b-256 ed0260927d0bab5220bfcc495edb65228a156d681547167134d8cd42397bbd9c

See more details on using hashes here.

File details

Details for the file llama_index_embeddings_xinference-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_embeddings_xinference-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6bd5b4e2d02ec08276bf71293f3e6d5e6e554b62c9dcb0a4abe9cf4e47e279dd
MD5 36570151f94ab97a3fcfb3904fb8d036
BLAKE2b-256 475a3a7d6067405ad8e180a55992e865296b34e6fd688a097d41e95a8cf73b56

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