Skip to content

Commit 95ae62c

Browse files
mspronestijimpang
authored andcommitted
docs: add instruction for langchain (vllm-project#1162)
1 parent 697049b commit 95ae62c

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Documentation
6666
serving/run_on_sky
6767
serving/deploying_with_triton
6868
serving/deploying_with_docker
69+
serving/serving_with_langchain
6970

7071
.. toctree::
7172
:maxdepth: 1
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.. _run_on_langchain:
2+
3+
Serving with Langchain
4+
============================
5+
6+
vLLM is also available via `Langchain <https://github.com/langchain-ai/langchain>`_ .
7+
8+
To install langchain, run
9+
10+
.. code-block:: console
11+
12+
$ pip install langchain -q
13+
14+
To run inference on a single or multiple GPUs, use ``VLLM`` class from ``langchain``.
15+
16+
.. code-block:: python
17+
18+
from langchain.llms import VLLM
19+
20+
llm = VLLM(model="mosaicml/mpt-7b",
21+
trust_remote_code=True, # mandatory for hf models
22+
max_new_tokens=128,
23+
top_k=10,
24+
top_p=0.95,
25+
temperature=0.8,
26+
# tensor_parallel_size=... # for distributed inference
27+
)
28+
29+
print(llm("What is the capital of France ?"))
30+
31+
Please refer to this `Tutorial <https://github.com/langchain-ai/langchain/blob/master/docs/extras/integrations/llms/vllm.ipynb>`_ for more details.

0 commit comments

Comments
 (0)