-
Notifications
You must be signed in to change notification settings - Fork 15
fix: [PromptRegistry] Export templates as byte[] over File
#667
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
Conversation
| */ | ||
| @Nonnull | ||
| public File exportOrchestrationConfig( | ||
| public byte[] exportOrchestrationConfig( |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
|
Blocked until release of Cloud SDK 5.25.0 |
…yte-array-over-files
6110299 to
9867a40
Compare
|
We'll need a release note. |
Context
AI/ai-sdk-java-backlog#239.
Alternate:
Fileconverter inresttemplate#660Related:
Prerequisite to merge:
(...Continuing on the problem of
exportPromptTemplate()method calls fail asFiletype is unsupported)We can swap out the
Filewithbyte[]using<typeMappings>feature in (now upcoming) the Cloud SDK v5.25.0But purely using
<typeMappings>will failimportPromptTemplate()as its internal logic cannot handlebyte[]. Therefore, we also enable<useAbstractionForFiles>true</useAbstractionForFIles>, soorg.springframework.core.io.ResourcereplaceFiletypes request.Feature scope:
exportPromptTemplate()returns withbyte[]importPromptTemplate()acceptsorg.springframework.core.io.ResourceDefinition of Done
Error handling created / updated & covered by the tests aboveAligned changes with the JavaScript SDKDocumentation updated