feat: [OpenAI] Tool Definition and Call Parsing V2 (Incl Execution)#418
Merged
feat: [OpenAI] Tool Definition and Call Parsing V2 (Incl Execution)#418
Conversation
…quest with tool handling
…nai/tool-definition-and-call-parsing
…verage for OpenAiFunctionCall and OpenAiFunctionTool
…ve redundant methods from OpenAiUtils
…sts for argument methods
…nhance type safety - OpenAiFunctionTool getter package private - introduce getArgumentsAsObject(OpenAiFunctionTool)
…call-parsing' into feat/openai/tool-definition-and-call-parsing
…nai/tool-definition-and-call-parsing-v2
rpanackal
commented
Apr 15, 2025
Comment on lines
+36
to
+38
| @AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
| public class OpenAiTool<I> { | ||
|
|
Member
Author
There was a problem hiding this comment.
After discussing with @CharlesDuboisSAP, we decided to keep OpenAiTools as a class and not as an interface. This approach conflicts with design of tool calls as
OpenAiFunctionCall (class) <-(implementing) OpenAiToolCall (interface)
The initial motivation was to have an interface that will implemented for possible new tool types other than function.
Since, we have don't enough information to back this possibility and to avoid casting, we decided to go with the current state.
Now, the question remains whether we also align tool call's design to match the current state with a breaking change
- OpenAiFunctionCall <- OpenAiToolCall(interface)
+ OpenAiToolCall (class)
newtork
reviewed
Apr 17, 2025
foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiTool.java
Outdated
Show resolved
Hide resolved
newtork
reviewed
Apr 23, 2025
...openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiChatCompletionRequest.java
Outdated
Show resolved
Hide resolved
…Executor.executeTools` to `OpenAiTool.execute`; Change mandatory argument value `assistantMessage.toolCalls()` to `assistantMessage`; Add intermediate API to optionally extract original execution result objects to `getMessages()` convenience method
…nition-and-call-parsing-v2
Contributor
|
I updated the documentation change SAP/ai-sdk#52 |
Jonas-Isr
reviewed
Apr 29, 2025
sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OpenAiServiceV2.java
Outdated
Show resolved
Hide resolved
…es/OpenAiServiceV2.java Co-authored-by: Jonas-Isr <j.israel.sap@icloud.com>
foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiTool.java
Outdated
Show resolved
Hide resolved
sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OpenAiServiceV2.java
Outdated
Show resolved
Hide resolved
sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OpenAiServiceV2.java
Outdated
Show resolved
Hide resolved
…ps://github.com/SAP/ai-sdk-java into feat/openai/tool-definition-and-call-parsing-v2
…ne constructor to builder pattern that enforces required values
…ectly return the tool message list
...n-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiFunctionCall.java
Outdated
Show resolved
Hide resolved
...n-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiFunctionCall.java
Outdated
Show resolved
Hide resolved
…nition-and-call-parsing-v2 # Conflicts: # docs/release_notes.md
foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiTool.java
Outdated
Show resolved
Hide resolved
foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiTool.java
Outdated
Show resolved
Hide resolved
CharlesDuboisSAP
approved these changes
May 14, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Context
AI/ai-sdk-java-backlog#214.
A more convenient tool call execution api compared to alternative #412
Feature scope:
OpenAiFunctionToolOpenAiFunctionCall-getArgumentsAsObject()and more...withOpenAiToolsDefinition of Done
Aligned changes with the JavaScript SDKDocumentation updated - Java 1.8.0 [OpenAI] Tool Definition and Call Parsing ai-sdk#52