Class AbstractOpenAIModelFunction

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static org.apache.flink.configuration.ConfigOption<String> API_KEY  
      protected com.openai.client.OpenAIClientAsync client  
      static org.apache.flink.configuration.ConfigOption<String> ENDPOINT  
      static org.apache.flink.configuration.ConfigOption<String> MODEL  
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractOpenAIModelFunction​(org.apache.flink.table.factories.ModelProviderFactory.Context factoryContext, org.apache.flink.configuration.ReadableConfig config)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      protected abstract String getEndpointSuffix()  
      void open​(org.apache.flink.table.functions.FunctionContext context)  
      protected void validateSingleColumnSchema​(org.apache.flink.table.catalog.ResolvedSchema schema, org.apache.flink.table.types.logical.LogicalType expectedType, String inputOrOutput)  
      • Methods inherited from class org.apache.flink.table.functions.AsyncPredictFunction

        asyncPredict, eval
      • Methods inherited from class org.apache.flink.table.functions.AsyncTableFunction

        getKind, getTypeInference
      • Methods inherited from class org.apache.flink.table.functions.UserDefinedFunction

        functionIdentifier, toString
      • Methods inherited from interface org.apache.flink.table.functions.FunctionDefinition

        getRequirements, isDeterministic, supportsConstantFolding
    • Field Detail

      • ENDPOINT

        public static final org.apache.flink.configuration.ConfigOption<String> ENDPOINT
      • API_KEY

        public static final org.apache.flink.configuration.ConfigOption<String> API_KEY
      • MODEL

        public static final org.apache.flink.configuration.ConfigOption<String> MODEL
      • client

        protected transient com.openai.client.OpenAIClientAsync client
    • Constructor Detail

      • AbstractOpenAIModelFunction

        public AbstractOpenAIModelFunction​(org.apache.flink.table.factories.ModelProviderFactory.Context factoryContext,
                                           org.apache.flink.configuration.ReadableConfig config)
    • Method Detail

      • open

        public void open​(org.apache.flink.table.functions.FunctionContext context)
                  throws Exception
        Overrides:
        open in class org.apache.flink.table.functions.UserDefinedFunction
        Throws:
        Exception
      • close

        public void close()
                   throws Exception
        Overrides:
        close in class org.apache.flink.table.functions.UserDefinedFunction
        Throws:
        Exception
      • getEndpointSuffix

        protected abstract String getEndpointSuffix()
      • validateSingleColumnSchema

        protected void validateSingleColumnSchema​(org.apache.flink.table.catalog.ResolvedSchema schema,
                                                  org.apache.flink.table.types.logical.LogicalType expectedType,
                                                  String inputOrOutput)