Liu Liu created FLINK-41001:
-------------------------------

             Summary: OpenAI model provider rejects compatible string input 
types
                 Key: FLINK-41001
                 URL: https://issues.apache.org/jira/browse/FLINK-41001
             Project: Flink
          Issue Type: Bug
          Components: Library / Machine Learning
    Affects Versions: 2.3.0, 2.2.0, 2.1.0, 2.4.0
            Reporter: Liu Liu


The OpenAI model provider validates its model input schema against an exact 
nullable, unbounded {{STRING}} type. Consequently, models declaring 
{{{}CHAR(n){}}}, bounded {{{}VARCHAR(n){}}}, or {{STRING NOT NULL}} inputs fail 
during prediction planning, although the provider supports their string 
representation.

For example,

 
{code:java}
CREATE MODEL chat_model
INPUT (prompt CHAR(5) NOT NULL)
OUTPUT (answer STRING)
WITH (
    'provider' = 'openai',
    'endpoint' = 'https://example.test/chat/completions',
    'api-key' = 'dummy',
    'model' = 'example'
);

CREATE TEMPORARY VIEW prompts AS
SELECT 'hello' AS prompt;

EXPLAIN PLAN FOR
SELECT * FROM TABLE(
    ML_PREDICT(TABLE prompts, MODEL chat_model, DESCRIPTOR(prompt))
); {code}
 

Planning fails with
{code:java}
input column prompt should be STRING, but is a CHAR(5) NOT NULL. {code}
The shared validation affects OpenAI models through SQL and Table API.

Input validation should accept CHAR and VARCHAR regardless of their length or 
nullability, while retaining the existing output schema, column count, and 
metadata constraints.



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

Reply via email to