You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public static ChatMessageContentPart CreateImagePart(BinaryData imageBytes, string imageBytesMediaType, ChatImageDetailLevel? imageDetailLevel = null);
public static ChatMessageContentPart CreateImagePart(Uri imageUri, ChatImageDetailLevel? imageDetailLevel = null);
In general for .NET APIs we try to avoid situations where the same type of argument in the same position leads to different behaviors, however here that happens because of an implicit cast from string to ChatImageDetailLevel. I had a call to CreateImagePart(imageBytes, "image/jpeg") and I then changed it to CreateImagePart(imageUrl, "image/jpeg"). It compiled fine, but then it threw an exception at run-time, because the "image/jpeg" was no longer considered to be a media type and instead considered to be an image detail level.
Steps to reproduce
See description above.
These APIs are now stable, so I'm not sure much can be done about it.
Code snippets
No response
OS
Windows 11
.NET version
.NET 8
Library version
2.0.0
The text was updated successfully, but these errors were encountered:
Service
OpenAI
Describe the bug
CreateImagePart has two overloads:
In general for .NET APIs we try to avoid situations where the same type of argument in the same position leads to different behaviors, however here that happens because of an implicit cast from string to ChatImageDetailLevel. I had a call to
CreateImagePart(imageBytes, "image/jpeg")
and I then changed it toCreateImagePart(imageUrl, "image/jpeg")
. It compiled fine, but then it threw an exception at run-time, because the "image/jpeg" was no longer considered to be a media type and instead considered to be an image detail level.Steps to reproduce
See description above.
These APIs are now stable, so I'm not sure much can be done about it.
Code snippets
No response
OS
Windows 11
.NET version
.NET 8
Library version
2.0.0
The text was updated successfully, but these errors were encountered: