OpenAIImageModel
Namespace: Vercel.AI.OpenAI
public sealed class OpenAIImageModel : IImageModelOpenAI image generation and edit model.
Inheritance: object
Implements: IImageModel
Constructors
Section titled “Constructors”OpenAIImageModel(OpenAIProvider, string, Func<DateTimeOffset>?)
Section titled “OpenAIImageModel(OpenAIProvider, string, Func<DateTimeOffset>?)”public OpenAIImageModel(OpenAIProvider provider, string modelId, Func<DateTimeOffset>? clock = null)Creates an image model.
Parameters
| Name | Type | Description |
|---|---|---|
provider |
OpenAIProvider | |
modelId |
string | |
clock |
Func<DateTimeOffset> |
Properties
Section titled “Properties”MaxImagesPerCall
Section titled “MaxImagesPerCall”public int MaxImagesPerCall { get; }Maximum images accepted by one call for this model id.
Value: int
ModelId
Section titled “ModelId”public string ModelId { get; }Model id.
Value: string
Provider
Section titled “Provider”public string Provider { get; }Provider id.
Value: string
Methods
Section titled “Methods”DoGenerateAsync(ImageCallOptions, CancellationToken)
Section titled “DoGenerateAsync(ImageCallOptions, CancellationToken)”public Task<ImageGenerationResult> DoGenerateAsync(ImageCallOptions options, CancellationToken cancellationToken)Generates images. Maps to doGenerate on an image model.
Parameters
| Name | Type | Description |
|---|---|---|
options |
ImageCallOptions | |
cancellationToken |
CancellationToken |
Returns: Task<ImageGenerationResult>
GenerateAsync(OpenAIImageCall, CancellationToken)
Section titled “GenerateAsync(OpenAIImageCall, CancellationToken)”public Task<OpenAIImageGeneration> GenerateAsync(OpenAIImageCall call, CancellationToken cancellationToken)Generates or edits images.
Parameters
| Name | Type | Description |
|---|---|---|
call |
OpenAIImageCall | |
cancellationToken |
CancellationToken |
Returns: Task<OpenAIImageGeneration>
MaxImages(string)
Section titled “MaxImages(string)”public static int MaxImages(string modelId)Maximum images for <code class=“paramref”>modelId</code>.
Parameters
| Name | Type | Description |
|---|---|---|
modelId |
string |
Returns: int
OmitsResponseFormat(string)
Section titled “OmitsResponseFormat(string)”public static bool OmitsResponseFormat(string modelId)True when the model rejects an explicit response_format.
Parameters
| Name | Type | Description |
|---|---|---|
modelId |
string |
Returns: bool
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product