generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 11
feat: Implementing minimal feature scope for Spring AI integration in OpenAI #526
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
Open
n-o-u-r-h-a-n
wants to merge
58
commits into
main
Choose a base branch
from
chatcompletion-for-springopenai
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
9ff262b
first draft
Jonas-Isr b14d70c
Align with docs
Jonas-Isr b32b999
Codestyle
Jonas-Isr 32d1bb2
Merge branch 'main' into agent-workflow-examples
Jonas-Isr 5720581
Merge branch 'main' into agent-workflow-examples
Jonas-Isr 64c8b0e
Merge branch 'main' into agent-workflow-examples
Jonas-Isr 98ab1af
Merge branch 'main' into agent-workflow-examples
CharlesDuboisSAP 0e59667
feat: [OpenAI] Spring AI integration
CharlesDuboisSAP 71898c5
test
CharlesDuboisSAP b056414
Merge branch 'agent-workflow-examples' into openai-springai
CharlesDuboisSAP 025eba1
test
CharlesDuboisSAP d402c64
Merge branch 'agent-workflow-examples' into openai-springai
CharlesDuboisSAP 7ed6baa
Merge branch 'main' into openai-springai
CharlesDuboisSAP 3b0273b
Fixing errors in OpenAiChatOptions according to "Upgrade to Spring AI…
n-o-u-r-h-a-n 8c2a638
Fixing errors in OpenAiChatOptions according to "Upgrade to Spring AI…
n-o-u-r-h-a-n 8eb5459
Fixing SpringAiAgenticWorkflowService according to "Upgrade to Spring…
n-o-u-r-h-a-n ab1f795
Implementation of completion and streamChatCompletion in SpringAiOpen…
n-o-u-r-h-a-n 9d4bdcd
Removing a comment
n-o-u-r-h-a-n 72198d9
Removing a comment
n-o-u-r-h-a-n 88904c8
Chat Memory test working.
n-o-u-r-h-a-n 47d1bc0
Formatting for SpringAiOpenAiService.
n-o-u-r-h-a-n 443e464
Removing unneccessary imports in SpringAiOpenAiService.
n-o-u-r-h-a-n 00ba4ad
Updating the toOpenAiRequest in OpenAiChatModel.java.
n-o-u-r-h-a-n 55c85d9
Implementing the new approach
n-o-u-r-h-a-n 56cda93
Editing the approach.
n-o-u-r-h-a-n 0183c83
Fix compilation and format and annotations and javadoc
newtork 02d5f54
Merge remote-tracking branch 'origin/main' into chatcompletion-for-sp…
newtork ee94941
Remove unrelated code
newtork dec85d6
implementation hint
newtork d99dc0e
Formatting
bot-sdk-js c073c8d
Updating OpenAiChatOptions.java with our Config Object.
n-o-u-r-h-a-n 6ed3a13
Formatting
bot-sdk-js 9f4a403
Passing our Config Object as an input parameter for OpenAiChatOptions()
n-o-u-r-h-a-n 687fe2e
Fixing NullPointerException in toOpenAiRequest method for ToolCallng …
n-o-u-r-h-a-n efa3831
Adding topK for the Config Class ??
n-o-u-r-h-a-n 817d3cb
Formatting
bot-sdk-js ad4241a
Update foundation-models/openai/src/main/java/com/sap/ai/sdk/foundati…
n-o-u-r-h-a-n 203eba6
Failing Test of testToolCallingWithoutExecution() in SpringAiOpenAiTe…
n-o-u-r-h-a-n f7c7ece
Resolving Reviewed Issues.
n-o-u-r-h-a-n 84546c0
Resolving Reviewed Issues.
n-o-u-r-h-a-n c52720e
--> still having testToolCallingWithoutExecution() in SpringAiOpenAiT…
n-o-u-r-h-a-n cd3501c
format
n-o-u-r-h-a-n 7f447d7
format
n-o-u-r-h-a-n 9e1760c
Removing wild cards imports
n-o-u-r-h-a-n 222924c
Sucessful build of OpenAi
n-o-u-r-h-a-n de9ef56
Sucessful build of Spring Boot app.
n-o-u-r-h-a-n 9fb6321
Merge branch 'main' into chatcompletion-for-springopenai
n-o-u-r-h-a-n 9284fe3
Formatting
bot-sdk-js 8d40dfa
Removing this test for now.
n-o-u-r-h-a-n be51dd3
Fix nullcheck
newtork d0ea158
Merge remote-tracking branch 'origin/chatcompletion-for-springopenai'…
newtork 3c161c0
Fix unit test
newtork 35d89cb
Merge branch 'main' into chatcompletion-for-springopenai
n-o-u-r-h-a-n c186aea
chore: Reduce constructor visibility in OpenAI / SpringAI PR (#531)
newtork 75a2361
Replacing config.toolsExecutable with getter-usage + adding tolerate …
n-o-u-r-h-a-n ddcb88c
Merge remote-tracking branch 'origin/chatcompletion-for-springopenai'…
n-o-u-r-h-a-n 9f27cb4
Merge branch 'main' into chatcompletion-for-springopenai
n-o-u-r-h-a-n 3e3d41a
Merge branch 'main' into chatcompletion-for-springopenai
n-o-u-r-h-a-n File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 130 additions & 0 deletions
130
...enai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiChatCompletionConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
package com.sap.ai.sdk.foundationmodels.openai; | ||
|
||
import com.sap.ai.sdk.foundationmodels.openai.generated.model.ChatCompletionStreamOptions; | ||
import com.sap.ai.sdk.foundationmodels.openai.generated.model.ChatCompletionTool; | ||
import com.sap.ai.sdk.foundationmodels.openai.generated.model.CreateChatCompletionRequestAllOfResponseFormat; | ||
import java.math.BigDecimal; | ||
import java.util.List; | ||
import java.util.Map; | ||
import javax.annotation.Nullable; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.With; | ||
|
||
/** Configuration for OpenAI chat completion requests. */ | ||
@With | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Getter | ||
public class OpenAiChatCompletionConfig { | ||
|
||
/** Upto 4 Stop sequences to interrupts token generation and returns a response without them. */ | ||
@Nullable List<String> stop; | ||
|
||
/** | ||
* Controls the randomness of the completion. | ||
* | ||
* <p>Lower values (e.g. 0.0) make the model more deterministic and repetitive, while higher | ||
* values (e.g. 1.0) make the model more random and creative. | ||
*/ | ||
@Nullable BigDecimal temperature; | ||
|
||
/** | ||
* Controls the cumulative probability threshold used for nucleus sampling. Alternative to {@link | ||
* #temperature}. | ||
* | ||
* <p>Lower values (e.g. 0.1) limit the model to consider only the smallest set of tokens whose | ||
* combined probabilities add up to at least 10% of the total. | ||
*/ | ||
@Nullable BigDecimal topP; | ||
|
||
/** | ||
* Controls the number of top tokens to consider for sampling. | ||
* | ||
* <p>Higher values (e.g. 50) allow the model to consider more tokens, while lower values (e.g. 1) | ||
* restrict it to the most probable token. | ||
*/ | ||
@Nullable Integer topK; | ||
|
||
/** Maximum number of tokens that can be generated for the completion. */ | ||
@Nullable Integer maxTokens; | ||
|
||
/** | ||
* Maximum number of tokens that can be generated for the completion, including consumed reasoning | ||
* tokens. This field supersedes {@link #maxTokens} and should be used with newer models. | ||
*/ | ||
@Nullable Integer maxCompletionTokens; | ||
|
||
/** | ||
* Encourage new topic by penalising token based on their presence in the completion. | ||
* | ||
* <p>Value should be in range [-2, 2]. | ||
*/ | ||
@Nullable BigDecimal presencePenalty; | ||
|
||
/** | ||
* Encourage new topic by penalising tokens based on their frequency in the completion. | ||
* | ||
* <p>Value should be in range [-2, 2]. | ||
*/ | ||
@Nullable BigDecimal frequencyPenalty; | ||
|
||
/** | ||
* A map that adjusts the likelihood of specified tokens by adding a bias value (between -100 and | ||
* 100) to the logits before sampling. Extreme values can effectively ban or enforce the selection | ||
* of tokens. | ||
*/ | ||
@Nullable Map<String, Integer> logitBias; | ||
|
||
/** | ||
* Unique identifier for the end-user making the request. This can help with monitoring and abuse | ||
* detection. | ||
*/ | ||
@Nullable String user; | ||
|
||
/** Whether to include log probabilities in the response. */ | ||
@Nullable Boolean logprobs; | ||
|
||
/** | ||
* Number of top log probabilities to return for each token. An integer between 0 and 20. This is | ||
* only relevant if {@code logprobs} is enabled. | ||
*/ | ||
@Nullable Integer topLogprobs; | ||
|
||
/** Number of completions to generate. */ | ||
@Nullable Integer n; | ||
|
||
/** Whether to allow parallel tool calls. */ | ||
@Nullable Boolean parallelToolCalls; | ||
|
||
/** Seed for random number generation. */ | ||
@Nullable Integer seed; | ||
|
||
/** Options for streaming the completion response. */ | ||
@Nullable ChatCompletionStreamOptions streamOptions; | ||
|
||
/** Response format for the completion. */ | ||
@Nullable CreateChatCompletionRequestAllOfResponseFormat responseFormat; | ||
|
||
/** | ||
* Tools the model may invoke during chat completion (metadata only). | ||
* | ||
* <p>Use {@link #withToolsExecutable} for registering executable tools. | ||
*/ | ||
@Nullable List<ChatCompletionTool> tools; | ||
|
||
/** | ||
* Tools the model may invoke during chat completion that are also executable at application | ||
* runtime. | ||
* | ||
* @since 1.8.0 | ||
*/ | ||
@Getter(value = AccessLevel.PACKAGE) | ||
@Nullable | ||
List<OpenAiTool> toolsExecutable; | ||
|
||
/** Option to control which tool is invoked by the model. */ | ||
@Nullable OpenAiToolChoice toolChoice; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.