Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves Azure AI Agents SDK API documentation/codegen clarity by adding @ServiceMethod annotations that declare each method’s return type.
Changes:
- Added
@ServiceMethod(returns = ReturnType.SINGLE)to sync and async response creation methods. - Added
ServiceMethod/ReturnTypeimports to support the new annotations.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/ResponsesClient.java | Adds @ServiceMethod return-type annotations to sync response methods. |
| sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/ResponsesAsyncClient.java | Adds @ServiceMethod return-type annotations to async response methods. |
| * @param params The parameters to create the response. | ||
| * @return An IterableStream of ResponseStreamEvent. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.SINGLE) |
There was a problem hiding this comment.
createStreamingAzureResponse returns multiple events via IterableStream<ResponseStreamEvent>, but it’s annotated as ReturnType.SINGLE. This can mislead documentation and tooling that relies on @ServiceMethod. Please change this to the appropriate multi-item return type (typically ReturnType.COLLECTION for IterableStream).
| @ServiceMethod(returns = ReturnType.SINGLE) | |
| @ServiceMethod(returns = ReturnType.COLLECTION) |
| * @param params The parameters to create the response. | ||
| * @return A {@link Flux} stream of {@link ResponseStreamEvent} items. | ||
| */ | ||
| @ServiceMethod(returns = ReturnType.SINGLE) |
There was a problem hiding this comment.
createStreamingAzureResponse returns a stream of events via Flux<ResponseStreamEvent>, but it’s annotated as ReturnType.SINGLE. This is inconsistent with the method behavior and may cause incorrect docs/codegen metadata. Please use the appropriate multi-item return type (commonly ReturnType.COLLECTION for reactive streams emitting multiple items).
| @ServiceMethod(returns = ReturnType.SINGLE) | |
| @ServiceMethod(returns = ReturnType.COLLECTION) |
API Change CheckAPIView identified API level changes in this PR and created the following API reviews |
This pull request improves the Azure AI Agents SDK by enhancing the documentation and API clarity for both synchronous and asynchronous response creation methods. The main change is the addition of
@ServiceMethodannotations specifying the return type, which helps with code generation, documentation, and user understanding.API annotation improvements:
@ServiceMethod(returns = ReturnType.SINGLE)tocreateAzureResponseandcreateStreamingAzureResponsemethods in bothResponsesClientandResponsesAsyncClient, clarifying their return types and improving SDK usability. [1] [2] [3] [4]Dependency and import updates:
ServiceMethodandReturnTypeannotations in bothResponsesClient.javaandResponsesAsyncClient.javato support the new method annotations. [1] [2]