-
Notifications
You must be signed in to change notification settings - Fork 15
feat: [OpenAI] Tool Definition and Call Parsing V2 (Incl Execution) #418
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
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
| @AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
| public class OpenAiTool<I> { | ||
|
|
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.
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)
foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiTool.java
Outdated
Show resolved
Hide resolved
...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
|
I updated the documentation change SAP/ai-sdk#52 |
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 <[email protected]>
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
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.
Looks good, minor comments
...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
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