diff --git a/LLama.Examples/Examples/LlavaInteractiveModeExecute.cs b/LLama.Examples/Examples/LlavaInteractiveModeExecute.cs index 507f041b..8cfa7376 100644 --- a/LLama.Examples/Examples/LlavaInteractiveModeExecute.cs +++ b/LLama.Examples/Examples/LlavaInteractiveModeExecute.cs @@ -102,7 +102,7 @@ namespace LLama.Examples.Examples // foreach (var image in imagePaths) { - ex.Images.Add(File.ReadAllBytes(image)); + ex.Images.Add(new ImageData(ImageData.DataType.ImagePath, image)); } } diff --git a/LLama/Abstractions/ILLamaExecutor.cs b/LLama/Abstractions/ILLamaExecutor.cs index d6c8d2ce..977cbc5e 100644 --- a/LLama/Abstractions/ILLamaExecutor.cs +++ b/LLama/Abstractions/ILLamaExecutor.cs @@ -27,7 +27,7 @@ namespace LLama.Abstractions /// /// List of images: Image filen path, uri or image byte array. See ImageData. /// - public List Images { get; } + public List Images { get; } /// /// Asynchronously infers a response from the model. @@ -38,4 +38,46 @@ namespace LLama.Abstractions /// IAsyncEnumerable InferAsync(string text, IInferenceParams? inferenceParams = null, CancellationToken token = default); } + + /// + /// Holds image data + /// + public class ImageData + { + /// + /// constructor + /// + /// + /// + public ImageData(DataType type, object data) { Type = type; Data = data; } + + /// + /// the possible types of image data + /// + public enum DataType + { + /// + /// file path + /// + ImagePath, + /// + /// byte array + /// + ImageBytes, + /// + /// uri + /// + ImageURL + } + + /// + /// the type of this image data + /// + public DataType Type { get; set; } + + /// + /// the image data (string, byte array or uri) + /// + public object? Data { get; set; } + } } diff --git a/LLama/LLamaStatelessExecutor.cs b/LLama/LLamaStatelessExecutor.cs index f9d6ca5b..9d2f8c78 100644 --- a/LLama/LLamaStatelessExecutor.cs +++ b/LLama/LLamaStatelessExecutor.cs @@ -34,7 +34,7 @@ namespace LLama public LLavaWeights? ClipModel { get; } /// - public List Images { get; set; } + public List Images { get; set; } /// /// The context used by the executor when running the inference. @@ -49,7 +49,7 @@ namespace LLama /// public StatelessExecutor(LLamaWeights weights, IContextParams @params, ILogger? logger = null) { - Images = new List(); + Images = new List(); _weights = weights; _params = @params; _logger = logger;