Andrea Cosentino created CAMEL-24528:
----------------------------------------

             Summary: camel-huggingface: four task predictors swallow Python 
inference errors as success
                 Key: CAMEL-24528
                 URL: https://issues.apache.org/jira/browse/CAMEL-24528
             Project: Camel
          Issue Type: Bug
          Components: camel-ai
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino
             Fix For: 4.23.0


TextGenerationPredictor, SummarizationPredictor, QuestionAnsweringPredictor and 
TextToImagePredictor set the message body from output.getAsString("data") 
WITHOUT the error guard that the other predictors (TextClassification, 
ZeroShot, SentenceEmbeddings, ASR, TTS, Chat) have:

  if (result.contains("\"error\"")) { throw new RuntimeCamelException("Python 
inference failed: " + result); }

Each .py returns json.dumps({"error": str(e)}) in "data" on failure, so a 
model/CUDA/OOM error makes the route SUCCEED with body = the error JSON string 
masquerading as the generated text/summary/answer (for text-to-image, the error 
bytes are returned with Content-Type image/png).

Fix: add the same error guard before setting the body (for text-to-image, 
inspect the bytes).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to