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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants