Andrea Cosentino created CAMEL-24537:
----------------------------------------

             Summary: camel-openai: the chat-completion producer does not 
validate that a model is set
                 Key: CAMEL-24537
                 URL: https://issues.apache.org/jira/browse/CAMEL-24537
             Project: Camel
          Issue Type: Bug
          Components: camel-openai
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino
             Fix For: 4.23.0


OpenAIProducer resolves the model name (around line 156) and passes it to the 
OpenAI SDK request builder with .model(model) (around line 166) without a 
null/empty check. When no model option is configured on the endpoint, no 
default model is set, and no model header is supplied on the exchange, model is 
null and the call fails deep inside the OpenAI SDK with an opaque 
NullPointerException instead of a clear configuration error.

Every sibling producer in the module validates this before use — 
OpenAIResponsesProducer (lines 91-93), the Embeddings producer (line 69), the 
Moderation producer (line 71), the three audio producers, and ImageSupport. The 
chat-completion path is the only one missing the guard.

Fix: throw an IllegalArgumentException with a clear message (e.g. "Model must 
be specified either as an endpoint option, a default, or the model header") 
when the resolved model is null or empty.

_Claude Code on behalf of oscerd_



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

Reply via email to