Skip to content

feat(client): per-request metadata passthrough (disable thinking/reasoning)#56

Merged
mudler merged 1 commit into
mudler:mainfrom
localai-bot:feat/request-metadata
Jun 4, 2026
Merged

feat(client): per-request metadata passthrough (disable thinking/reasoning)#56
mudler merged 1 commit into
mudler:mainfrom
localai-bot:feat/request-metadata

Conversation

@localai-bot

Copy link
Copy Markdown
Collaborator

What

Adds an optional metadata object that is attached verbatim to every chat-completion request as the OpenAI metadata field. Backends such as LocalAI use it to carry per-request flags — e.g. {"enable_thinking": "false"} to disable a reasoning model's thinking.

Changes

  • OpenAIOptions.Metadata + OpenAIClient.metadata, applied on all call paths: Ask, CreateChatCompletion, CreateChatCompletionStream.
  • AgentDefinition.Metadata for per-agent-type overrides. resolveLLM now passes it to the agent LLM factory and fires the factory on a metadata-only override (previously only a model override did).
  • WithAgentLLMFactory signature gains a metadata map[string]string argument (breaking change to the factory type).

Tests

  • Client unit test for the option, plus an httptest-backed test asserting the metadata is serialized into the outgoing request body.
  • A factory test asserting a metadata-only agent override fires the factory.
  • Updated the three existing factory tests for the new signature.

🤖 Generated with Claude Code

…oning)

Add an optional metadata object that is attached verbatim to every
chat-completion request as the OpenAI "metadata" field. Backends such as
LocalAI use it for per-request flags, e.g. {"enable_thinking": "false"}
to disable a reasoning model's thinking.

- OpenAIOptions.Metadata + OpenAIClient.metadata, applied on all call
  paths: Ask, CreateChatCompletion, CreateChatCompletionStream.
- AgentDefinition.Metadata for per-agent-type overrides; resolveLLM now
  passes it to the agent LLM factory and fires the factory on a
  metadata-only override (previously only a model override did).
- WithAgentLLMFactory signature gains a metadata map (breaking change to
  the factory type).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mudler mudler merged commit 77024e4 into mudler:main Jun 4, 2026
2 of 3 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