-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Update AssistantsWithVision example to use urls.
- Loading branch information
Showing
4 changed files
with
91 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/libs/OpenAI/Conversions/MessageContentImageUrlObject.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
namespace OpenAI; | ||
|
||
public partial class MessageContentImageUrlObject | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="uri"></param> | ||
/// <returns></returns> | ||
public static implicit operator MessageContentImageUrlObject(Uri uri) | ||
{ | ||
return FromUri(uri); | ||
} | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="uri"></param> | ||
/// <param name="detail"></param> | ||
/// <returns></returns> | ||
public static MessageContentImageUrlObject FromUri( | ||
Uri uri, | ||
MessageContentImageUrlObjectImageUrlDetail detail = MessageContentImageUrlObjectImageUrlDetail.Auto) | ||
{ | ||
uri = uri ?? throw new ArgumentNullException(nameof(uri)); | ||
|
||
return new MessageContentImageUrlObject | ||
{ | ||
ImageUrl = new MessageContentImageUrlObjectImageUrl | ||
{ | ||
Detail = detail, | ||
Url = uri.ToString(), | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters