sap-aicore 0.3.1: image content in tool results (#830)
sap-aicore can now take images in tool results: a `tool_result` on Messages, and a `function_call_output` array on Responses. Images still need an image-capable model, and pass the same URL and detail checks as user attachments. Text-only models still refuse them locally, but magpie's gateway already describes or drops tool images before the plugin sees them. Bumped to 0.3.1. Run at b44bb706 on mote (HOME=$(mktemp -d)): - the package's tests: 335 pass, 0 fail - bun scripts/check.mjs sap-aicore: ok - the whole repo's bun test: 5882 pass, 0 fail Each of the five guards, broken by hand, turned a test red. Bedrock's docs and Azure's v1 spec both accept these shapes. CI is green at 92e19bf9 (the bump only). Not tried: a live SAP AI Core request. Co-authored-by: caikn <caikn@users.noreply.github.com>
This commit is contained in:
@@ -31,7 +31,7 @@ Reasoning accepts `effort:low`, `medium`, or `high`, optionally with `summary:au
|
||||
|
||||
## Function tools and history
|
||||
|
||||
Tools use native Responses function definitions with `name`, `parameters`, and supported `strict:true`. The agent executes tools; the plugin does not.
|
||||
Tools use native Responses function definitions with `name`, `parameters`, and supported `strict:true`. The agent executes tools; the plugin does not. A `function_call_output` requires a non-empty string `call_id`; its `output` may be a string or an array of `input_text` / `input_image` parts. Image parts use the same model-capability gate and URL/detail validation as user attachments. Image tool results are covered by mocked transport tests, not a live SAP round-trip.
|
||||
|
||||
Continuation must preserve original input and every returned output item in order, including reasoning items and exact argument strings. Pair results using `call_id`, not the output item's `id`:
|
||||
|
||||
@@ -70,7 +70,7 @@ Supported fields: `model`, `messages`, string or text-block `system`, required n
|
||||
|
||||
The discovered Opus 4.8 version `1` rejects explicit `temperature`, `top_p`, and enabled/fixed-budget thinking locally. Sonnet 4.6 version `1` rejects combined `temperature` plus `top_p`, and enabled thinking with forced tool use; either sampling setting individually and fixed-budget thinking are retained. Both baseline versions advertise and enforce `max_tokens <= 128000`; this is not a maximum-length generation guarantee. Newer releases or active versions do not inherit these restrictions or limits: structurally valid recognized controls reach upstream validation. No sampling defaults are injected. Unknown body/tool fields, metadata, non-image multimodal content, and hosted tools are rejected; base64 image blocks are accepted only when the matched catalog version advertises image input. Two explicit boolean client-only tool hints, `eager_input_streaming` and `defer_loading`, are accepted and removed before Bedrock dispatch; they are not native tool capabilities.
|
||||
|
||||
Agent-executed continuation resends the original messages, the complete returned assistant `content` array in order (text, `tool_use`, signed `thinking` including empty text, `redacted_thinking`), and a user message of `tool_result` blocks paired by the original `tool_use.id`. The agent executes tools; the plugin neither executes them nor repairs reasoning. A rejected signature or mismatched result surfaces as an upstream error.
|
||||
Agent-executed continuation resends the original messages, the complete returned assistant `content` array in order (text, `tool_use`, signed `thinking` including empty text, `redacted_thinking`), and a user message of `tool_result` blocks paired by the original `tool_use.id`. The agent executes tools; the plugin neither executes them nor repairs reasoning. Each `tool_result.content` may be a string or an array of text/base64-image blocks, with images subject to the same model-capability gate and source validation as user attachments. Other nested content types remain unsupported. Image tool results are covered by mocked transport tests, not a live SAP round-trip. A rejected signature or mismatched result surfaces as an upstream error.
|
||||
|
||||
Streaming is accepted only when the matched catalog version explicitly reports support. SAP's data-only Anthropic SSE (`message_start`, `content_block_*`, `message_delta`, `message_stop`, `error`; no `event:` or `[DONE]` required) is relayed one bounded frame at a time. Text and `input_json_delta` tool arguments arrive incrementally. Successful completion requires a valid `message_start`, a `message_delta` carrying a non-empty `stop_reason`, and `message_stop`; a bare stop frame, malformed terminal state, or missing terminal is a failure.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user