Class OpenAIImageDescriptionCopilot

OpenAIImageDescriptionCopilot sınıfı

OpenAICopilot sınıfı için görüntü işleme işlevselliği sağlar. OpenAI istemcisi oluşturma, ImageDescriptionCopilot seçeneklerinin yapılandırılması ve copilot’un görüntü açıklamaları oluşturma ve ekli belgelere açıklamalar ekleme kullanımına dair örnek kullanım.

// Create AI client.
var openAiClient = OpenAIClient
    .CreateWithApiKey(ApiKey) // Create OpenAI client with the API key.
    .WithProject("proj_RoywW1DLqDC89GoAW5ngoVN8") // Configure optional parameters.
    .WithOrganization("org_123")
    .Build(); // Build.

// Create copilot options.
var options = OpenAIImageDescriptionCopilotOptions
    .Create() // Create options like this, or...
    //.Create(options => { options.Model = OpenAIModels.Gpt35Turbo; }) // ...create using delegate.
    .WithModel(OpenAIModels.Gpt35Turbo) // Configure other optional parameters.
    .WithTemperature(0.5)
    .WithTopP(1)
    .WithDocument(new PdfDocument // Attach documents.
    {
        Name = "Another_Pdf_with_images",
        Document = new Document(GetInputPath("Pdf_with_images_low_res_bw.pdf"))
    })
    .WithDocument(GetInputPath("Mona_liza.jpg")) // Attach images
    .WithDocument(GetInputPath("Pdf_with_images.pdf")); // Attach document paths.

// Create copilot.
var copilot = AICopilotFactory.CreateImageDescriptionCopilot(openAiClient, options);

// Get Image descriptions.
List<ImageDescriptionResult> imageDescriptions = await copilot.GetImageDescriptionsAsync();

// Use extension method to add image descriptions to attached documents.
await copilot.AddPdfImageDescriptionsAsync("DocumentsOutputDirectory");
public class OpenAIImageDescriptionCopilot : IImageDescriptionCopilot

Yapıcılar

AdAçıklama
OpenAIImageDescriptionCopilot(IOpenAIClient, IImageDescriptionCopilotOptions<OpenAIImageDescriptionCopilotOptions>)OpenAIImageDescriptionCopilot sınıfının yeni bir örneğini başlatır.

Özellikler

AdAçıklama
HasContext { get; }

Yöntemler

AdAçıklama
GetImageDescriptionsAsync(CancellationToken?)

Ayrıca Bakınız