Skip to content

feat(ai): support multipart tool results - #12

Merged
arjunkmrm merged 2 commits into
clavia/ai-providersfrom
feat/tool-content-native
Oct 10, 2026
Merged

arjunkmrm merged 2 commits into
clavia/ai-providersfrom
feat/tool-content-native

Conversation

@arjunkmrm

Copy link
Copy Markdown
Collaborator

Custom tool files currently become JSON strings before reaching provider APIs. Add a shared typed content result and encode files inside native OpenAI and Anthropic results. Compatible chat providers receive labelled attachment messages after the tool-result batch; Bedrock uses native images where supported and the same fallback for other media and text history.

Tool result content
  -> provider adapter
     -> native result content
     -> labelled attachment message when required
packages/ai/
  clavia/src/ToolResult.ts                +75/-0
  clavia/test/ProviderStreams.test.ts    +142/-0
  openai/src/OpenAiLanguageModel.ts       +30/-2
  anthropic/src/AnthropicLanguageModel.ts +35/-2
  openai-compat/src/OpenAiLanguageModel.ts +3/-2
  openrouter/src/OpenRouterLanguageModel.ts +3/-2
  bedrock/src/BedrockLanguageModel.ts     +52/-3
  bedrock/test/ToolContent.test.ts        +89/-0
  six package manifests                 +10/-8
packages/effect/typetest/Schedule.tst.ts   +2/-2
scripts/clavia-release.mjs                +1/-1

Bump all six package versions and include the new Bedrock test in packed-consumer checks. Rename an existing unused type-test parameter so the full typecheck passes.

Validation: 361 provider tests, 99 packed-consumer tests, full typecheck and lint, and six package builds pass. Request fixtures cover native images and PDFs, compatibility batching and attribution, Bedrock text history, and unchanged prompt inputs.

@arjunkmrm
arjunkmrm merged commit 5e32608 into clavia/ai-providers Oct 10, 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.

1 participant