Jiri Ondrusek created CAMEL-25332:
-------------------------------------
Summary: camel-langchain4j-ingest - Remove the class-name check
for listener-wrapped models
Key: CAMEL-25332
URL: https://issues.apache.org/jira/browse/CAMEL-25332
Project: Camel
Issue Type: Task
Components: camel-langchain4j
Reporter: Jiri Ondrusek
Follow-up to CAMEL-25027.
With {{modality=media}} the producer refuses to start when the embedding model
has {{EmbeddingModelListener}}s attached: LangChain4j 1.20 builds the listener
context from each input's text ({{TextSegment.from(input.text())}}, both in the
default {{EmbeddingModel.embed(EmbeddingRequest)}} and in
{{ListeningEmbeddingModel}}), and a media input has no text, so every request
would fail inside the library with "text cannot be null or blank".
A model wrapped through {{addListener()}} becomes
{{dev.langchain4j.model.embedding.ListeningEmbeddingModel}}, a package-private
class that does not expose its listeners, so {{LangChain4jIngestProducer}}
detects it by comparing the class name as a string, next to the {{listeners()}}
check. The string comparison is a workaround for a library limitation, not a
Camel rule.
Once a LangChain4j release builds the listener context without input text, or
returns the wrapped listeners from {{listeners()}}, remove the class-name check
(and the refusal itself if listeners then work for media), the TODO comment
next to it, and the sentence about listeners in the media section of the
component documentation.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)