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

Support json mode #6

Merged
merged 2 commits into from
Mar 7, 2024
Merged

Support json mode #6

merged 2 commits into from
Mar 7, 2024

Conversation

Konboi
Copy link
Collaborator

@Konboi Konboi commented Mar 7, 2024

void createChatCompletion_with_json_mode() {
final List<ChatMessage> messages = new ArrayList<>();
final ChatMessage systemMessage = new ChatMessage(ChatMessageRole.SYSTEM.value(),
"Generate a random name and age json object. name field is a object that has first and last fields. age is a number.");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I confirmed locally then, OpenAI API returned

{
  "name": {
    "first": "Samantha",
    "last": "Jones"
  },
  "age": 27
}

@Konboi Konboi merged commit 9e56642 into main Mar 7, 2024
2 checks passed
@github-actions github-actions bot mentioned this pull request Mar 7, 2024
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.

1 participant