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

Cloud SDK generator with oneOf fix #186

Merged
merged 16 commits into from
Nov 27, 2024
Merged

Cloud SDK generator with oneOf fix #186

merged 16 commits into from
Nov 27, 2024

Conversation

CharlesDuboisSAP
Copy link
Contributor

@CharlesDuboisSAP CharlesDuboisSAP commented Nov 25, 2024

Context

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

oneOf / anyOf / allOf with multiple possible options should form an interface or a class that is able to parse those multiple options

Feature scope:

  • oneOf support

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 added the please-review Request to review a pull-request label Nov 25, 2024
@CharlesDuboisSAP CharlesDuboisSAP self-assigned this Nov 25, 2024
<enumUnknownDefaultCase>true</enumUnknownDefaultCase>
<useBeanValidation>false</useBeanValidation>
<useOneOfInterfaces>true</useOneOfInterfaces>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

useOneOfInterfaces is the only addition compared to the old Cloud SDK generator

orchestration/src/main/resources/spec/orchestration.yaml Outdated Show resolved Hide resolved
orchestration/pom.xml Outdated Show resolved Hide resolved
orchestration/src/main/resources/spec/orchestration.yaml Outdated Show resolved Hide resolved
auto-merge was automatically disabled November 26, 2024 09:17

Pull Request is not mergeable

Comment on lines +171 to +173
final ObjectNode requestJson = JACKSON.createObjectNode();
requestJson.set("messages_history", JACKSON.valueToTree(prompt.getMessagesHistory()));
requestJson.set("input_params", JACKSON.valueToTree(prompt.getTemplateParameters()));
Copy link
Contributor

Choose a reason for hiding this comment

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

(Question/Minor)

Why not use CompletionPostRequest class as done before your change?

Your change requires the developer to know the keys are called "messages_history" and "input_params".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because Matthias built an invalid object that our builder doesn't allow anymore. Plus the developer still has to know the key orchestration_config (line 184)

Copy link
Member

Choose a reason for hiding this comment

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

The object itself isn't invalid, it's just not built all in one line of code 😉

We could still use CompletionPostRequest and just set the config to null explicitly, but then we have to suppress the warning, and overall it doesn't look much better. Alternatively, we could just make the constructors public, but I guess we don't want that for the few users who would use the low-level API and should be forced to supply all mandatory parameters..

Copy link
Contributor

@newtork newtork left a comment

Choose a reason for hiding this comment

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

It's not clear from the PR description whether / what version you updated the orchestration spec file.

@newtork newtork mentioned this pull request Nov 26, 2024
9 tasks
@CharlesDuboisSAP CharlesDuboisSAP enabled auto-merge (squash) November 26, 2024 10:23
@CharlesDuboisSAP
Copy link
Contributor Author

It's not clear from the PR description whether / what version you updated the orchestration spec file.

There is now no diff on the spec

Copy link
Member

@MatKuhr MatKuhr left a comment

Choose a reason for hiding this comment

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

📈📈📈

@CharlesDuboisSAP CharlesDuboisSAP merged commit 989adfd into main Nov 27, 2024
5 checks passed
@CharlesDuboisSAP CharlesDuboisSAP deleted the oneOf branch November 27, 2024 12:47
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