davsclaus opened a new pull request, #28340:
URL: https://github.com/apache/camel/pull/28340
Stacked on #28327. This group covers eleven more AWS components of the
catalog body types (CAMEL-24961): aws-bedrock, aws-bedrock-agent,
aws-bedrock-agent-runtime, aws2-polly, aws2-translate, aws2-comprehend,
aws2-textract, aws2-transcribe, aws2-rekognition, aws-cloudtrail and
aws2-timestream.
**What the catalog says now**
| Component | Consumer | Producer input | Producer output |
|---|---|---|---|
| aws-bedrock | | the request of the model as JSON `text` for the invoke
operations; `any` for converse, converseStream and applyGuardrail, whose input
is in headers | invokeTextModel: the JSON response as `text` for Titan, a
Jackson JsonNode for the other models; invokeImageModel: a JsonNode array of
the images; invokeEmbeddingsModel: the `InvokeModelResponse`; converse and
applyGuardrail: `text`; the streaming operations and converseStream: `text`, or
a List of the chunks |
| aws-bedrock-agent | the `IngestionJob`, one per poll | `any`: the ids are
options or headers | the job id as `text` for startIngestionJob, a List for
listIngestionJobs, the `IngestionJob` for getIngestionJob |
| aws-bedrock-agent-runtime | | text, bytes, a stream or a file: the
question or the input; a String, a `FlowInput` or a List of them for invokeFlow
| the answer as `text` for retrieveAndGenerate, a List of results for retrieve,
`text` or a List of the chunks for invokeAgent and invokeInlineAgent, the
document of the flow output for invokeFlow |
| aws2-polly | | `any`; text, bytes, a stream or a file for
synthesizeSpeech, the default, and startSpeechSynthesisTask | the audio as a
`stream` for synthesizeSpeech; a List for describeVoices, listLexicons and
listSpeechSynthesisTasks; the response of the SDK for the others |
| aws2-translate | | text, bytes, a stream or a file | the translated `text`
|
| aws2-comprehend | | text, bytes, a stream or a file, for every operation |
a `List` of what is found; the response of the SDK for detectSentiment and
classifyDocument |
| aws2-textract | | `any`: the document as bytes, a stream or a file, unless
options or headers name an S3 object | the response of the SDK |
| aws2-transcribe | | `any`: the audio is in S3, and the inputs are headers
| the response of the SDK; `unchanged` for deleteTranscriptionJob and
deleteVocabulary |
| aws2-rekognition | | `any`: the image is an `Image` of the SDK in a header
| the response of the SDK |
| aws-cloudtrail | the event as JSON `bytes`, one per event | | |
| aws2-timestream | | `any`: the records and the query are headers | the
response of the SDK |
**Checked at runtime.** Routes run with `camel run` logged the class of the
body after each step, with text, bytes, streams, files, Maps, POJOs and no
body. The AWS emulator of `camel infra run aws` answers Comprehend, Textract,
Rekognition, Transcribe, CloudTrail and the invoke and converse calls of
Bedrock. Polly, Timestream, Bedrock Agent, Bedrock Agent Runtime and the
streaming of Bedrock ran against a small fake of the AWS API that logs what
Camel sends. Translate ran against the fake too: the AWS SDK 2.56 talks to it
in Smithy RPC v2 CBOR, which the emulator does not know. CloudTrail ran with a
canned `CloudTrailClient` bean, as the emulator records no events.
- **aws-bedrock:**
- the invoke operations send the body as its toString(): bytes go as
`[B@...`, a stream as the name of its class, a file as its path, a Map as
`{inputText=Hello}` and no body as `null`;
- invokeTextModel gives a String for Titan, an ObjectNode for Claude 3 and
Mistral, and a TextNode for Llama; invokeImageModel gives an ArrayNode, and
invokeEmbeddingsModel the `InvokeModelResponse`;
- streaming gives the text, or an ArrayList of the chunks with
streamOutputMode=chunks or its header;
- converse and applyGuardrail fail without their header, and a Map body is
not used.
- **aws-bedrock-agent:** the body is not read; startIngestionJob gives the
job id as text; the consumer sends the same `IngestionJob` on every poll.
- **aws-bedrock-agent-runtime:** retrieveAndGenerate, retrieve and
invokeAgent read text, bytes, a stream and a file as text, and a Map as its
toString(); invokeFlow takes a String, and a Map or bytes fail.
- **aws2-polly:** synthesizeSpeech reads the text as above and gives the
audio as a stream, cached at the next step; putLexicon takes the lexicon from
the body when no option or header gives it.
- **aws2-translate and aws2-comprehend:** text, bytes, a stream and a file
are sent as text, and a Map or a POJO as its toString().
- **aws2-textract:** bytes, a stream and a file are the document, and a Map
fails; with the S3 headers or options the body is not read.
- **aws2-rekognition:** an image body is not used ("Image is a required
field"); the `CamelAwsRekognitionImage` header with an `Image` works, and with
bytes it does not.
- **aws2-transcribe and aws2-timestream:** the body is not read, a List of
records in the body included; the two transcribe delete operations keep the
body.
- **aws-cloudtrail:** one message per event, the JSON record as a byte
array; the CloudEvent data type keeps the bytes.
**Choices**
- The invoke operations of aws-bedrock take `text` only: bytes, a stream and
a file are sent as their toString(), so the description says to convert them to
a String first.
- Where a header can stand in for the body, the input side is `any`: the S3
object of aws2-textract, for example.
- `pojoRequest` is named only where the input side is `any`, as in the
previous AWS group: every AWS option is a component option, so naming it would
turn off the check of a text body for a step that leaves it out.
- Where most operations give the same body, the output side says that body,
and an option value covers each operation that differs. This keeps the
camel_catalog_doc answers under the cap of 18 000 characters. aws-bedrock now
lists 12 of its options in full instead of 18, as its options carry long enums.
- aws2-timestream: the annotation is on `Timestream2AbstractEndpoint`, the
class with `@UriEndpoint`, and covers both client types.
**Bugs found and filed, one per component:**
- CAMEL-26069 (Major), aws-bedrock: the invoke operations send the body as
its toString(); the image and embeddings streaming operations give an empty
text; pojoRequest=true without the modelId option fails with a
NullPointerException after the call; streaming does not resolve inference
profile ids (CAMEL-24224 fixed invokeTextModel only);
amazon.titan-embed-text-v2:0 is accepted by invokeTextModel; converseStream
never sets the GuardrailTrace header; no operation fails with a
NullPointerException.
- CAMEL-26070, aws-bedrock-agent: the catalog lists the 26 headers of
aws-bedrock-agent-runtime and none of its own (wrong `headersClass`); the page
shows the URI of aws-bedrock-agent-runtime; no operation fails with a
NullPointerException.
- CAMEL-26071, aws-bedrock-agent-runtime: invokeFlow does not convert bytes,
a stream or a file; invokeAgent picked by the operation header on an endpoint
configured for retrieve fails, as the async client is missing; modelId and
knowledgeBaseId are required for every operation; no operation fails with a
NullPointerException.
- CAMEL-26072 (Major), aws2-polly: the CamelAwsPollyTextType and
CamelAwsPollyOutputFormat headers are never read since 4.18.0, so SSML sent
with the header is spoken as text; the list operations drop the next token.
- CAMEL-26073, aws2-translate: one language as an option and the other as a
header sends no language for the header; Croatian is `cr`, which is Cree (`hr`).
- CAMEL-26074, aws2-textract: the FeatureTypes header as a List of Strings
fails with a ClassCastException; the start operations give the job id only in
the response.
- CAMEL-26075, aws2-transcribe: no operation fails with a
NullPointerException; createVocabulary sends a List of phrases as one phrase
"[a, b]"; two of the six delete operations keep the body.
- CAMEL-26076, aws2-rekognition: no operation fails with a
NullPointerException; the DetectionAttributes header as Strings fails with a
ClassCastException; the operation option is described with the Lambda
operations.
- CAMEL-26077, aws2-timestream: describeScheduledQuery never sends the ARN
of its header; the CamelAwsTimestreamRecord header is sent as the common
attributes, not as a record; no operation fails with a NullPointerException.
- CAMEL-26078, aws-cloudtrail: the CloudEvent data type sets `text/plain`
for a JSON body; the page says a stream must be created first.
- CAMEL-26079, camel-aws2: 14 trace logs of an AWS error can still throw a
NullPointerException (polly, aws-config, textract, rekognition, sns), missed by
CAMEL-24262; aws2-s3 reads the status code of the error details twice without a
check.
**Docs fixed**
- **aws-bedrock:** the chunks mode gives one message with a List of the
chunks, not one message per chunk: the option description and the page. The
component and endpoint DSL carry the option description.
- **aws2-comprehend:** the feedback example keeps the text in a variable for
detectKeyPhrases; it analyzed the toString() of the sentiment response.
- **aws2-timestream:** the POJO example builds a `CreateDatabaseRequest`
that compiles, and names the request it builds.
**Measured.**
- The validator over the 1204 human-written and 1209 model-written route
files gives the same reports as with #28327.
- Body types now cover 98.1% of the endpoint uses in the human-written
routes (97.5% with #28327), and 150 of the 413 component JSONs have them.
**Tests**
- `TextBodyFlowTest.testTheBodyOfAwsAiServices`:
- reported: a Map sent to aws2-translate, to aws2-comprehend, to
synthesizeSpeech, to invokeTextModel and to retrieveAndGenerate; a field read
after aws2-translate and after the aws-cloudtrail consumer;
- not reported: a Map sent to converse, aws2-rekognition, aws2-textract
and aws2-timestream, and to aws2-polly without an operation, which the
component may set.
- These pass:
- the 294 tests of camel-yaml-dsl-validator;
- the 265 validator and catalog doc tests of camel-jbang-core;
- the builds of camel-yaml-dsl-maven-plugin and
camel-yaml-dsl-deserializers.
- The answers of camel_catalog_doc stay under 18 000 characters:
aws2-rekognition, the largest, is 17 730.
_Claude Code on behalf of davsclaus_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]