๐
A work in progress
The local dev environment uses ollama to serve the LLM.
You may require further tweaks to properly make use of your GPU. Refer to the ollama docker image documentation.
- Make sure git-lfs is installed:
Fedora: `sudo dnf install git-lfs` MacOS: `brew install git-lfs` git lfs install
- Create the directory which will house the local environment data:
mkdir data
- Create a directory to house the embedding model and download the
snowflake-arctic-embed-m-long
model:mkdir data/embeddings git clone https://huggingface.co/Snowflake/snowflake-arctic-embed-m-long \ data/embeddings/snowflake-arctic-embed-m-long
- Invoke docker compose (postgres data will persist in
data/postgres
):docker compose up --build
- Pull the mistral LLM (data will persist in
data/ollama
):docker exec tangerine-ollama ollama pull mistral
- The API can now be accessed on
http://localhost:5000
Some of the images used in the docker-compose.yml
wont work on Apple Silicon Macs. In order to develop on those system you will need to start some of the processes manually.
You'll ned to have the following installed and working before proceeding on:
- Brew
- Pipenv
- Pyenv
- Docker or Podman
- Install Ollama
brew install ollama
- Start Ollama
ollama serve
- Pull the language and embedding models
ollama pull mistral
ollama pull nomic-embed-text
- Install the C API for Postgres (libpq)
brew install libpq
Tip
For Apple Silicon Macs, you'll need to export the following environment variable to avoid the issues with ligpg c library errors: export PATH="/opt/homebrew/opt/libpq/bin:$PATH" export LDFLAGS="-L/opt/homebrew/opt/libpq/lib" export CPPFLAGS="-I/opt/homebrew/opt/libpq/include"
- Start the Vector database
docker run -e POSTGRES_PASSWORD="citrus" -e POSTGRES_USER="citrus" -e POSTGRES_DB="citrus" -e POSTGRES_HOST_AUTH_METHOD=trust -p 5432:5432 pgvector/pgvector:pg16
- Prepare the Python virtual environment:
pipenv --python=3.11
pipenv install
pipenv shell
- Start Tangerine Backend
Note
The default tangerine port, 5000, is already claimed by Bonjour on Macs, so we need to use a different port instead.
flask run --host=127.0.0.1 --port=8000
You can now communicate with the API on port 8000
curl -XGET 127.0.0.1:8000/api/agents
{
"data": []
}
To run the UI in a development environment, see tangerine-frontend
You can populate the vector database and list of agents by processing documents pulled from an S3 bucket. To do so you'll need to do the following:
- Export environment variables that contain your S3 bucket auth info:
export AWS_ACCESS_KEY_ID="MYKEYID"
export AWS_DEFAULT_REGION="us-east-1"
export AWS_ENDPOINT_URL_S3="https://s3.us-east-1.amazonaws.com"
export AWS_SECRET_ACCESS_KEY="MYACCESSKEY"
export BUCKET="mybucket"
-
Create an
s3.yaml
file that describes your agents and the documents they should ingest. Sees3-example.yaml
for an example. -
Run the ingest script
flask s3sync
- Start the server and you should see your data available via the API.
Path | Method | Description |
---|---|---|
/api/agents |
GET |
Get a list of all agents |
/api/agents |
POST |
Create a new agent |
/api/agents/<id> |
GET |
Get an agent |
/api/agents/<id> |
PUT |
Update an agent |
/api/agents/<id> |
DELETE |
Delete an agent |
/api/agents/<id>/chat |
POST |
Chat with an agent |
/api/agents/<id>/documents |
POST |
Agent document uploads |
/api/agents/<id>/documents |
DELETE |
Delete agent documents |
/api/agentDefaults |
GET |
Get agent default settings |
/ping |
GET |
Health check |