Add sub-content image support with interfaces and types for Anthropic

This commit is contained in:
Thorsten Sommer 2025-12-28 21:07:15 +01:00
parent 6a2d60740f
commit 80332f1fb1
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
5 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,9 @@
namespace AIStudio.Provider.Anthropic;
public interface ISubContentImageSource
{
/// <summary>
/// The type of the sub-content image.
/// </summary>
public SubContentImageType Type { get; }
}

View File

@ -0,0 +1,10 @@
namespace AIStudio.Provider.Anthropic;
public record SubContentBase64Image : ISubContentImageSource
{
public SubContentImageType Type => SubContentImageType.BASE64;
public string MediaType { get; init; } = string.Empty;
public string Data { get; init; } = string.Empty;
}

View File

@ -0,0 +1,10 @@
using AIStudio.Provider.OpenAI;
namespace AIStudio.Provider.Anthropic;
public record SubContentImage(SubContentType Type, ISubContentImageSource Source) : ISubContent
{
public SubContentImage() : this(SubContentType.IMAGE, new SubContentImageUrl())
{
}
}

View File

@ -0,0 +1,7 @@
namespace AIStudio.Provider.Anthropic;
public enum SubContentImageType
{
URL,
BASE64
}

View File

@ -0,0 +1,8 @@
namespace AIStudio.Provider.Anthropic;
public record SubContentImageUrl : ISubContentImageSource
{
public SubContentImageType Type => SubContentImageType.URL;
public string Url { get; init; } = string.Empty;
}