"csrc/vscode:/vscode.git/clone" did not exist on "0aa2480f67bc161f27d96e4940bc38f22eaa98c8"
langchain.md 791 Bytes
Newer Older
1
2
3
4
---
title: LangChain
---
[](){ #serving-langchain }
5

6
vLLM is also available via [LangChain](https://github.com/langchain-ai/langchain) .
7

8
To install LangChain, run
9
10

```console
11
pip install langchain langchain_community -q
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
```

To run inference on a single or multiple GPUs, use `VLLM` class from `langchain`.

```python
from langchain_community.llms import VLLM

llm = VLLM(model="mosaicml/mpt-7b",
           trust_remote_code=True,  # mandatory for hf models
           max_new_tokens=128,
           top_k=10,
           top_p=0.95,
           temperature=0.8,
           # tensor_parallel_size=... # for distributed inference
)

print(llm("What is the capital of France ?"))
```

Please refer to this [Tutorial](https://python.langchain.com/docs/integrations/llms/vllm) for more details.