Skip to content

feat(llm): text_content driver option for string message content on OpenAI-compatible endpoints - #296

Merged
wolfy-j merged 4 commits into
masterfrom
feat/llm-openai-compat-text-content
Nov 22, 2026
Merged

wolfy-j merged 4 commits into
masterfrom
feat/llm-openai-compat-text-content

Conversation

@wolfy-j

@wolfy-j wolfy-j commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Some OpenAI-compatible servers accept only string message content, so hosts fork the openai_compat generate handler to flatten it. A fork drifts from the driver: it misses route thinking facts, the options.request overlay and newer reasoning mapping.

This declares a typed context option on the wippy.llm.openai_compat:driver binding:

  • text_content: parts (default, unchanged wire format) or string.
  • With string, generate and structured_output send a text-only system, developer or user message as its joined text; a message carrying an image keeps its content part array. Assistant and tool content stay strings as before.
  • An unknown value fails the request with invalid_request before any HTTP request.
  • Set it on a provider entry's driver.options or on route options, so a provider can bind the upstream driver instead of copying it.

Stacked on #295 (same files); retarget to master once it merges.

Tests: mapper (string form, image kept as parts, joined parts, option resolution, no cache breakpoint on strings), generate (default parts, string form together with options.request, invalid value refused before HTTP), structured_output (string form, invalid value refused). src/llm/test: lint clean, 3047 tests pass.

…inking

vLLM, SGLang and DeepSeek return reasoning as message.reasoning or
message.reasoning_content, and stream it in the same delta fields. The
OpenAI-compatible driver read only reasoning_details, so that reasoning
was dropped. It now fills metadata.thinking from either field, streamed
or not, streams the deltas as thinking chunks, and keeps reasoning_details
first when a provider sends both.
…penAI-compatible endpoints

Some OpenAI-compatible servers accept only string message content. The
openai_compat driver declares the context option text_content (parts by
default, or string): with string, generate and structured_output send a
text-only system or user message as its joined text, and a message that
carries an image keeps its content part array. An unknown value fails
the request as invalid before any HTTP request. Set it on a provider
entry's driver.options or a route's options to bind the upstream driver
to such an endpoint.
@wolfy-j
wolfy-j requested a review from skhaz November 22, 2026 09:03
Base automatically changed from fix/llm-openai-compat-reasoning to master November 22, 2026 09:31
@wolfy-j

wolfy-j commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

The final head reads the single text_content setting and rejects values outside parts and string before calling the provider. Unset still uses the existing parts wire format. Explicit model-card settings override the provider setting, and a message with an image retains its parts array.

Signed Wippy 0.3.68a passed 3,050 native cases with nine skips and clean lint. The real binding against a loopback receiver verified generation, structured output, both directions of the provider/model-card override, image content, and rejection before HTTP for invalid values.

@wolfy-j
wolfy-j merged commit ea94279 into master Nov 22, 2026
@wolfy-j
wolfy-j deleted the feat/llm-openai-compat-text-content branch November 22, 2026 09:40
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.

1 participant