diff --git a/docker-compose.ollama.yml b/docker-compose.ollama.yml new file mode 100644 index 000000000..c38afffde --- /dev/null +++ b/docker-compose.ollama.yml @@ -0,0 +1,10 @@ +services: + ollama: + image: ollama/ollama:${OLLAMA__VERSION} + ports: + - 11434:11434 + volumes: + - ollama:/root/.ollama + +volumes: + ollama: diff --git a/docker-compose.yml b/docker-compose.yml index 3c5f40b33..774529e02 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -172,21 +172,9 @@ services: depends_on: - temporal_postgres_db - ollama: - container_name: ollama - tty: true - restart: unless-stopped - networks: - - core - image: ollama/ollama:${OLLAMA__VERSION} - ports: - - 11434:11434 - volumes: - - ollama:/root/.ollama volumes: core-db: temporal-db: - ollama: networks: core: diff --git a/docs/img/self-hosting/ai-action.png b/docs/img/self-hosting/ai-action.png new file mode 100644 index 000000000..156c28725 Binary files /dev/null and b/docs/img/self-hosting/ai-action.png differ diff --git a/docs/mint.json b/docs/mint.json index 4d5a740ba..4b01f3d30 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -90,7 +90,8 @@ "group": "Deployment Options", "pages": [ "self-hosting/deployment-options/docker-compose", - "self-hosting/deployment-options/aws-ecs" + "self-hosting/deployment-options/aws-ecs", + "self-hosting/deployment-options/ollama" ] }, { diff --git a/docs/self-hosting/deployment-options/ollama.mdx b/docs/self-hosting/deployment-options/ollama.mdx new file mode 100644 index 000000000..8ede8c35a --- /dev/null +++ b/docs/self-hosting/deployment-options/ollama.mdx @@ -0,0 +1,47 @@ +--- +title: Self-hosted LLMs +description: Learn how to self-host LLMs in Tracecat with Ollama. +--- + +## Prerequisites + +- Basic Tracecat deployment with [Docker Compose](/self-hosting/deployment-options/docker-compose) +- Minimum 10GB of disk space + +## Instructions + + + Deploying self-hosted LLMs is resource intensive with large downloads and large model weights. + The Ollama Docker image is 1.5GB+ large and model weights can vary greatly in size. + + Only models less than 5GB in size are currently supported. + + +Tracecat supports self-hosted LLMs through [Ollama](https://ollama.ai/). + +Supported models: + +- [`llama3.2`](https://ollama.com/library/llama3.2): 1.3GB +- [`llama3.2:1b`](https://ollama.com/library/llama3.2): 2.0GB + + + + Specify the open source models you wish to use in Tracecat by setting the `TRACECAT__PRELOAD_OSS_MODELS` environment variable in the `.env` file. + + For example, to preload the `llama3.2` model, set the following: + ``` + TRACECAT__PRELOAD_OSS_MODELS=llama3.2 + ``` + + + Deploy Tracecat with the Ollama docker compose extension: + ```bash + docker compose up -f docker-compose.yml -f docker-compose.ollama.yml up -d + ``` + + + You can now use Tracecat's AI action to call your preloaded open source LLMs. + For example, to call the `llama3.2` model, you can specify the following arguments: + ![AI Action](/img/self-hosting/ai-action.png) + + diff --git a/docs/self-hosting/introduction.mdx b/docs/self-hosting/introduction.mdx index c7bc7fae4..cd8051f0a 100644 --- a/docs/self-hosting/introduction.mdx +++ b/docs/self-hosting/introduction.mdx @@ -14,3 +14,6 @@ Choose from a number of deployment options listed below to get started. Use Terraform to deploy Tracecat into ECS Fargate. + +Interested in using open source LLMs (e.g. llama3.1) in Tracecat's AI actions? +Check out our guide on deploying [self-hosted LLMs](/self-hosting/deployment-options/ollama) with Tracecat's Ollama Docker Compose extension.