LocalAI/examples/langchain
Dave 1c312685aa
refactor: move remaining api packages to core (#1731)
* core 1

* api/openai/files fix

* core 2 - core/config

* move over core api.go and tests to the start of core/http

* move over localai specific endpoints to core/http, begin the service/endpoint split there

* refactor big chunk on the plane

* refactor chunk 2 on plane, next step: port and modify changes to request.go

* easy fixes for request.go, major changes not done yet

* lintfix

* json tag lintfix?

* gitignore and .keep files

* strange fix attempt: rename the config dir?
2024-03-01 16:19:53 +01:00
..
langchainjs-localai-example refactor: move remaining api packages to core (#1731) 2024-03-01 16:19:53 +01:00
langchainpy-localai-example Langchain Example Updates (#199) 2023-05-06 00:21:06 +02:00
.gitignore Add LangchainJS Examples (#146) 2023-05-01 23:18:14 +02:00
docker-compose.yaml images: cleanup, drop .dev Dockerfile (#437) 2023-05-30 15:58:10 +02:00
JS.Dockerfile Add LangchainJS Examples (#146) 2023-05-01 23:18:14 +02:00
models Cleaning up examples/ models and starter .env files (#1124) 2023-10-02 18:14:10 +02:00
PY.Dockerfile Langchain Example Updates (#199) 2023-05-06 00:21:06 +02:00
README.md Langchain Example Updates (#199) 2023-05-06 00:21:06 +02:00

langchain

Example of using langchain, with the standard OpenAI llm module, and LocalAI. Has docker compose profiles for both the Typescript and Python versions.

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 for typescript!
docker-compose --profile ts up --build

# or start with docker-compose for python!
docker-compose --profile py up --build

Some of the example code in index.mts and full_demo.py 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.