Interface ChatCompletionService
-
- All Implemented Interfaces:
public interface ChatCompletionService
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
ChatCompletionService.WithRawResponse
A view of ChatCompletionService that provides access to raw HTTP responses for each method.
-
Method Summary
-
-
Method Detail
-
withRawResponse
abstract ChatCompletionService.WithRawResponse withRawResponse()
Returns a view of this service that provides access to raw HTTP responses for each method.
-
messages
abstract MessageService messages()
-
create
ChatCompletion create(ChatCompletionCreateParams params)
Starting a new project? We recommend trying Responses to take advantage of the latest OpenAI platform features. Compare Chat Completions with Responses.
Creates a model response for the given chat conversation. Learn more in the text generation, vision, and audio guides.
Parameter support can differ depending on the model used to generate the response, particularly for newer reasoning models. Parameters that are only supported for reasoning models are noted below. For the current state of unsupported parameters in reasoning models, refer to the reasoning guide.
-
create
abstract ChatCompletion create(ChatCompletionCreateParams params, RequestOptions requestOptions)
-
create
<T extends Any> StructuredChatCompletion<T> create(StructuredChatCompletionCreateParams<T> params)
Creates a model response for the given chat conversation. The model's structured output in JSON form will be deserialized automatically into an instance of the class
T
. See the SDK documentation for more details.
-
create
<T extends Any> StructuredChatCompletion<T> create(StructuredChatCompletionCreateParams<T> params, RequestOptions requestOptions)
Creates a model response for the given chat conversation. The model's structured output in JSON form will be deserialized automatically into an instance of the class
T
. See the SDK documentation for more details.
-
createStreaming
@MustBeClosed() StreamResponse<ChatCompletionChunk> createStreaming(ChatCompletionCreateParams params)
Starting a new project? We recommend trying Responses to take advantage of the latest OpenAI platform features. Compare Chat Completions with Responses.
Creates a model response for the given chat conversation. Learn more in the text generation, vision, and audio guides.
Parameter support can differ depending on the model used to generate the response, particularly for newer reasoning models. Parameters that are only supported for reasoning models are noted below. For the current state of unsupported parameters in reasoning models, refer to the reasoning guide.
-
createStreaming
@MustBeClosed() abstract StreamResponse<ChatCompletionChunk> createStreaming(ChatCompletionCreateParams params, RequestOptions requestOptions)
-
retrieve
ChatCompletion retrieve(String completionId)
Get a stored chat completion. Only Chat Completions that have been created with the
store
parameter set totrue
will be returned.
-
retrieve
ChatCompletion retrieve(String completionId, ChatCompletionRetrieveParams params, RequestOptions requestOptions)
-
retrieve
ChatCompletion retrieve(String completionId, ChatCompletionRetrieveParams params)
-
retrieve
abstract ChatCompletion retrieve(ChatCompletionRetrieveParams params, RequestOptions requestOptions)
-
retrieve
ChatCompletion retrieve(ChatCompletionRetrieveParams params)
-
retrieve
ChatCompletion retrieve(String completionId, RequestOptions requestOptions)
-
update
ChatCompletion update(String completionId, ChatCompletionUpdateParams params)
Modify a stored chat completion. Only Chat Completions that have been created with the
store
parameter set totrue
can be modified. Currently, the only supported modification is to update themetadata
field.
-
update
ChatCompletion update(String completionId, ChatCompletionUpdateParams params, RequestOptions requestOptions)
-
update
ChatCompletion update(ChatCompletionUpdateParams params)
-
update
abstract ChatCompletion update(ChatCompletionUpdateParams params, RequestOptions requestOptions)
-
list
ChatCompletionListPage list()
List stored Chat Completions. Only Chat Completions that have been stored with the
store
parameter set totrue
will be returned.
-
list
abstract ChatCompletionListPage list(ChatCompletionListParams params, RequestOptions requestOptions)
-
list
ChatCompletionListPage list(ChatCompletionListParams params)
-
list
ChatCompletionListPage list(RequestOptions requestOptions)
-
delete
ChatCompletionDeleted delete(String completionId)
Delete a stored chat completion. Only Chat Completions that have been created with the
store
parameter set totrue
can be deleted.
-
delete
ChatCompletionDeleted delete(String completionId, ChatCompletionDeleteParams params, RequestOptions requestOptions)
-
delete
ChatCompletionDeleted delete(String completionId, ChatCompletionDeleteParams params)
-
delete
abstract ChatCompletionDeleted delete(ChatCompletionDeleteParams params, RequestOptions requestOptions)
-
delete
ChatCompletionDeleted delete(ChatCompletionDeleteParams params)
-
delete
ChatCompletionDeleted delete(String completionId, RequestOptions requestOptions)
-
-
-
-