OpenAIWebClient
Contents
[
Hide
]Inheritance: java.lang.Object
All Implemented Interfaces: com.aspose.slides.IAIWebClient, java.io.Closeable
public class OpenAIWebClient implements IAIWebClient, Closeable
Build-in lightweight OpenAI web client
Constructors
Constructor | Description |
---|---|
OpenAIWebClient(String model, String apiKey, String organizationId) | Creates instance of OpenAI Web client. |
OpenAIWebClient(String model, String apiKey, String organizationId, HttpURLConnection httpClient) |
Methods
Method | Description |
---|---|
callChat(String instruction) | Sends a chat instruction to the AI model using an externally managed instance and returns response message to the given instruction. |
close() |
OpenAIWebClient(String model, String apiKey, String organizationId)
public OpenAIWebClient(String model, String apiKey, String organizationId)
Creates instance of OpenAI Web client.
Parameters:
Parameter | Type | Description |
---|---|---|
model | java.lang.String | OpenAI language model (gpt-4o, gpt-4o-mini, etc.) |
apiKey | java.lang.String | OpenAI API key |
organizationId | java.lang.String | Organization ID (optional) |
OpenAIWebClient(String model, String apiKey, String organizationId, HttpURLConnection httpClient)
public OpenAIWebClient(String model, String apiKey, String organizationId, HttpURLConnection httpClient)
Parameters:
Parameter | Type | Description |
---|---|---|
model | java.lang.String | |
apiKey | java.lang.String | |
organizationId | java.lang.String | |
httpClient | java.net.HttpURLConnection |
callChat(String instruction)
public String callChat(String instruction)
Sends a chat instruction to the AI model using an externally managed instance and returns response message to the given instruction.
Parameters:
Parameter | Type | Description |
---|---|---|
instruction | java.lang.String | The instruction or message to be processed by the AI model |
Returns: java.lang.String - The message generated by the AI model in response to the given instruction.
close()
public void close()