Skip to main content

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)

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.7.0.tar.gz (3.8 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.7.0.tar.gz.

File metadata

  • Download URL: llama_index_embeddings_modelscope-0.7.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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_modelscope-0.7.0.tar.gz
Algorithm Hash digest
SHA256 d4e22493e3eea643ee43455b5885e82767de75ab29c2af455d28b928a32b9feb
MD5 161689fb017f47ad794ae24c522f9b6e
BLAKE2b-256 d7ba0264bcba5e65418775f932922eb8c634fbd9f03d03c08c582b48c748627f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llama_index_embeddings_modelscope-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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_modelscope-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3208c2d59ba0a92fe22d3bcaab64e19f3037a13aad500a9a402a63cedd63ba2
MD5 e74ced96eea41579de58060d46285dd5
BLAKE2b-256 ccb3074258a093cc9cb352f2669af0d9c00cb8cf8c94c91bff1493d4fcdadb72

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page