-
Notifications
You must be signed in to change notification settings - Fork 22
feat: [Orchestration] reasoning content #939
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
base: main
Are you sure you want to change the base?
Changes from all commits
a1e9160
6390559
8c74197
d0385d9
f2201da
3c2c626
e85d7a0
0204cbe
cafb667
aba4b03
a845572
55a0523
6a3da98
8d3d2ca
49c4f2b
3931633
233b950
6b5f4ab
5805d62
59c8409
e75a7e2
6e13d46
4ded890
83c7664
bb4b560
7fb6f2e
4a1b55c
7a35992
dc3c736
a3790d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,8 @@ | |
|
|
||
| import com.sap.ai.sdk.core.common.StreamedDelta; | ||
| import com.sap.ai.sdk.orchestration.model.CompletionPostResponseStreaming; | ||
| import com.sap.ai.sdk.orchestration.model.ReasoningBlock; | ||
| import java.util.List; | ||
| import javax.annotation.Nonnull; | ||
| import javax.annotation.Nullable; | ||
| import lombok.val; | ||
|
|
@@ -27,6 +29,24 @@ public String getDeltaContent() { | |
| return ""; | ||
| } | ||
|
|
||
| /** | ||
| * Get the reasoning (thinking) text carried by this chunk. | ||
| * | ||
| * @return the reasoning text of each block in this chunk; never {@code null}, may be empty. | ||
| * @see <a href="https://help.sap.com/docs/sap-ai-core/generative-ai/reasoning">SAP AI Core: | ||
| * Orchestration - Reasoning</a> | ||
| */ | ||
| @Nonnull | ||
| public List<String> getDeltaReasoningContent() { | ||
| val choices = getFinalResult().getChoices(); | ||
| if (!choices.isEmpty() && choices.get(0).getIndex() == 0) { | ||
| return choices.get(0).getDelta().getReasoningContent().stream() | ||
|
Comment on lines
+40
to
+43
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you ask someone in the orchestration team why is
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed to release it with only the string and when we know of a use-case for the list we add it later. |
||
| .map(ReasoningBlock::getContent) | ||
| .toList(); | ||
| } | ||
| return List.of(); | ||
| } | ||
|
|
||
| @Nullable | ||
| @Override | ||
| public String getFinishReason() { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package com.sap.ai.sdk.orchestration; | ||
|
|
||
| import javax.annotation.Nonnull; | ||
| import lombok.Getter; | ||
|
|
||
| /** | ||
| * Reasoning effort levels for the harmonized {@code reasoning_effort} model parameter. | ||
| * | ||
| * <p>Not all reasoning-capable models support the full range of values. Where a model does not | ||
| * support a given effort, orchestration transparently maps it to the closest equivalent. | ||
| * | ||
| * @see <a href="https://help.sap.com/docs/sap-ai-core/generative-ai/reasoning">SAP AI Core: | ||
| * Orchestration - Reasoning</a> | ||
| */ | ||
| public enum ReasoningEffort { | ||
| /** Minimal reasoning effort. */ | ||
| MINIMAL("minimal"), | ||
| /** Low reasoning effort. */ | ||
| LOW("low"), | ||
| /** Medium reasoning effort. */ | ||
| MEDIUM("medium"), | ||
| /** High reasoning effort. */ | ||
| HIGH("high"), | ||
| /** Disable reasoning when the model supports doing so. */ | ||
| NONE("none"); | ||
|
|
||
| /** The string sent as the value of the {@code reasoning_effort} model parameter. */ | ||
| @Getter private final String value; | ||
|
|
||
| ReasoningEffort(@Nonnull final String value) { | ||
| this.value = value; | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.