LocalAI/examples/query_data
2023-05-06 19:15:22 +02:00
..
data example(add): document query example 2023-05-05 21:56:31 +02:00
models example(add): document query example 2023-05-05 21:56:31 +02:00
.gitignore example(add): document query example 2023-05-05 21:56:31 +02:00
docker-compose.yml example(add): document query example 2023-05-05 21:56:31 +02:00
query.py Update readme and examples 2023-05-06 19:15:22 +02:00
README.md example(add): document query example 2023-05-05 21:56:31 +02:00
store.py Update readme and examples 2023-05-06 19:15:22 +02:00

Data query example

This example makes use of Llama-Index to enable question answering on a set of documents.

It loosely follows the quickstart.

Requirements

For this in order to work, you will need a model compatible with the llama.cpp backend. This is will not work with gpt4all.

The example uses WizardLM. Edit the config files in models/ accordingly to specify the model you use (change HERE).

You will also need a training data set. Copy that over data.

Setup

Start the API:

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

cd LocalAI/examples/query_data

# Copy your models, edit config files accordingly

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

Create a storage:

export OPENAI_API_BASE=http://localhost:8080/v1
export OPENAI_API_KEY=sk-

python store.py

After it finishes, a directory "storage" will be created with the vector index database.

Query

export OPENAI_API_BASE=http://localhost:8080/v1
export OPENAI_API_KEY=sk-

python query.py