Skip to main content

llama-index embeddings modelscope integration

Project description

LlamaIndex Embedding Integration: ModelScope

Installation

To install the required package, run:

!pip install llama-index-embeddings-modelscope

Basic Usage

Initialize the ModelScopeLLM

To use the ModelScopeEmbedding model, create an instance by specifying the model name and revision:

from llama_index.embeddings.modelscope.base import ModelScopeEmbedding

model = ModelScopeEmbedding(
    model_name="iic/nlp_gte_sentence-embedding_chinese-base",
    model_revision="master",
)

Generate Embedding

To generate a text embedding for a query, use the get_query_embedding method or get_text_embedding method:

rsp = model.get_query_embedding("Hello, who are you?")
print(rsp)

rsp = model.get_text_embedding("Hello, who are you?")
print(rsp)

Generate Batch Embedding

To generate a text embedding for a batch of text, use the get_text_embedding_batch method:

rsp = model.get_text_embedding_batch(
    ["Hello, who are you?", "I am a student."]
)
print(rsp)

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_modelscope-0.5.1.tar.gz (3.6 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_modelscope-0.5.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_embeddings_modelscope-0.5.1.tar.gz
Algorithm Hash digest
SHA256 21dada9b822aba307d1ca02d16da1770b9cf241b52a31f066345b4a93d1bf7fe
MD5 a8347ac0c8f285a440f933369a9cc66f
BLAKE2b-256 77c41ba65af4b7bdf6b332145f029b1fcb33b57d7eb196d658c00ce40d37d485

See more details on using hashes here.

File details

Details for the file llama_index_embeddings_modelscope-0.5.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_embeddings_modelscope-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c16b75c6029529e93908518ee69cfd588ebb817e5faab1144574c9188cfb0496
MD5 5b17dfac65e080d2088850cd4a356291
BLAKE2b-256 92eec638ada02a8d991c38a7f2a9f46ac807400aef78bd98b1b957ceb902d491

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