BHLquest
is an AI application designed to query the content of
the Biodiversity Heritage Library. The application is local and does
not depend on external services.
Ensure that your computer's Go version is up to date.
- Install and Run
llmutil
RESTful Interface
Follow instructions at llmutil documentation.
- Install Go Tools for
bhlquest
Navigate to the root of the bhlquest
project and execute:
make tools
go mod tidy
- Install
bhlquest
make install
- Install Prerequisits and Create Database
- Create
bhlnames
andbhlquest
databases in PostgreSQL. - Download the bhlnames database dump.
- Restore the
bhlnames
database:
zstd -dc bhlnames-xxxx-xx-xx.zst|pg_restore -d bhlnames
- Install the BHL text corpus.
- Install pgvector extension, which is necessary for storing vector data.
- Initial Run
First run wil create a configuration file, typically located at
$HOME/.config/bhlquest.yaml
:
bhlquest -V
- Edit
bhlquest.yaml
Ensure that database settings, llmutil
URL, directory which points to
the BHL corpus settings accurately reflect their real values.
- Import and Embed a Subset of BHL data into Vectors
bhlquest init --classes 'Aves,Mammalia' --rebuild-db
# if init process was interrupted, it can be continued from the place it
# stopped. Make sure the `--classes` values are the same as before.
# Remove `--rebuild-db` flag to keep alreday saved data.
bhlquest init --classes 'Aves,Mammalia'
If no clases are specified, the process will include all BHL data.
It will take a while!
- Use
bhlquest
via Command Line or RESTful API
bhlquest ask "What are the ecological niches of the Indigo Bunting?"
bhlquest serve
With the default settings, the API description should be accessible.
Install swag
from the root of the project:
make tools
To update the documentation, execute:
swag init -g server.go -d ./internal/io/web
Run this command each time the docs are updated.
You can use the openapi-generator
to create an API client in a language of
your choice. For instance, to generate a Ruby client, run the following
command from the project's root:
openapi-generator generate -i ./docs/swagger.yaml -g ruby -o ~/tmp/bhlquest --additional-properties gemName=bhlquest