Skip to content

feat(openai): add typed chat template arguments - #2282

Open
kyboi wants to merge 1 commit into
JetBrains:developfrom
Kreoh:contribute/chat-template-kwargs
Open

kyboi wants to merge 1 commit into
JetBrains:developfrom
Kreoh:contribute/chat-template-kwargs

Conversation

@kyboi

@kyboi kyboi commented Sep 30, 2026

Copy link
Copy Markdown

Closes #2277.

Related to #504.

Add OpenAIChatParams.withChatTemplateKwargs(JsonObject?) and chatTemplateKwargs for provider-specific Chat Completions template controls. The existing additionalProperties serialiser already supports the request field. The helper preserves other parameters and arbitrary JSON values, and null removes the configured arguments.

This feature is already included in Kroog and is working in production applications using Kroog. Original implementation: ba7899a0e37df7d6cb7c9cf8d4fe777cd58983ed. This patch adapts the helper to Koog's existing serialiser. It omits Kroog's redundant request field and constructor validation for raw additional properties, preserving Koog's existing map behaviour.

No new dependencies. Two additive public members and a JVM API dump update; constructor and copy signatures are unchanged. Provider-specific values follow vLLM's documented dictionary extension.

Validation with Java 21: OpenAI client jvmTest passed all 211 tests; jvmJar, generatePomFileForJvmPublication and both touched source-set ktlint checks passed. A reliable JVM-only ABI dump exactly matches the updated checked-in dump, with two additions and no removed descriptors. Four new tests cover map preservation, replacement and removal, nested JSON round trips, the outgoing HTTP request and omitted values. Live-provider and non-JVM checks are outside this JVM contribution scope.

This branch has not been deployed

No deployments
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.

Add typed chat template arguments to OpenAIChatParams

1 participant