Skip to content

Conversation

@rpanackal
Copy link
Member

@rpanackal rpanackal commented Jul 14, 2025

Context

AI/ai-sdk-java-backlog#253.

Previously, we didn't propagate the deserialized error response along with any thrown exception. This also meant our users have no access to diagnostic details returned by orchestration service (also applicable for openai).

The PR aims to rectify the above problem and especiallyy provide convenience for input and output filtering exceptions.

Here are two user issues created requesting the same convenience. They have both suggested some api. Maybe you can also look at this to have a better picture on what convenience may be added

#491
#468

Feature scope:

  • Better separation of module specific error handling with ClientExceptionFactory
  • Add getClientError that returns module specific error objects wrapping deserialized server response.
  • Add OrchestrationInputFilteringException and OrchestrationOutputFilteringException to distinguish filtering exception types with catch blocks.
  • Both filtering exception types contain Map<String, Object> getFilterDetails() to inspect the filtering details available.
  • Add getStatusCode to OrchestrationClientException to get the http status code
  • Extend unit testing for ClientResponseHandler
  • Add unit testing for ClientStreamingHandler
  • Improve Unit testing of input and output filtering
  • E2E test refactored to demo correct usage
  • Add getAzureContentSafetyOutput, getAzureContentSafetyInput and getLlamaGuard38b in the relevant filter exceptions.

Definition of Done

@rpanackal rpanackal self-assigned this Jul 14, 2025
@rpanackal rpanackal added the please-review Request to review a pull-request label Jul 14, 2025
null);
val entity = response.getEntity();
@Nonnull
protected E buildException(@Nonnull final ClassicHttpResponse httpResponse) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Comment)

I was thinking, If we moved this whole method and related logic into ClientExceptionFactory then we could get rid of generic argument R extends ClientError in this class :/ But this would risk further duplicate code though. It was just a thought

@newtork newtork added the please-review Request to review a pull-request label Aug 4, 2025
newtork
newtork previously approved these changes Aug 5, 2025
@newtork newtork enabled auto-merge (squash) August 5, 2025 10:05
newtork added 2 commits August 5, 2025 12:21
…ion-handling-factory' into feat/orchestration/filter-exception-handling-factory
@newtork newtork merged commit 8cc7024 into main Aug 5, 2025
7 checks passed
@newtork newtork deleted the feat/orchestration/filter-exception-handling-factory branch August 5, 2025 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

please-review Request to review a pull-request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants