Skip to content

Added sample showing how to do cancellations#48

Merged
KrzysztofCwalina merged 2 commits intomainfrom
cancellations
Jun 12, 2024
Merged

Added sample showing how to do cancellations#48
KrzysztofCwalina merged 2 commits intomainfrom
cancellations

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

@KrzysztofCwalina KrzysztofCwalina Jun 12, 2024

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.

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