ResponsesClient Class
- java.
lang. Object - com.
azure. ai. agents. ResponsesClient
- com.
public final class ResponsesClient
Initializes a new instance of the synchronous AgentsClient type.
Method Summary
| Modifier and Type | Method and Description |
|---|---|
| com.openai.models.responses.Response |
createAzureResponse(AzureCreateResponseOptions createResponse, ResponseCreateParams.Builder params)
Creates a response passing additional Azure-specific properties (such as an AgentReference) through the AzureCreateResponseOptions |
| com.openai.core.http.HttpResponseFor<com.openai.core.http.StreamResponse<com.openai.models.responses.ResponseStreamEvent>> |
createResponseStreamWithResponse(BinaryData createResponseRequest, RequestOptions requestOptions)
Creates a streaming response from a raw JSON request body and returns the raw HTTP response. |
| com.openai.core.http.HttpResponseFor<com.openai.models.responses.Response> |
createResponseWithResponse(BinaryData createResponseRequest, RequestOptions requestOptions)
Creates a response from a raw JSON request body and returns the raw HTTP response. |
|
Iterable |
createStreamingAzureResponse(AzureCreateResponseOptions createResponse, ResponseCreateParams.Builder params)
Creates a streaming response passing additional Azure-specific properties (such as an AgentReference) through the AzureCreateResponseOptions |
|
static
Azure |
getAzureFields(Response response)
Extracts Azure-specific fields from a Response's additional properties. |
| com.openai.services.blocking.ResponseService |
getResponseService()
Get the OpenAI client for responses. |
Methods inherited from java.lang.Object
Method Details
createAzureResponse
public Response createAzureResponse(AzureCreateResponseOptions createResponse, ResponseCreateParams.Builder params)
Creates a response passing additional Azure-specific properties (such as an AgentReference) through the AzureCreateResponseOptions
Parameters:
Returns:
createResponseStreamWithResponse
public HttpResponseFor<StreamResponse<ResponseStreamEvent>> createResponseStreamWithResponse(BinaryData createResponseRequest, RequestOptions requestOptions)
Creates a streaming response from a raw JSON request body and returns the raw HTTP response.
Delegates to the OpenAI Java SDK's ResponseService.WithRawResponse#createStreaming(ResponseCreateParams, RequestOptions). The createResponseRequest payload is forwarded as the request body (semantically, not byte-for-byte: the JSON is parsed and re-serialized, so property ordering and exact formatting may change and duplicate top-level keys are not preserved).
The returned HttpResponseFor wraps a StreamResponse of ResponseStreamEvent items, which the caller iterates via HttpResponseFor#parse(). The underlying stream must be closed when iteration completes; the typical pattern is try-with-resources on either the HttpResponseFor or the parsed StreamResponse.
Parameters:
null to use the defaults.
Returns:
createResponseWithResponse
public HttpResponseFor<Response> createResponseWithResponse(BinaryData createResponseRequest, RequestOptions requestOptions)
Creates a response from a raw JSON request body and returns the raw HTTP response.
This protocol method delegates to the OpenAI Java SDK's ResponseService.WithRawResponse#create(ResponseCreateParams, RequestOptions). The createResponseRequest payload is forwarded as the request body (semantically, not byte-for-byte: the JSON is parsed and re-serialized via additionalBodyProperties, so property ordering and exact formatting may change and duplicate top-level keys are not preserved), so callers can include Azure-specific extensions (such as AgentReference) without going through the strongly-typed ResponseCreateParams.Builder.
The returned HttpResponseFor exposes the status code, headers, and the raw response stream via body(), or the typed Response via parse(). Only one of body() or parse() may be invoked per response, and the caller must close the response (e.g. via try-with-resources) to release the underlying connection.
Note: the second parameter is the openai-java RequestOptions (not the azure-core type) so that the OpenAI-supported options (timeout, response validation) translate faithfully. Additional headers or query parameters must be supplied via the OpenAI request builder pattern (e.g. by using #createAzureResponse for fully-typed requests).
Parameters:
null to use the defaults.
Returns:
createStreamingAzureResponse
public IterableStream<ResponseStreamEvent> createStreamingAzureResponse(AzureCreateResponseOptions createResponse, ResponseCreateParams.Builder params)
Creates a streaming response passing additional Azure-specific properties (such as an AgentReference) through the AzureCreateResponseOptions
Parameters:
Returns:
getAzureFields
public static AzureCreateResponseDetails getAzureFields(Response response)
Extracts Azure-specific fields from a Response's additional properties.
Parameters:
Returns:
getResponseService
public ResponseService getResponseService()
Get the OpenAI client for responses.
Returns: