Skip to main content

LlamaIndex Llms Integration: ModelScope

Installation

To install the required package, run:

!pip install llama-index-llms-modelscope

Basic Usage

Initialize the ModelScopeLLM

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

import sys
from llama_index.llms.modelscope import ModelScopeLLM

llm = ModelScopeLLM(model_name="qwen/Qwen3-8B", model_revision="master")

Generate Completions

To generate a text completion for a prompt, use the complete method:

rsp = llm.complete("Hello, who are you?")
print(rsp)

Using Message Requests

You can chat with the model by using a list of messages. Here’s how to set it up:

from llama_index.core.base.llms.types import MessageRole, ChatMessage

messages = [
    ChatMessage(
        role=MessageRole.SYSTEM, content="You are a helpful assistant."
    ),
    ChatMessage(role=MessageRole.USER, content="How to make cake?"),
]
resp = llm.chat(messages)
print(resp)

LLM Implementation example

https://docs.llamaindex.ai/en/stable/examples/llm/modelscope/

Metadata

Release files for llama-index-llms-modelscope 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-llms-modelscope 0.7.0
File Size Uploaded Provenance
llama_index_llms_modelscope-0.7.0.tar.gz 5.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-llms-modelscope 0.7.0
File Interpreter ABI Platform
llama_index_llms_modelscope-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / llama_index_llms_modelscope-0.7.0.tar.gz

Download URL llama_index_llms_modelscope-0.7.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
abfee6ebb5a6088ba45797e2d678bf1dd6b1d72b645222581f1c61d84120038a
BLAKE2b-256 checksum
How to use checksums
cbc524ca7f8a704118a5243259555290f5055b33ed26ba2f5ca7392eb350ba81
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / llama_index_llms_modelscope-0.7.0-py3-none-any.whl

Download URL llama_index_llms_modelscope-0.7.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b6492bb7bb1932c7980dd0c0d7d87baa62d09e1d3cd60754203a09554ae7ef2
BLAKE2b-256 checksum
How to use checksums
6c27dac7c63fae7130ed086c9dee7f8b3b9c79feaaa9c4521ecd7e1ff1f22689
Upload date
Uploaded using Trusted Publishing?
What is 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}

Security for llama-index-llms-modelscope 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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