llama-index llms modelscope integration
Project description
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/
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llama_index_llms_modelscope-0.5.0.tar.gz.
File metadata
- Download URL: llama_index_llms_modelscope-0.5.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6003f0146f307b95b2739523022428f4f8692c24bc9dfaee766af4f17248a33a
|
|
| MD5 |
4b2dbe266e2e5ce42d2c680db623b54a
|
|
| BLAKE2b-256 |
003037251c202b6b5f7a9495e463c9fb7948b58b3b27f06d0bcc0b97d6055144
|
File details
Details for the file llama_index_llms_modelscope-0.5.0-py3-none-any.whl.
File metadata
- Download URL: llama_index_llms_modelscope-0.5.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf4af93594e28bfb1017d8752dcc690c07b5f49df1b527efa83ffe8f54d27433
|
|
| MD5 |
5a96458b6c1114185b6c225336fb2662
|
|
| BLAKE2b-256 |
fdbf70b137936c23abfcec47b78ea784a422526083652868db1d93b7dbe84126
|