Claus Ibsen created CAMEL-26219:
-----------------------------------

             Summary: camel-huggingface - the chat history map grows without 
bound, and any output containing the text "error" is treated as a failure
                 Key: CAMEL-26219
                 URL: https://issues.apache.org/jira/browse/CAMEL-26219
             Project: Camel
          Issue Type: Bug
          Components: camel-ai
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while adding the catalog body types of huggingface (CAMEL-24961, PR 
#28402).

h4. 1. The chat history map grows without bound

{{ChatPredictor}} (main 2a465aa4814c, line 103) keeps a {{ConcurrentHashMap}} 
of histories keyed by the memory id header (line 122); an entry is removed only 
with {{CamelChatClearHistory}} (line 127), so with one memory id per user or 
session the map and each history grow for the life of the endpoint. Read in the 
code, not run.

Proposed: bound the map (size or idle time) and the history length, or use a 
pluggable chat memory store.

h4. 2. Any output containing the quoted text "error" is treated as a failure

Every predictor checks {{result.contains("\"error\"")}} (for example 
{{TextGenerationPredictor}} line 107, {{ChatPredictor}} line 169, 
{{SummarizationPredictor}} line 109) and throws "Python inference failed", so a 
generated text that contains the word {{"error"}} in quotes (for example a JSON 
snippet) fails. Checked on 4.24.0-SNAPSHOT by calling the predictors' 
{{processOutput}} directly.

Proposed: parse the JSON and check for a top-level {{error}} key only.

h4. 3. text-to-speech sets Content-Type application/octet-stream on a POJO body

{{TextToSpeechPredictor}} (line 136) sets {{Content-Type: 
application/octet-stream}}, but the body is a DJL 
{{ai.djl.modality.audio.Audio}} object, not bytes. Checked on 4.24.0-SNAPSHOT 
by calling the predictor directly.

Proposed: set the body to the encoded audio bytes (WAV) to match the header, or 
do not set the header.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to