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

Added sample showing how to do cancellations #48

Merged
merged 2 commits into from
Jun 12, 2024
Merged

Conversation

KrzysztofCwalina
Copy link
Collaborator

No description provided.

ChatMessage message = ChatMessage.CreateUserMessage("Say 'this is a test.'");
BinaryData json = ModelReaderWriter.Write(message, wireFormat);

ClientResult result = client.CompleteChat(BinaryContent.Create(json), options);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This BinaryContent contains the JSON for one message:

{
    "role": "user",
    "content": "Say \u0027this is a test.\u0027"
}

This will result in a 400 error.

The appropriate format should be:

{
    "model": "gpt-4o",
    "messages": [
        {
            "role": "user",
            "content": "Say \u0027this is a test.\u0027"
        }
    ]
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I forgot about this. Now I get the context of your question about models not corresponding 1-1 to the payloads returned from protocol methods. I also don't think that we can get to 100% of 1-1 mappings, unless we introduce the concept of "protocol models", which i am not sure is worth it.

@KrzysztofCwalina KrzysztofCwalina merged commit 63e50ea into main Jun 12, 2024
1 check passed
@KrzysztofCwalina KrzysztofCwalina deleted the cancellations branch June 12, 2024 20:20
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.

None yet

2 participants