Skip to content

feat: [OpenAI] Tool Choice Convenience#330

Merged
rpanackal merged 3 commits intomainfrom
feat/openai-conv-api-toolChoice
Feb 25, 2025
Merged

feat: [OpenAI] Tool Choice Convenience#330
rpanackal merged 3 commits intomainfrom
feat/openai-conv-api-toolChoice

Conversation

@rpanackal
Copy link
Copy Markdown
Member

Context

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

Convenience request class contains fields of generated model types. Ideally, we want to limit scenarios the user would have to deal with generated model classes.

Tool choice convenience is lets the user to set the strategy for tools usage/selection.

Feature scope:

  • Convenience methods for tool use in request construction

Definition of Done

  • Functionality scope stated & covered
  • Tests cover the scope above
  • Error handling created / updated & covered by the tests above
  • Aligned changes with the JavaScript SDK
  • Documentation updated
  • Release notes updated

@rpanackal rpanackal changed the title Feat/openai conv api tool choice feat: [OpenAI] Tool Choice Convenience Feb 13, 2025
@rpanackal rpanackal self-assigned this Feb 13, 2025
@rpanackal rpanackal force-pushed the feat/stable-conv-openai branch from b3ead80 to f33bfad Compare February 17, 2025 14:14
Base automatically changed from feat/stable-conv-openai to main February 19, 2025 09:43
@rpanackal rpanackal force-pushed the feat/openai-conv-api-toolChoice branch from 24812d8 to f294360 Compare February 21, 2025 14:02
@rpanackal rpanackal added the please-review Request to review a pull-request label Feb 21, 2025
…nai-conv-api-toolChoice

# Conflicts:
#	sample-code/spring-app/src/test/java/com/sap/ai/sdk/app/services/OpenAiServiceV2.java

/** Option to control which tool is invoked by the model. */
@Nullable ChatCompletionToolChoiceOption toolChoice;
@With(AccessLevel.PRIVATE)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change, It's fine because we didn't release but be careful with those lombok annotations, they can create too much public API

@rpanackal rpanackal merged commit 0c75937 into main Feb 25, 2025
6 checks passed
@rpanackal rpanackal deleted the feat/openai-conv-api-toolChoice branch February 25, 2025 16:33
* @return the current OpenAiChatCompletionRequest instance.
*/
@Nonnull
public OpenAiChatCompletionRequest withToolChoiceNone() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Comment)

Not a huge fan of having these duplicate methods signatures, only differing by an apparent argument - that actually is not a real method argument. Apart from the String based variant.

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.

3 participants