Skip to content

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
@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.

2 participants