Skip to content

Conversation

@rpanackal
Copy link
Member

@rpanackal rpanackal commented Nov 24, 2025

Context

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

Alternate:

Related:

Prerequisite to merge:

  • Release Cloud SDK v5.25.0

(...Continuing on the problem of exportPromptTemplate() method calls fail as File type is unsupported)

We can swap out the File with byte[] using <typeMappings> feature in (now upcoming) the Cloud SDK v5.25.0

But purely using <typeMappings> will fail importPromptTemplate() as its internal logic cannot handle byte[]. Therefore, we also enable <useAbstractionForFiles>true</useAbstractionForFIles> , so org.springframework.core.io.Resource replace File types request.

Feature scope:

  • exportPromptTemplate() returns with byte[]
  • importPromptTemplate() accepts org.springframework.core.io.Resource

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

*/
@Nonnull
public File exportOrchestrationConfig(
public byte[] exportOrchestrationConfig(
Copy link
Contributor

@newtork newtork Nov 25, 2025

Choose a reason for hiding this comment

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

(Comment)

After discussion we aligned on byte[] to be used over File.
Because the latter would require life-cycle handling, i.e. deletion after usage.

public OrchestrationConfigPostResponse importOrchestrationConfig(
@Nullable final String aiResourceGroup, @Nullable final File _file)
@Nullable final String aiResourceGroup,
@Nullable final org.springframework.core.io.Resource _file)
Copy link
Contributor

Choose a reason for hiding this comment

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

(Comment)

Usage of org.springframework.core.io.Resource was a compromise. In the future we may find a way to offer File or byte[] as argument without compilation to fail. Since this is generated code we do not offer hard API contract. The argument type here may be affected by breaking changes in the future - e.g. when migrating away from RestTemplate / Spring classes.

@rpanackal
Copy link
Member Author

Blocked until release of Cloud SDK 5.25.0

@newtork newtork force-pushed the fix/prompt-registry/byte-array-over-files branch from 6110299 to 9867a40 Compare December 29, 2025 20:40
@newtork newtork added please-review Request to review a pull-request and removed dont-merge labels Dec 29, 2025
@newtork
Copy link
Contributor

newtork commented Dec 29, 2025

We'll need a release note.

@rpanackal rpanackal enabled auto-merge (squash) December 30, 2025 16:03
@rpanackal rpanackal merged commit b948820 into main Dec 30, 2025
9 checks passed
@rpanackal rpanackal deleted the fix/prompt-registry/byte-array-over-files branch December 30, 2025 22:15
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.

3 participants