Skip to content

feat: per-request metadata to disable thinking/reasoning#19

Merged
mudler merged 1 commit into
masterfrom
feat/request-metadata
Jun 4, 2026
Merged

feat: per-request metadata to disable thinking/reasoning#19
mudler merged 1 commit into
masterfrom
feat/request-metadata

Conversation

@localai-bot

Copy link
Copy Markdown
Collaborator

What

Adds an option to attach a metadata object to every LLM request (the OpenAI metadata field), passed verbatim to the backend. Backends such as LocalAI use it for per-request flags — e.g. {"enable_thinking": "false"} to disable a reasoning model's thinking.

# global
metadata:
  enable_thinking: "false"

# per-agent override (overlays global per key)
agents:
  - name: researcher
    metadata:
      enable_thinking: "true"

Changes

  • Config.Metadata (global) and AgentTypeConfig.Metadata (per-agent).
  • Main session sends Config.Metadata; sub-agents merge global + per-agent via mergeMetadata (per key: agent wins, global-only keys inherited; inputs never mutated).
  • README documents both global and per-agent usage.
  • Bumps github.com/mudler/cogito to the release carrying the metadata passthrough (feat(client): per-request metadata passthrough (disable thinking/reasoning) cogito#56).

Tests

  • mergeMetadata unit tests (merge precedence + no-mutation).
  • Two e2e tests driving a real chat.Session against a fake OpenAI server: metadata reaches the wire, and no metadata is sent when unconfigured.

🤖 Generated with Claude Code

Let users attach a metadata object to every LLM request (the OpenAI
"metadata" field), passed verbatim to the backend. Backends such as
LocalAI use it for per-request flags, e.g. {"enable_thinking": "false"}
to disable a reasoning model's thinking.

- Config.Metadata (global) and AgentTypeConfig.Metadata (per-agent).
- Main session sends Config.Metadata; sub-agents merge global + per-agent
  via mergeMetadata (per key: agent wins, global-only keys inherited).
- e2e tests assert metadata reaches the wire; README documents both.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mudler mudler merged commit a4be03f into master Jun 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants