Federico Mariani created CAMEL-23947:
----------------------------------------
Summary: camel-langchain4j-chat: remove unwired model builder
helpers (logResponses silently dropped)
Key: CAMEL-23947
URL: https://issues.apache.org/jira/browse/CAMEL-23947
Project: Camel
Issue Type: Bug
Components: camel-langchain4j-chat
Affects Versions: 4.21.0
Reporter: Federico Mariani
Attachments: OpenAiChatLanguageModelBuilderLogResponsesTest.java
camel-langchain4j-chat ships two model-builder helper classes that are not
reachable from the component configuration ({{chatModel}} is {{autowired}}; no
option references them):
* {{openai/OpenAiChatLanguageModelBuilder.build()}} calls
{{.logRequests(logRequests).logRequests(logResponses)}} (lines 75-76) — the
second call passes {{logResponses}} into {{logRequests}}, so
{{logResponses(...)}} is never applied and a user-requested
{{logRequests=false}} can be silently overridden.
* {{huggingface/HugginFaceChatLanguageModelBuilder}} (note the typo in the
class name) returns a {{HuggingFaceLanguageModel}}, which is a
{{LanguageModel}}, not a {{ChatModel}} — it cannot satisfy the component's
{{ChatModel}} configuration at all.
*Recommendation*: delete both helpers (they appear to be dead code) with a
deprecation note in the upgrade guide; alternatively fix the
{{logRequests}}/{{logResponses}} wiring and the HuggingFace return type, and
actually wire them into the component.
Attached reproducer {{OpenAiChatLanguageModelBuilderLogResponsesTest}} builds a
model with {{logRequests=false, logResponses=true}} and inspects the resulting
HTTP client: it ends up with the values swapped ({{logRequests=true,
logResponses=false}}).
_This issue was drafted by Claude Code on behalf of Federico Mariani._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)