Croway opened a new pull request, #20318:
URL: https://github.com/apache/camel/pull/20318
This PR introduces two features:
* The `AiAgentBody` now supports the `Content`, for example
```
String base64Image = Base64.getEncoder().encodeToString(imageBytes);
Image image = Image.builder()
.base64Data(base64Image)
.mimeType("image/png")
.build();
ImageContent imageContent = ImageContent.from(image);
AiAgentBody<ImageContent> body = new AiAgentBody<ImageContent>()
.withUserMessage("What do you see in this image? Describe it
briefly.")
.withContent(imageContent);
String response = template.requestBody("direct:multimodal-agent",
body, String.class);
...
from("direct:multimodal-agent")
.to("langchain4j-agent:multimodal?agent=#multimodalAgent")
.to("mock:response");
```
* Add a TypeConverter that convert known objects (WrappedFile, byte[],
InputStream) to Langchain4j `Content`. This the following is possible
```
from("file:my/path?noop=true&include=.*\\.png")
.setHeader(Headers.USER_MESSAGE, constant("What do
you see in this image? Describe it briefly."))
.to("langchain4j-agent:describe?agent=#fileAgent")
.to("mock:image-response");
```
Of course this works only with Multimodal LLMs
https://github.com/apache/camel/compare/main...Croway:langchain4j-multimodality?expand=1#diff-b0dc9cfbbe1c90adf071247e6747e0be5a00286be7f7af27d25d0102e1d0fda3R44
- This was introduced to reduce duplicated lines of 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]