-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Describe the Problem/Bug
I created a Prompt Template with a response format of type ResponseFormatJsonObject (under the prompt.registry library). However, when I get the same prompt template from the prompt registry, the response format under the spec returns as type ResponseFormatText.
I have verified that the prompt template created in the prompt registry does contain the json object response format through the direct api call.
"response_format": {
"type": "json_object"
},
Additionally, tested with the java sdk orchestration's chatCompletion.
Steps to Reproduce
- Run the code snippet
- Check the spec in the
PromptTemplateGetResponsefrom the callpromptClient.getPromptTemplateByUuid(<prompt_id>). getReq.getSpec().getResponseFormat()returns
class ResponseFormatText {
type: unknown_default_open_api
}Expected Behavior
I expected the PromptTemplateGetResponse spec responseFormat to return of type ResponseFormatJsonObject.class.
Screenshots
No response
Used Versions
-
Java and Maven version via
mvn --version: 23.0.2 -
SAP Cloud SDK for AI version: tested with 1.9.0 and 1.13.0
-
Spring Boot or CAP version: ...
Dependency tree via
mvn dependency:tree
Dependency tree here
Code Examples
String scenerio = "categorization";
// 1. Create Prompt Template
PromptClient promptClient = new PromptClient();
var spec = PromptTemplateSpec.create()
.template(
SingleChatTemplate.create().role("system").content("Translate from {{?source_language}} to {{?target_language}}."),
SingleChatTemplate.create().role("user").content("{{?sentence}}."))
.responseFormat(ResponseFormatJsonObject.create().type(ResponseFormatJsonObject.TypeEnum.JSON_OBJECT));
var postReq = PromptTemplatePostRequest.create()
.name("translate-template")
.version("1.0.0")
.scenario("categorization")
.spec(spec);
PromptTemplatePostResponse created = promptClient.createUpdatePromptTemplate(postReq);
String templateId = created.getId().toString();
var getReq = promptClient.getPromptTemplateByUuid(created.getId());Stack Trace
No response
Log File
Log file
...Affected Development Phase
Development
Impact
Blocked
Timeline
release of our api in mid Jan 2026