Skip to main content

💻 langchain-xinference

This package contains the LangChain integration with Xinference

🤝 Support

  • Chat
  • Generate
  • Embeddings
  • Reranks
  • Tools Call

🚀 Installation

pip install -U langchain-xinference

☕ Chat Models

ChatXinference class exposes chat models from Xinference.

from langchain_xinference.chat_models import ChatXinference
from langchain.prompts import PromptTemplate

llm = ChatXinference(
  server_url="http://0.0.0.0:9997",  # replace your xinference server url
  model_uid={model_uid}  # replace model_uid with the model UID return from launching the model
         )
prompt = PromptTemplate(input=["country"], template="Q: where can we visit in the capital of {country}? A:")
chain = prompt | llm

chain.invoke(input={"country": "France"})

ai_res = chain.stream(input={"country": "France"})
for chunk in ai_res:
    print(chunk.content)

☕ Generate

Xinference class exposes LLMs from Xinference.

from langchain_xinference.llms import Xinference
from langchain.prompts import PromptTemplate

llm = Xinference(
    server_url="http://0.0.0.0:9997",  # replace your xinference server url
    model_uid={model_uid}  # replace model_uid with the model UID return from launching the model
 )
prompt = PromptTemplate(input=["country"], template="Q: where can we visit in the capital of {country}? A:")
chain = prompt | llm
chain.invoke(input={"country": "France"})

ai_res = chain.stream(input={"country": "France"})
for chunk in ai_res:
    print(chunk)

Metadata

Release files for langchain-xinference 0.1.2

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

Source distribution (sdist)

Source distribution for langchain-xinference 0.1.2
File Size Uploaded Provenance
langchain_xinference-0.1.2.tar.gz 8.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-xinference 0.1.2
File Interpreter ABI Platform
langchain_xinference-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 21.9 kB

Release files / langchain_xinference-0.1.2.tar.gz

Download URL langchain_xinference-0.1.2.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a31adfe8622ed92af41b13493b9519885f67c2a7cf4f4a8b2a349f43cdbc4c95
BLAKE2b-256 checksum
How to use checksums
14aa7fe1c08395bfc754047462e8461e8e81d685d927be8cb8a14f3d0576d967
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.8

Release files / langchain_xinference-0.1.2-py3-none-any.whl

Download URL langchain_xinference-0.1.2-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
105b0df4f07820d1b7ea3266ad4c62e9421a1e5a9a6f7d85d125d242b5e13ccc
BLAKE2b-256 checksum
How to use checksums
ff7ea1576089aa1252c61c6eb1dbfd49ed13b8b0646e66109b63c68fcce9db48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.8

Security for langchain-xinference 0.1.2

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.

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