chandru9 commented on code in PR #21704:
URL: https://github.com/apache/camel/pull/21704#discussion_r2905627172
##########
components/camel-ai/camel-langchain4j-agent/src/main/java/org/apache/camel/component/langchain4j/agent/LangChain4jAgentConverter.java:
##########
@@ -191,10 +165,44 @@ public static AiAgentBody<?>
inputStreamToAiAgentBody(InputStream inputStream, E
}
}
+ /**
+ * Converts a {@link String} to an {@link AiAgentBody} with the
appropriate {@link Content} type.
+ * <p>
+ * This converter is useful for the text components that return Text Body.
+ * </p>
+ *
+ * @param text String as message
+ * @param exchange the Camel exchange containing headers
+ * @return an AiAgentBody with the appropriate Content type
+ */
+ @Converter
+ public static AiAgentBody<?> textToAiAgentBody(String text, Exchange
exchange) {
+ TextContent content = TextContent.from(text);
+ return buildAiAgentBody(exchange, content, text);
+ }
+
+ /**
+ * Support Camel stream caching bodies (ByteArrayInputStreamCache) and
delegate them to the existing InputStream
+ * converter.
+ *
+ * @param cache the cached input stream containing the message body
+ * @param exchange the Camel exchange containing headers such as * {@code
CamelLangChain4jAgentMediaType},
+ * user/system messages, * and optional memory identifiers
+ * @return an {@link AiAgentBody} containing the appropriate *
LangChain4j {@link Content} representation
+ */
+ @Converter
+ public static AiAgentBody<?> inputStreamCacheToAiAgentBody(
Review Comment:
okay would be removed.
--
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]