kestra-io / kestra-io/plugin-anthropic

Extend ChatCompletion with Claude 4.x capabilities

Open
#90 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/plugin good first issue
Dominant language
Java
Stars
0
Forks
4
Avg merge
2d 2h
Merged PRs (30d)
3

Description

Part of #75.

## What

Extend the existing `ChatCompletion` task with all missing Claude 4.x / Anthropic API properties. These are additive changes — no breaking changes to existing flows.

## Checklist

### New input properties

- [ ] **Extended thinking** — `thinking` (`Boolean`, default `false`) + `budgetTokens` (`Integer`). Maps to `ThinkingConfigEnabledParam`. Enforce `temperature = 1` when enabled.
- [ ] **Vision / image input** — allow `ChatMessage.content` to carry image content blocks (URL, base64, `file_id`) in addition to plain `String`. Maps to `ImageBlockParam`.
- [ ] **PDF / document input** — document content blocks (URL, base64, `file_id`) in `ChatMessage.content`. Maps to `DocumentBlockParam`.
- [ ] **`toolChoice`** — enum `AUTO` | `ANY` | `TOOL` (+ `toolChoiceName`) | `NONE`. Maps to `ToolChoiceAutoParam` etc.
- [ ] **`stopSequences`** — `List`. Passed to `MessageCreateParamsBuilder.stopSequences(...)`.
- [ ] **Granular `cacheControl`** — optional `cacheControl: ephemeral` field on `SystemPromptBlock`, `ChatMessage`, and `Tool` for per-block cache control (instead of / in addition to the global `promptCaching` flag).
- [ ] **`stream`** — `Boolean` (default `false`). When true, use `createStreaming(...)`, log text deltas incrementally, and write the full text to `Output.outputText` at the end.
- [ ] **`metadata.userId`** + **`serviceTier`** — optional passthrough for enterprise cost attribution and priority tier.
- [ ] **`betas`** — `List` to pass `anthropic-beta` headers without a plugin release.
- [ ] **Client configuration** — `baseUrl`, `connectTimeout`, `readTimeout`, `maxRetries` on `AbstractAnthropic`, wired into `AnthropicOkHttpClient.builder()`.

### New output fields

- [ ] **`thinking`** — reasoning text blocks (when extended thinking is on).
- [ ] **`citations`** — list of `Citation` records from document responses.
- [ ] **`stopSequence`** — the matched stop string (alongside existing `stopReason`).

### Bug fix

- [ ] Tool-input JSON conversion failure in `ChatCompletion.run` (~line 340) silently leaves `input` null — log a warning instead.

## Acceptance

Each bullet above can land in the same PR or be split across focused PRs. Tests and a docs example required per property.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the existing ChatCompletion task and AbstractAnthropic client configuration, then review their current request, response, streaming, and error-handling paths. Split the checklist into focused changes, adding tests and a documentation example for each property; done means all requested Claude 4.x inputs, outputs, client options, and the tool-input warning are covered without breaking existing flows.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
ai, api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.