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

feat: configure the LLM provider in Helm, compose and Dockerfile

Add aiAgent.llm.* and secrets.openaiApiKey to the chart, make the Groq key
optional, and pass the OpenAI-compatible variables through docker-compose.
parent fc5fdd39
Loading
Loading
Loading
Loading
+7 −0
Changes for ai_agent/Dockerfile: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -4,9 +4,16 @@ ENV APP_HOST=0.0.0.0
ENV APP_PORT=9013
ENV MCP_SERVER_URL=http://127.0.0.1:8004/mcp

ENV LLM_PROVIDER=groq

ENV GROQ_API_KEY=""
ENV GROQ_MODEL_NAME=openai/gpt-oss-20b

ENV OPENAI_BASE_URL=""
ENV OPENAI_MODEL_NAME=""
ENV OPENAI_API_KEY=""
ENV OPENAI_TIMEOUT=120

WORKDIR /app

COPY requirements.txt .
+4 −0
Changes for deployment/docker/README.md: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -13,6 +13,10 @@ OEG_SERVICE_URL=http://your-oeg-api-url
GROQ_MODEL_NAME=qwen/qwen3.8-27b
```

For an OpenAI-compatible endpoint such as Open WebUI, set `LLM_PROVIDER=openai`,
`OPENAI_BASE_URL` (`https://<host>/api`), `OPENAI_MODEL_NAME` and `OPENAI_API_KEY`; optional
`OPENAI_TIMEOUT` (`120`).

Optional, with the defaults the compose file uses: `REDIS_URL` (`redis://redis:6379/0`),
`MEMORY_WINDOW_TURNS` (`10`) and `MEMORY_TTL_SECONDS` (`3600`) for the agent's session memory.

+6 −1
Changes for deployment/docker/docker-compose.yaml: 6 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -35,8 +35,13 @@ services:
        condition: service_healthy
    environment:
      MCP_SERVER_URL: http://mcp:8004/mcp
      GROQ_API_KEY: ${GROQ_API_KEY}
      LLM_PROVIDER: ${LLM_PROVIDER:-groq}
      GROQ_API_KEY: ${GROQ_API_KEY:-}
      GROQ_MODEL_NAME: ${GROQ_MODEL_NAME:-qwen/qwen3.8-27b}
      OPENAI_BASE_URL: ${OPENAI_BASE_URL:-}
      OPENAI_MODEL_NAME: ${OPENAI_MODEL_NAME:-}
      OPENAI_API_KEY: ${OPENAI_API_KEY:-}
      OPENAI_TIMEOUT: ${OPENAI_TIMEOUT:-120}
      REDIS_URL: ${REDIS_URL:-redis://redis:6379/0}
      MEMORY_WINDOW_TURNS: ${MEMORY_WINDOW_TURNS:-10}
      MEMORY_TTL_SECONDS: ${MEMORY_TTL_SECONDS:-3600}
+5 −1
Changes for deployment/helm/README.md: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ waits for the MCP server to be healthy before starting (via initContainer).

- Kubernetes cluster
- Helm 3+
- Groq API key
- Groq API key, or an OpenAI-compatible endpoint such as Open WebUI (see below)
- OEG service reachable from within the cluster

## Install
@@ -23,6 +23,10 @@ helm install ai2test ./deployment/helm/ai2 \
  --set mcp.oegUrl=http://<oeg-host>
```

For an OpenAI-compatible endpoint such as Open WebUI, use `--set aiAgent.llm.provider=openai`,
`--set aiAgent.llm.openai.baseUrl=https://<host>/api`, `--set aiAgent.llm.openai.model=<model>` and
`--set secrets.openaiApiKey=<key>`.

Without the umbrella chart there is no Keycloak; add `--set global.auth.enabled=false` to call
AI2 without a token.

+8 −3
Changes for deployment/helm/ai2/README.md: 8 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@

Deploys AI2, the platform's natural-language assistant:

- **ai-agent**: takes a chat message, asks a Groq model what to do and calls the MCP server's
- **ai-agent**: takes a chat message, asks an LLM (Groq or an OpenAI-compatible endpoint) what to do and calls the MCP server's
  tools. The portal forwards `/api/ai2/chat` to it.
- **mcp**: MCP server whose tools call OEG's CAMARA APIs.
- **redis**: in-memory store for the agent's session memory. Nothing is persisted.
@@ -22,12 +22,17 @@ both components get `AUTH_ENABLED=false`.
| `aiAgent.image.repository` / `tag` | Agent image | `labs.etsi.org:5050/oop/code/ai2/ai_agent`, `2.0.0` |
| `aiAgent.waitForMcpImage` | Init container image that waits for the MCP server | `curlimages/curl:8.11.1` |
| `aiAgent.groqModelName` | Groq model | `qwen/qwen3.8-27b` |
| `aiAgent.llm.provider` | `groq` or `openai` | `groq` |
| `aiAgent.memory.windowTurns` | Turns of a chat kept as context | `3` |
| `aiAgent.memory.ttlSeconds` | How long an idle chat is remembered | `3600` |
| `aiAgent.service.name` / `port` | Agent Service, the address the portal calls | `global.ai2.host` / `port` (`ai2-ai-agent`, `9013`) |
| `aiAgent.service.type` / `nodePort` | Agent Service type | `ClusterIP` |
| `secrets.groqApiKey` | Groq API key; required for the agent to answer | `""` |
| `secrets.existingSecret` | Existing Secret with the key under `GROQ_API_KEY`; `groqApiKey` is then ignored | `""` |
| `aiAgent.llm.openai.baseUrl` | OpenAI-compatible endpoint (Open WebUI: `https://<host>/api`); required when the provider is `openai` | `""` |
| `aiAgent.llm.openai.model` | Model name; required when the provider is `openai` | `""` |
| `aiAgent.llm.openai.timeoutSeconds` | Request timeout | `120` |
| `secrets.openaiApiKey` | API key, sent as a Bearer token; required when the provider is `openai` | `""` |
| `secrets.groqApiKey` | Groq API key; required when the provider is `groq` | `""` |
| `secrets.existingSecret` | Existing Secret with `GROQ_API_KEY` and/or `OPENAI_API_KEY`; the keys above are then ignored | `""` |
| `redis.enabled` | Deploy Redis; `false` turns session memory off | `true` |
| `redis.image` | Redis image | `redis:7.4-alpine` |

Loading