davsclaus opened a new pull request, #28402:
URL: https://github.com/apache/camel/pull/28402
_Claude Code on behalf of davsclaus_
This group adds the catalog body types (CAMEL-24961) for thirteen AI
components:
- the model servers tensorflow-serving, kserve and huggingface;
- typesafe-ai and chatscript;
- the vector databases weaviate, pinecone and pgvector;
- ibm-watsonx-ai, ibm-watsonx-data, ibm-watson-discovery,
ibm-watson-speech-to-text and ibm-watson-text-to-speech.
Each change is an `@BodyTypes` annotation on the Endpoint, plus the JSON it
generates and the catalog copy. Four doc pages had their body text corrected.
All are producers.
**What the catalog says now**
| Component | Producer input | Producer output |
|---|---|---|
| tensorflow-serving | the protobuf request of the api, or its Builder; not
read for model-status and model-metadata | the `*Response` of the api |
| kserve | a `ModelInferRequest` for infer; not read by the others | the
`*Response` of the api |
| huggingface | by task: text, a `QAInput`, a List for zero-shot
classification, an `Audio` for speech recognition; text, bytes, a stream or a
file for chat | by task: text, `Classifications`, `float[][]`, a PNG `byte[]`
for text-to-image, an `Audio` for text-to-speech |
| typesafe-ai | the request as a Map; the state (text, a Map or a List) with
configured questions | a `JsonObject` (format json); unchanged with
resultProperty |
| chatscript | a `ChatScriptMessage`, or its JSON as text | the
`ChatScriptMessage` with the reply of the bot |
| weaviate | the vector as a List of Float or a `float[]`; a List of objects
for BATCH_CREATE; text for the hybrid and BM25 queries | the SDK object of the
action, or a `Boolean` |
| pinecone | the vector, or a List of ids for FETCH and DELETE_BY_ID | the
SDK response of the action; unchanged for the deletes of an index or a
collection |
| pgvector | the vector for UPSERT and SIMILARITY_SEARCH | the id as a
String for UPSERT; a List of Maps for SIMILARITY_SEARCH; a `Boolean` for the
others |
| ibm-watson-text-to-speech | `any`: the text to synthesize | the audio as
an `InputStream`, read once; the SDK objects for the list and get operations |
| ibm-watson-speech-to-text | the audio as bytes, a stream or a file |
`SpeechRecognitionResults`, with the transcript in a header |
| ibm-watson-discovery | `any`: the query text; a document for addDocument
and updateDocument | the SDK response of the operation |
| ibm-watsonx-data | `any`; a Map for updateTable | the SDK object; null for
the deletes |
| ibm-watsonx-ai | text for textGeneration; text or a List for chat,
embedding and rerank; a file, stream or bytes for the uploads | text; a List
for embedding (`List<List<Float>>`), rerank and the lists; an `Integer` for
tokenize; the SDK responses for extraction and classification |
**Checked at runtime.** Throwaway tests, not part of the PR, sent text,
bytes, a stream, a file, a Map, a POJO and no body, and logged the class of the
body after each step. Where they ran:
- **tensorflow-serving:** an in-process gRPC fake, and the real TensorFlow
Serving 2.19.1 container with the half_plus_two model.
- **kserve:** a gRPC fake. The Triton image is many GB and amd64 only.
- **huggingface:** the predictors' input and output steps, called directly,
as the module tests do. Python and torch are not installed.
- **typesafe-ai:** the fake HTTP server of its tests.
- **chatscript:** a fake socket server and the real test-infra image.
- **weaviate, pgvector:** test-infra in Docker.
- **pinecone:** pinecone-local.
- **IBM:** a local HTTP stub that the SDK client was pointed at. No
credentials were used.
Not run:
- the Python side of huggingface;
- the pinecone collections, which pinecone-local does not support;
- the watsonx-ai extraction, classification, forecast, deployment and tool
operations, and the streaming ones.
**Choices**
- The vector databases follow qdrant and milvus: one union of carriers, and
a description of what each action needs. Only pinecone has an `action` option
for byOption; weaviate and pgvector pick the action by a header.
- The protobuf javaTypes are written as `Class.getName()` gives them
(`Predict$PredictResponse`), as for qdrant.
- None of the IBM components has a default operation, so the defaults
describe the most common operation, and byOption covers the others, as for
Bedrock.
**Doc fixes**
- **huggingface:**
- Speech recognition takes an `Audio`; a `byte[]` fails.
- Text-to-speech gives an `ai.djl.modality.audio.Audio`.
- Zero-shot classification gives `Classifications` with autoSelect=false.
- **chatscript:**
- The JSON key is `message`, not `body`.
- A `ChatScriptMessage` is accepted.
- The reply is `response` in JSON.
- **ibm-watson-discovery:** the createCollection example read a header that
the producer never sets. It now reads the id of the collection from the body.
- **ibm-watsonx-ai** (examples): the embedding is a `List<List<Float>>`, so
the Qdrant example takes the first one.
**Bugs found, not fixed here.** The JIRAs, one per component, will follow.
- **ibm-watson-discovery:** `query` always fails with `NoClassDefFoundError:
com/google/gson/internal/$Gson$Types`. The Camel parent sets gson 2.14.0, and
the IBM sdk-core 9.20.0 still uses that internal class, which gson removed. It
fails even for `{"matching_results":0}`.
- **ibm-watsonx-data:**
- `getAllColumns` fails with the same Gson error, and other IBM SDK models
may too.
- updateTable takes only a `java.util.Map`, not JSON text.
- **ibm-watsonx-ai:**
- chat, chatStreaming and deploymentChat use a List body as
`List<ChatMessage>` without a check, so a List of Strings fails with a
ClassCastException.
- chat, embedding and rerank check for a String without type conversion,
so bytes or a stream (an HTTP body) fail, while textGeneration takes them.
- **ibm-watson-speech-to-text:** the stream that a File body is converted to
is not closed by Camel, as the branch of the producer that closes it never runs.
- **chatscript:**
- The producer uses `getOut()`, which drops every header.
- The first message of an endpoint, and the first after each resetChat, is
never sent: the bot gets the text "null", and the reply is its greeting.
- resetChat resets the endpoint's chatUserName, which is empty by default,
not the user of the message.
- **huggingface:**
- Every predictor treats an output that contains the text `"error"` in
quotes as a failure. A generated text such as `{"error": false}` fails with
"Python inference failed".
- Text-to-speech sets Content-Type `application/octet-stream`, but the
body is an `Audio` object.
- The chat history grows without bound.
- **tensorflow-serving, kserve:** a body that is not the request is dropped
with no error, and an empty request is sent. The server then answers "Missing
but required: {x}", which does not point at the body.
- **weaviate, pinecone, pgvector:** a vector as a List of Double, which JSON
gives, fails with a raw ClassCastException or ArrayStoreException.
- **pinecone:**
- QUERY without the CamelPineconeQueryTopK header fails with a
NullPointerException.
- From the code: the `pinecone:rag` transformer reads a List, but QUERY
leaves a `QueryResponseWithUnsignedIndices`.
- The test-infra service maps only port 5080, so the data-plane calls
cannot reach the index.
**Local checks**
- The changed modules build, with no change to the generated files after the
build.
- The catalog copies equal their modules.
- camel-catalog, camel-yaml-dsl-validator and camel-jbang-core tests pass.
- The Endpoint and Component DSLs regenerate with no change.
🤖 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]