An integration package connecting ModelScope and LangChain
Project description
langchain-modelscope-integration
This package contains the LangChain integration with ModelScope
Installation
pip install -U langchain-modelscope-integration
Head to ModelScope to sign up to ModelScope and generate an SDK token. Once you've done this set the MODELSCOPE_SDK_TOKEN
environment variable:
export MODELSCOPE_SDK_TOKEN=<your_sdk_token>
Chat Models
ModelScopeChatEndpoint
class exposes chat models from ModelScope. See available models here.
from langchain_modelscope import ModelScopeChatEndpoint
llm = ModelScopeChatEndpoint(model="Qwen/Qwen2.5-Coder-32B-Instruct")
llm.invoke("Sing a ballad of LangChain.")
Embeddings
ModelScopeEmbeddings
class exposes embeddings from ModelScope.
from langchain_modelscope import ModelScopeEmbeddings
embeddings = ModelScopeEmbeddings(model_id="damo/nlp_corom_sentence-embedding_english-base")
embeddings.embed_query("What is the meaning of life?")
LLMs
ModelScopeLLM
class exposes LLMs from ModelScope.
from langchain_modelscope import ModelScopeLLM
llm = ModelScopeLLM(model="Qwen/Qwen2.5-Coder-32B-Instruct")
llm.invoke("The meaning of life is")
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
File details
Details for the file langchain_modelscope_integration-0.1.0.tar.gz
.
File metadata
- Download URL: langchain_modelscope_integration-0.1.0.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e50fc9eb6b7b187a73ce535cdfd49e442f3d90c27e1d570b786549e3ee508f9 |
|
MD5 | f510f6dfcb05654fda95907d4eeeb395 |
|
BLAKE2b-256 | 06f4480da31d8a01a69a76122e1bf32a8a27c865b2de21e3483217ea93cfc3d8 |
File details
Details for the file langchain_modelscope_integration-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: langchain_modelscope_integration-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94ebfdba8526fc1165406ca3fa0566a0a237f890d283cffacf0dbc1e45e6c42e |
|
MD5 | d4f5b5a7af68908313e8093ccebdda29 |
|
BLAKE2b-256 | 621baf5aa7ecb1ba363da978410d7ea58b2183b45a9cad7a056f1ad9cec22bbc |