Skip to content

Conversation

@rpanackal
Copy link
Member

@rpanackal rpanackal commented Apr 15, 2025

Context

AI/ai-sdk-java-backlog#214.

A more convenient tool call execution api compared to alternative #412

  • Handles tool execution as well

Feature scope:

  • New convenience class for tool definition OpenAiFunctionTool
  • Convenience for parsing arguments in OpenAiFunctionCall - getArgumentsAsObject() and more...
  • New setter for tools in request class - withOpenAiTools
  • A OpenAiToolExecutor that executes given tools with matching calls.

Definition of Done

rpanackal and others added 22 commits April 7, 2025 11:39
…verage for OpenAiFunctionCall and OpenAiFunctionTool
…nhance type safety

- OpenAiFunctionTool getter package private
- introduce getArgumentsAsObject(OpenAiFunctionTool)
…call-parsing' into feat/openai/tool-definition-and-call-parsing
@rpanackal rpanackal changed the title feat: [OpenAI] Tool Definition and Call Parsing V2 feat: [OpenAI] Tool Definition and Call Parsing V2 (Incl Execution) Apr 15, 2025
@rpanackal rpanackal added the please-review Request to review a pull-request label Apr 15, 2025
Comment on lines 36 to 38
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class OpenAiTool<I> {

Copy link
Member Author

@rpanackal rpanackal Apr 15, 2025

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)

a-d and others added 3 commits April 28, 2025 16:53
…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
@newtork
Copy link
Contributor

newtork commented Apr 28, 2025

I updated the documentation change SAP/ai-sdk#52

Copy link
Contributor

@CharlesDuboisSAP CharlesDuboisSAP left a 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

@newtork newtork merged commit f21c732 into main May 14, 2025
7 checks passed
@newtork newtork deleted the feat/openai/tool-definition-and-call-parsing-v2 branch May 14, 2025 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

please-review Request to review a pull-request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants