Skip to main content

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?")

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

langchain_modelscope_integration-0.1.1.tar.gz (9.7 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 langchain_modelscope_integration-0.1.1.tar.gz.

File metadata

File hashes

Hashes for langchain_modelscope_integration-0.1.1.tar.gz
Algorithm Hash digest
SHA256 85137eec300194766653f1efadff3d17630e972c7a81f21872211f6d5b79642b
MD5 5ab886ed26ef975182585e66092b707a
BLAKE2b-256 af4e391721915011ce6e1cd3b584f558dd2c262cba90d9390f72c157fb3b16ec

See more details on using hashes here.

File details

Details for the file langchain_modelscope_integration-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_modelscope_integration-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e6b4985ec2ac340869c3d2d2d5c7413d91d22f0f3c62a5a26efd20aa4b9ba13d
MD5 f95ce68a31518b22a427bde360b8236e
BLAKE2b-256 67670759266bcf37055bf1e65a8a495968064163e0a51239f0a28416838fad47

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page