Update examples to use the YAML config. Needs checking post release as we use the published docker image
This commit is contained in:
parent
268c26eb4e
commit
0e1f827da4
9 changed files with 79 additions and 87 deletions
|
|
@ -25,6 +25,13 @@ wheels/
|
|||
venv/
|
||||
env/
|
||||
|
||||
# Node.js
|
||||
node_modules/
|
||||
.next/
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Data
|
||||
*.lancedb/
|
||||
data/
|
||||
|
|
|
|||
|
|
@ -1,14 +1,3 @@
|
|||
# QA Provider for the research agent (ollama, openai, anthropic, etc.)
|
||||
QA_PROVIDER=ollama
|
||||
|
||||
# QA Model name
|
||||
QA_MODEL=gpt-oss:latest
|
||||
|
||||
# Ollama base URL (only needed if using ollama provider)
|
||||
# For Docker: http://host.docker.internal:11434
|
||||
# For local development: http://localhost:11434
|
||||
OLLAMA_BASE_URL=http://host.docker.internal:11434
|
||||
|
||||
# Path to the LanceDB database
|
||||
# For Docker: /app/data/haiku_rag.lancedb
|
||||
# For local development: Use absolute path to existing database
|
||||
|
|
@ -17,7 +6,5 @@ DB_PATH=~/SOME_FOLDER/haiku.rag.lancedb
|
|||
# API keys (set as needed for your QA provider)
|
||||
# OPENAI_API_KEY=your-key-here
|
||||
# ANTHROPIC_API_KEY=your-key-here
|
||||
|
||||
# Embedding provider configuration (optional, defaults will be used)
|
||||
# EMBEDDING_PROVIDER=openai
|
||||
# EMBEDDING_MODEL=text-embedding-3-small
|
||||
# VOYAGE_API_KEY=your-key-here
|
||||
# CO_API_KEY=your-key-here
|
||||
|
|
|
|||
3
examples/ag-ui-research/.gitignore
vendored
Normal file
3
examples/ag-ui-research/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
haiku.rag.yaml
|
||||
.env
|
||||
data/
|
||||
|
|
@ -30,19 +30,27 @@ Research assistant powered by [haiku.rag](https://ggozad.github.io/haiku.rag/),
|
|||
haiku-rag add-src document.pdf --db data/haiku_rag.lancedb
|
||||
```
|
||||
|
||||
2. **Configure environment** (optional)
|
||||
2. **Configure haiku.rag**
|
||||
```bash
|
||||
cp .env.example .env
|
||||
# Edit .env to customize provider/model
|
||||
cp haiku.rag.yaml.example haiku.rag.yaml
|
||||
# Edit haiku.rag.yaml to customize provider/model
|
||||
```
|
||||
See [haiku.rag configuration](https://ggozad.github.io/haiku.rag/configuration/) for details.
|
||||
|
||||
3. **Start the application**
|
||||
3. **Set API keys** (if using non-Ollama providers)
|
||||
```bash
|
||||
cp .env.example .env
|
||||
# Edit .env to set your API keys
|
||||
export OPENAI_API_KEY=your-key-here
|
||||
export ANTHROPIC_API_KEY=your-key-here
|
||||
```
|
||||
|
||||
4. **Start the application**
|
||||
```bash
|
||||
docker compose up --build
|
||||
```
|
||||
|
||||
4. **Access the interface**
|
||||
5. **Access the interface**
|
||||
- Frontend: http://localhost:3000
|
||||
- Backend health: http://localhost:8000/health
|
||||
|
||||
|
|
@ -60,6 +68,7 @@ Research assistant powered by [haiku.rag](https://ggozad.github.io/haiku.rag/),
|
|||
## Architecture
|
||||
|
||||
- **Backend** (Python): Pydantic AI agent with haiku.rag integration
|
||||
- Uses published `ghcr.io/ggozad/haiku.rag:latest` Docker image as base
|
||||
- `agent.py`: Research agent with tool definitions
|
||||
- `main.py`: Starlette app serving AG-UI protocol
|
||||
|
||||
|
|
@ -70,11 +79,15 @@ Research assistant powered by [haiku.rag](https://ggozad.github.io/haiku.rag/),
|
|||
|
||||
## Configuration
|
||||
|
||||
Configuration is done through `haiku.rag.yaml` (see `haiku.rag.yaml.example`):
|
||||
|
||||
- `qa.provider`: LLM provider (default: `ollama`)
|
||||
- `qa.model`: Model name (default: `gpt-oss:latest`)
|
||||
- `providers.ollama.base_url`: Ollama endpoint (default: `http://host.docker.internal:11434`)
|
||||
|
||||
Environment variables (see `.env.example`):
|
||||
|
||||
- `DB_PATH`: Path to haiku.rag database (default: `haiku_rag.lancedb`)
|
||||
- `QA_PROVIDER`: LLM provider (default: `ollama`)
|
||||
- `QA_MODEL`: Model name (default: `gpt-oss:latest`)
|
||||
- `OLLAMA_BASE_URL`: Ollama endpoint (default: `http://host.docker.internal:11434`)
|
||||
- `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`: API keys for cloud providers
|
||||
|
||||
For other providers (OpenAI, Anthropic, etc.), see [haiku.rag configuration docs](https://ggozad.github.io/haiku.rag/configuration/).
|
||||
For full configuration options, see [haiku.rag configuration docs](https://ggozad.github.io/haiku.rag/configuration/).
|
||||
|
|
|
|||
|
|
@ -1,27 +1,15 @@
|
|||
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
|
||||
FROM ghcr.io/ggozad/haiku.rag:latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Enable bytecode compilation
|
||||
ENV UV_COMPILE_BYTECODE=1
|
||||
# Copy backend application files
|
||||
COPY agent.py main.py ./
|
||||
COPY pyproject.toml uv.lock ./
|
||||
|
||||
# Copy from the cache instead of linking since it's a mounted volume
|
||||
ENV UV_LINK_MODE=copy
|
||||
|
||||
# Install dependencies
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
--mount=type=bind,source=uv.lock,target=uv.lock \
|
||||
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
||||
uv sync --frozen --no-install-project --no-dev
|
||||
|
||||
# Copy the project into the image
|
||||
COPY . .
|
||||
|
||||
# Sync the project
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
uv sync --frozen --no-dev
|
||||
# Install backend dependencies into the existing haiku.rag venv
|
||||
RUN uv sync --frozen --no-dev
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
# Run with uv
|
||||
# Run with uvicorn
|
||||
CMD ["uv", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|
||||
|
|
|
|||
|
|
@ -6,16 +6,15 @@ services:
|
|||
ports:
|
||||
- "8000:8000"
|
||||
environment:
|
||||
- QA_PROVIDER=${QA_PROVIDER:-ollama}
|
||||
- QA_MODEL=${QA_MODEL:-gpt-oss:latest}
|
||||
- DB_PATH=/app/data/haiku.rag.lancedb
|
||||
- OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-http://host.docker.internal:11434}
|
||||
# API keys (set these in your shell or .env file)
|
||||
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
||||
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
|
||||
volumes:
|
||||
- ./backend:/app
|
||||
- /app/.venv
|
||||
- ${DB_PATH}:/app/data/haiku.rag.lancedb
|
||||
- ./haiku.rag.yaml:/app/haiku.rag.yaml:ro # Mount config file
|
||||
networks:
|
||||
- ag-ui-network
|
||||
extra_hosts:
|
||||
|
|
|
|||
20
examples/ag-ui-research/haiku.rag.yaml.example
Normal file
20
examples/ag-ui-research/haiku.rag.yaml.example
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# haiku.rag configuration for ag-ui-research example
|
||||
# Copy to haiku.rag.yaml and customize
|
||||
|
||||
qa:
|
||||
provider: ollama
|
||||
model: gpt-oss:latest
|
||||
|
||||
providers:
|
||||
ollama:
|
||||
base_url: http://host.docker.internal:11434
|
||||
|
||||
# For OpenAI:
|
||||
# qa:
|
||||
# provider: openai
|
||||
# model: gpt-4o-mini
|
||||
|
||||
# For Anthropic:
|
||||
# qa:
|
||||
# provider: anthropic
|
||||
# model: claude-3-5-haiku-20241022
|
||||
|
|
@ -6,7 +6,7 @@ Run haiku.rag with file monitoring, MCP server, and A2A agent.
|
|||
|
||||
```bash
|
||||
mkdir -p data docs
|
||||
cp .env.example .env # Edit if needed
|
||||
cp haiku.rag.yaml.example haiku.rag.yaml # Edit as needed
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
|
|
@ -35,10 +35,18 @@ docker compose exec haiku-rag haiku-rag a2aclient --url http://localhost:8000
|
|||
|
||||
## Configuration
|
||||
|
||||
Edit `.env` or `docker-compose.yml` to configure providers. See the [Configuration documentation](https://ggozad.github.io/haiku.rag/configuration/) for all options.
|
||||
Edit `haiku.rag.yaml` to configure providers, embeddings, and other settings. See the [Configuration documentation](https://ggozad.github.io/haiku.rag/configuration/) for all options.
|
||||
|
||||
Default setup uses Ollama on the host (`host.docker.internal:11434`).
|
||||
|
||||
For API keys (OpenAI, Anthropic, etc.), set them as environment variables:
|
||||
|
||||
```bash
|
||||
export OPENAI_API_KEY=your-key-here
|
||||
export ANTHROPIC_API_KEY=your-key-here
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
- [Configuration](https://ggozad.github.io/haiku.rag/configuration/)
|
||||
|
|
|
|||
|
|
@ -10,46 +10,13 @@ services:
|
|||
volumes:
|
||||
- ./data:/data # Persist database
|
||||
- ./docs:/docs # Mount documents directory for monitoring
|
||||
- ./haiku.rag.yaml:/app/haiku.rag.yaml:ro # Mount config file
|
||||
environment:
|
||||
# Database directory
|
||||
- DEFAULT_DATA_DIR=/data
|
||||
|
||||
# File monitoring
|
||||
- MONITOR_DIRECTORIES=/docs
|
||||
|
||||
# Set the Ollama base url for Ollama defaults
|
||||
- OLLAMA_BASE_URL=http://host.docker.internal:11434
|
||||
|
||||
# Embeddings provider (choose one)
|
||||
# For OpenAI:
|
||||
# - EMBEDDINGS_PROVIDER=openai
|
||||
# - EMBEDDINGS_MODEL=text-embedding-3-small
|
||||
# - OPENAI_API_KEY=your-key-here
|
||||
|
||||
# For VoyageAI:
|
||||
# - EMBEDDINGS_PROVIDER=voyageai
|
||||
# - EMBEDDINGS_MODEL=voyage-3
|
||||
# - VOYAGE_API_KEY=your-key-here
|
||||
|
||||
# QA provider (uses Pydantic AI)
|
||||
# - QA_PROVIDER=ollama
|
||||
|
||||
# For OpenAI:
|
||||
# - QA_PROVIDER=openai
|
||||
# - QA_MODEL=gpt-4o-mini
|
||||
# - OPENAI_API_KEY=your-key-here
|
||||
|
||||
# Reranking (optional)
|
||||
# - RERANKING_PROVIDER=mxbai
|
||||
# - RERANKING_MODEL=mixedbread-ai/mxbai-rerank-large-v1
|
||||
# - RERANKING_BASE_URL=http://host.docker.internal:11434
|
||||
|
||||
# Research agent (optional, defaults to QA provider/model)
|
||||
# - RESEARCH_PROVIDER=openai
|
||||
# - RESEARCH_MODEL=gpt-4o
|
||||
|
||||
# Environment
|
||||
- ENV=production
|
||||
# API keys (set as needed)
|
||||
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
||||
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
|
||||
- VOYAGE_API_KEY=${VOYAGE_API_KEY}
|
||||
- CO_API_KEY=${CO_API_KEY}
|
||||
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
|
|
|
|||
Loading…
Reference in a new issue