LocalAI/examples/langchain
2023-05-02 14:41:40 -04:00
..
langchainjs-localai-example progress on a python langchain example. Requires upstream changes from langchain and the usage fix 2023-05-02 14:41:40 -04:00
langchainpy-localai-example progress on a python langchain example. Requires upstream changes from langchain and the usage fix 2023-05-02 14:41:40 -04:00
models Add LangchainJS Examples (#146) 2023-05-01 23:18:14 +02:00
.gitignore Add LangchainJS Examples (#146) 2023-05-01 23:18:14 +02:00
docker-compose.yaml progress on a python langchain example. Requires upstream changes from langchain and the usage fix 2023-05-02 14:41:40 -04:00
JS.Dockerfile Add LangchainJS Examples (#146) 2023-05-01 23:18:14 +02:00
PY.Dockerfile progress on a python langchain example. Requires upstream changes from langchain and the usage fix 2023-05-02 14:41:40 -04:00
README.md progress on a python langchain example. Requires upstream changes from langchain and the usage fix 2023-05-02 14:41:40 -04:00

langchain

Example of using langchain, with the standard OpenAI llm module, and LocalAI.

Typescript

Set up to make it easy to modify the index.mts file to look like any langchain example file.

Python

Please Note - This is a tech demo example at this time. ggml-gpt4all-j has pretty terrible results for most langchain applications with the settings used in this example.

Setup

# Clone LocalAI
git clone https://github.com/go-skynet/LocalAI

cd LocalAI/examples/langchain

# (optional) - Edit the example code in typescript.
# vi ./langchainjs-localai-example/index.ts

# Download gpt4all-j to models/
wget https://gpt4all.io/models/ggml-gpt4all-j.bin -O models/ggml-gpt4all-j

# start with docker-compose
docker-compose up --build

Some of the example code in index.mts is adapted from the langchainjs project and is Copyright (c) Harrison Chase. Used under the terms of the MIT license, as is the remainder of this code.