mirror of
https://github.com/hwchase17/langchain
synced 2024-11-08 07:10:35 +00:00
1efb9bae5f
- [Xorbits Inference(Xinference)](https://github.com/xorbitsai/inference) is a powerful and versatile library designed to serve language, speech recognition, and multimodal models. Xinference supports a variety of GGML-compatible models including chatglm, whisper, and vicuna, and utilizes heterogeneous hardware and a distributed architecture for seamless cross-device and cross-server model deployment. - This PR integrates Xinference models and Xinference embeddings into LangChain. - Dependencies: To install the depenedencies for this integration, run `pip install "xinference[all]"` - Example Usage: To start a local instance of Xinference, run `xinference`. To deploy Xinference in a distributed cluster, first start an Xinference supervisor using `xinference-supervisor`: `xinference-supervisor -H "${supervisor_host}"` Then, start the Xinference workers using `xinference-worker` on each server you want to run them on. `xinference-worker -e "http://${supervisor_host}:9997"` To use Xinference with LangChain, you also need to launch a model. You can use command line interface (CLI) to do so. Fo example: `xinference launch -n vicuna-v1.3 -f ggmlv3 -q q4_0`. This launches a model named vicuna-v1.3 with `model_format="ggmlv3"` and `quantization="q4_0"`. A model UID is returned for you to use. Now you can use Xinference with LangChain: ```python from langchain.llms import Xinference llm = Xinference( server_url="http://0.0.0.0:9997", # suppose the supervisor_host is "0.0.0.0" model_uid = {model_uid} # model UID returned from launching a model ) llm( prompt="Q: where can we visit in the capital of France? A:", generate_config={"max_tokens": 1024}, ) ``` You can also use RESTful client to launch a model: ```python from xinference.client import RESTfulClient client = RESTfulClient("http://0.0.0.0:9997") model_uid = client.launch_model(model_name="vicuna-v1.3", model_size_in_billions=7, quantization="q4_0") ``` The following code block demonstrates how to use Xinference embeddings with LangChain: ```python from langchain.embeddings import XinferenceEmbeddings xinference = XinferenceEmbeddings( server_url="http://0.0.0.0:9997", model_uid = model_uid ) ``` ```python query_result = xinference.embed_query("This is a test query") ``` ```python doc_result = xinference.embed_documents(["text A", "text B"]) ``` Xinference is still under rapid development. Feel free to [join our Slack community](https://xorbitsio.slack.com/join/shared_invite/zt-1z3zsm9ep-87yI9YZ_B79HLB2ccTq4WA) to get the latest updates! - Request for review: @hwchase17, @baskaryan - Twitter handle: https://twitter.com/Xorbitsio --------- Co-authored-by: Bagatur <baskaryan@gmail.com>
43 lines
1.2 KiB
TOML
43 lines
1.2 KiB
TOML
[tool.poetry]
|
|
name = "langchain-monorepo"
|
|
version = "0.0.1"
|
|
description = "LangChain mono-repo"
|
|
authors = []
|
|
license = "MIT"
|
|
readme = "README.md"
|
|
repository = "https://www.github.com/hwchase17/langchain"
|
|
|
|
|
|
[tool.poetry.dependencies]
|
|
python = ">=3.8.1,<4.0"
|
|
|
|
[tool.poetry.group.docs.dependencies]
|
|
langchain = { path = "libs/langchain/", develop = true }
|
|
autodoc_pydantic = "^1.8.0"
|
|
myst_parser = "^0.18.1"
|
|
nbsphinx = "^0.8.9"
|
|
sphinx = "^4.5.0"
|
|
sphinx-autobuild = "^2021.3.14"
|
|
sphinx_book_theme = "^0.3.3"
|
|
sphinx_rtd_theme = "^1.0.0"
|
|
sphinx-typlog-theme = "^0.8.0"
|
|
sphinx-panels = "^0.6.0"
|
|
toml = "^0.10.2"
|
|
myst-nb = "^0.17.1"
|
|
linkchecker = "^10.2.1"
|
|
sphinx-copybutton = "^0.5.1"
|
|
nbdoc = "^0.0.82"
|
|
|
|
|
|
[tool.poetry.group.codespell.dependencies]
|
|
codespell = "^2.2.0"
|
|
|
|
|
|
[tool.codespell]
|
|
skip = '.git,*.pdf,*.svg,*.pdf,*.yaml,*.ipynb,poetry.lock,*.min.js,*.css,package-lock.json,example_data,_dist,examples'
|
|
# Ignore latin etc
|
|
ignore-regex = '.*(Stati Uniti|Tense=Pres).*'
|
|
# whats is a typo but used frequently in queries so kept as is
|
|
# aapply - async apply
|
|
# unsecure - typo but part of API, decided to not bother for now
|
|
ignore-words-list = 'momento,collison,ned,foor,reworkd,parth,whats,aapply,mysogyny,unsecure,damon' |