Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce duplication of ResponseHandlers #244

Merged
merged 22 commits into from
Dec 23, 2024
Merged

Reduce duplication of ResponseHandlers #244

merged 22 commits into from
Dec 23, 2024

Conversation

CharlesDuboisSAP
Copy link
Contributor

@CharlesDuboisSAP CharlesDuboisSAP commented Dec 18, 2024

Context

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

Feature scope:

  • Merged both OrchestrationResponseHandler and OpenAiResponseHandler into a generic ClientResponseHandler

Definition of Done

  • Functionality scope stated & covered
  • Tests cover the scope above
  • Error handling created / updated & covered by the tests above
  • Aligned changes with the JavaScript SDK
  • Documentation updated
  • Release notes updated

@CharlesDuboisSAP CharlesDuboisSAP self-assigned this Dec 18, 2024
@CharlesDuboisSAP CharlesDuboisSAP added the please-review Request to review a pull-request label Dec 18, 2024
<coverage.instruction>68%</coverage.instruction>
<coverage.branch>52%</coverage.branch>
<coverage.method>73%</coverage.method>
<coverage.class>87%</coverage.class>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

orchestration tests don't count towards core coverage, therefore I separated the values into individual modules so these bad limits on the core module don't impact the other modules


static {
HANDLER.JACKSON = JACKSON;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Streaming handlers will be ported in the core module in a later PR if possible

Copy link
Contributor

Choose a reason for hiding this comment

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

The utility class currently has four public API accessors.
I'm feeling a little hesitant to merge this before code reduction is completed.
Let's make sure to address this before releasing 1.1.0.

@Slf4j
@RequiredArgsConstructor
class OrchestrationResponseHandler<T> implements HttpClientResponseHandler<T> {
public class ClientResponseHandler<T, E extends ClientException>
implements HttpClientResponseHandler<T> {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm marking this class as Beta, to discourage externals from using this class.

Maybe we can find a way to make this class not 100% dependent on Apache HTTP Client 5 API(?)

newtork
newtork previously approved these changes Dec 23, 2024
@newtork newtork enabled auto-merge (squash) December 23, 2024 15:12
@newtork newtork merged commit e173db5 into main Dec 23, 2024
4 checks passed
@newtork newtork deleted the reduce-duplication branch December 23, 2024 15:14
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.

4 participants