Commit e5e1ee5d authored by Miguel Matos's avatar Miguel Matos
Browse files

docs: document the OpenAI-compatible provider

parent bd015bdb
Loading
Loading
Loading
Loading
Loading
+5 −0
Changes for README.md: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -21,6 +21,11 @@ AI Agent is a lightweight, modular backend built with **[`FastAPI`](https://fast
It is designed to be easily extensible with support for different LLMs and OpenOP MCP servers.
It keeps a short per-session chat memory in Redis when `REDIS_URL` is set.

The LLM backend is selected with `LLM_PROVIDER`: `groq` (default, needs `GROQ_API_KEY`) or `openai`
(any OpenAI-compatible endpoint such as Open WebUI; needs `OPENAI_BASE_URL`, `OPENAI_MODEL_NAME`
and `OPENAI_API_KEY`). The model must support tool calling.
See `ai_agent/README.md` for the settings.

## Authentication

Every request carries the user's Keycloak access token (`Authorization: Bearer …`). The agent
+21 −1
Changes for ai_agent/README.md: 21 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -36,10 +36,19 @@ APP_PORT=9013
# --- MCP Server ---
MCP_SERVER_URL=http://127.0.0.1:8004/mcp

# --- LLM provider: groq (default) or openai ---
LLM_PROVIDER=groq

# --- Groq ---
GROQ_API_KEY=your_groq_api_key_here
GROQ_MODEL_NAME=qwen/qwen3.8-27b

# --- OpenAI-compatible, e.g. Open WebUI (only when LLM_PROVIDER=openai) ---
# OPENAI_BASE_URL=https://open-webui.example/api
# OPENAI_MODEL_NAME=your-model
# OPENAI_API_KEY=sk-...
# OPENAI_TIMEOUT=120

# --- Optional short-term memory (Redis) ---
REDIS_URL=redis://127.0.0.1:6379/0
MEMORY_WINDOW_TURNS=6
@@ -47,6 +56,12 @@ MEMORY_TTL_SECONDS=3600
MEMORY_KEY_PREFIX=ai_agent:session
```

### Using an OpenAI-compatible endpoint (for example Open WebUI)

Set `LLM_PROVIDER=openai`, `OPENAI_BASE_URL`, `OPENAI_MODEL_NAME` and `OPENAI_API_KEY`. For Open
WebUI the base URL is `https://<host>/api` and the key is created under Settings → Account →
API Keys. The model must support tool calling. The endpoints keep their `/groq-mcp` paths.

### Environment Variables

| Variable          | Description                             |
@@ -54,8 +69,13 @@ MEMORY_KEY_PREFIX=ai_agent:session
| `APP_HOST`        | Host interface the server binds to      |
| `APP_PORT`        | Port the backend server listens on      |
| `MCP_SERVER_URL`  | URL of the MCP server used by sub-agent |
| `GROQ_API_KEY`    | API key for Groq LLM access             |
| `LLM_PROVIDER`    | Model backend: `groq` (default) or `openai` |
| `GROQ_API_KEY`    | API key for Groq; required when `LLM_PROVIDER=groq` |
| `GROQ_MODEL_NAME` | Groq model identifier                   |
| `OPENAI_BASE_URL` | OpenAI-compatible endpoint (Open WebUI: `https://host/api`); required when `LLM_PROVIDER=openai` |
| `OPENAI_MODEL_NAME` | Model identifier; required when `LLM_PROVIDER=openai` |
| `OPENAI_API_KEY`  | Bearer API key; required when `LLM_PROVIDER=openai` |
| `OPENAI_TIMEOUT`  | Request timeout in seconds (default `120`) |
| `REDIS_URL` | Redis DSN for short-term memory (`redis://host:6379/0`) |
| `MEMORY_WINDOW_TURNS` | Number of recent user/assistant turns to retain |
| `MEMORY_TTL_SECONDS` | Session memory TTL in seconds |