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
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_embeddings_modelscope-0.5.1.tar.gz.
File metadata
- Download URL: llama_index_embeddings_modelscope-0.5.1.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21dada9b822aba307d1ca02d16da1770b9cf241b52a31f066345b4a93d1bf7fe
|
|
| MD5 |
a8347ac0c8f285a440f933369a9cc66f
|
|
| BLAKE2b-256 |
77c41ba65af4b7bdf6b332145f029b1fcb33b57d7eb196d658c00ce40d37d485
|
File details
Details for the file llama_index_embeddings_modelscope-0.5.1-py3-none-any.whl.
File metadata
- Download URL: llama_index_embeddings_modelscope-0.5.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c16b75c6029529e93908518ee69cfd588ebb817e5faab1144574c9188cfb0496
|
|
| MD5 |
5b17dfac65e080d2088850cd4a356291
|
|
| BLAKE2b-256 |
92eec638ada02a8d991c38a7f2a9f46ac807400aef78bd98b1b957ceb902d491
|