Skip to content
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

Simple OpenAI API #47

Merged
merged 15 commits into from
Sep 17, 2024
Merged

Simple OpenAI API #47

merged 15 commits into from
Sep 17, 2024

Conversation

CharlesDuboisSAP
Copy link
Contributor

@CharlesDuboisSAP CharlesDuboisSAP commented Sep 4, 2024

Context

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

We need the simple, default case of chat completion
The API should be enterprise/"PowerPoint ready" 😉

Current State

var request =
        new OpenAiChatCompletionParameters()
            .setMessages(
                List.of(new OpenAiChatUserMessage().addText("Describe the following image.")));
OpenAiClient.forModel(GPT4).chatCompletion(request);

New API

OpenAiClient.forModel(GPT4).chatCompletion("Describe the following image.");

Definition of Done

  • Functionality scope stated & covered
  • Tests cover the scope above
  • xError handling created / updated & covered by the tests above
  • Aligned changes with the JavaScript SDK TBD in the follow up item
  • Documentation updated
  • Release notes updated

# Conflicts:
#	foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClient.java
#	foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/OpenAiChatCompletionOutput.java
@CharlesDuboisSAP CharlesDuboisSAP changed the title Simple OpenAI API proposal Simple OpenAI AP Sep 5, 2024
@CharlesDuboisSAP CharlesDuboisSAP changed the title Simple OpenAI AP Simple OpenAI API Sep 5, 2024
@CharlesDuboisSAP CharlesDuboisSAP enabled auto-merge (squash) September 16, 2024 13:18
Comment on lines 109 to 110
parameters =
new OpenAiChatCompletionParameters()
Copy link
Member

Choose a reason for hiding this comment

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

We could move this to the constructor. This has the advantage that the user could also configure other parameters in the future, instead of giving them with each prompt

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The constructor is private

Copy link
Member

@MatKuhr MatKuhr left a comment

Choose a reason for hiding this comment

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

lgtm 👍🏼

@CharlesDuboisSAP CharlesDuboisSAP merged commit 95d0328 into main Sep 17, 2024
5 checks passed
@CharlesDuboisSAP CharlesDuboisSAP deleted the simple-openai branch September 17, 2024 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants