Class OpenAiCompatibleModelClient
- java.lang.Object
-
- org.apache.flink.cdc.models.openai.OpenAiCompatibleModelClient
-
- All Implemented Interfaces:
Serializable,AutoCloseable,SupportsEmbedding,SupportsImageTextGeneration,SupportsTextGeneration,AiModelClient
public class OpenAiCompatibleModelClient extends Object implements AiModelClient, SupportsTextGeneration, SupportsEmbedding, SupportsImageTextGeneration
AI model client that connects to an OpenAI-compatible endpoint.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()float[]embed(String text)Converts the given text into a dense float vector.Stringgenerate(String systemPrompt, String userInput)Generates text based on a system-level prompt and a user-provided input message.StringgenerateTextFromImage(byte[] image, String prompt)Generates text from the given image bytes guided by a natural-language prompt.voidopen()
-
-
-
Method Detail
-
open
public void open()
- Specified by:
openin interfaceAiModelClient
-
close
public void close()
- Specified by:
closein interfaceAiModelClient- Specified by:
closein interfaceAutoCloseable
-
generate
public String generate(String systemPrompt, String userInput)
Description copied from interface:SupportsTextGenerationGenerates text based on a system-level prompt and a user-provided input message. Returns a JSON string conforming to the output schema declared by the calling AI function.- Specified by:
generatein interfaceSupportsTextGeneration
-
embed
public float[] embed(String text)
Description copied from interface:SupportsEmbeddingConverts the given text into a dense float vector.- Specified by:
embedin interfaceSupportsEmbedding
-
generateTextFromImage
public String generateTextFromImage(byte[] image, String prompt)
Description copied from interface:SupportsImageTextGenerationGenerates text from the given image bytes guided by a natural-language prompt.- Specified by:
generateTextFromImagein interfaceSupportsImageTextGeneration
-
-