-
Notifications
You must be signed in to change notification settings - Fork 851
Image generation tool #6749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image generation tool #6749
Changes from all commits
ffe9a92
e5edc77
2d19cce
5eef474
ff80804
1725ce1
c44f5fb
b4fe94b
06bfa30
ca8b15d
62e0ac5
81e6e5a
6559a66
398bbdb
ac2de35
1d96532
6a6ffa2
94ceab2
96e9747
9ddc91a
3b589ac
20919ab
e5f68a6
9f9a430
799a72e
6029b01
173352a
69d2d98
86363f8
94cffbd
67089ab
56cf3b4
ad2b953
e20b768
b392df3
a38fd6c
cfa3f16
dcdebef
a60ddd2
50db985
10467a5
8cff0ae
7780595
9b94d68
87dfaa4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System.Diagnostics.CodeAnalysis; | ||
|
|
||
| namespace Microsoft.Extensions.AI; | ||
|
|
||
| /// <summary> | ||
| /// Represents the invocation of an image generation tool call by a hosted service. | ||
| /// </summary> | ||
| [Experimental("MEAI001")] | ||
| public sealed class ImageGenerationToolCallContent : AIContent | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="ImageGenerationToolCallContent"/> class. | ||
| /// </summary> | ||
| public ImageGenerationToolCallContent() | ||
| { | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the unique identifier of the image generation item. | ||
| /// </summary> | ||
| public string? ImageId { get; set; } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System.Collections.Generic; | ||
| using System.Diagnostics.CodeAnalysis; | ||
|
|
||
| namespace Microsoft.Extensions.AI; | ||
|
|
||
| /// <summary> | ||
| /// Represents an image generation tool call invocation by a hosted service. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// This content type represents when a hosted AI service invokes an image generation tool. | ||
| /// It is informational only and represents the call itself, not the result. | ||
| /// </remarks> | ||
| [Experimental("MEAI001")] | ||
| public sealed class ImageGenerationToolResultContent : AIContent | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="ImageGenerationToolResultContent"/> class. | ||
| /// </summary> | ||
| public ImageGenerationToolResultContent() | ||
| { | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the unique identifier of the image generation item. | ||
| /// </summary> | ||
| public string? ImageId { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the generated content items. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// Content is typically <see cref="DataContent"/> for images streamed from the tool, or <see cref="UriContent"/> for remotely hosted images, but | ||
| /// can also be provider-specific content types that represent the generated images. | ||
| /// </remarks> | ||
| public IList<AIContent>? Outputs { get; set; } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,6 +81,11 @@ protected ImageGenerationOptions(ImageGenerationOptions? other) | |
| /// </summary> | ||
| public ImageGenerationResponseFormat? ResponseFormat { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the number of intermediate streaming images to generate. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is only relevant for streaming requests, right? Might be worth a comment. Should partial or intermediate be in the name? Otherwise it seems like it could be confused with Count, like Count applies to non-streaming and this is the number to generate for streaming. Also, is this per image? Like, if I set Count to 4 and this to 5, will I get 5 or 20? |
||
| /// </summary> | ||
| public int? StreamingCount { get; set; } | ||
|
|
||
| /// <summary>Gets or sets any additional properties associated with the options.</summary> | ||
| public AdditionalPropertiesDictionary? AdditionalProperties { get; set; } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System.Diagnostics.CodeAnalysis; | ||
|
|
||
| namespace Microsoft.Extensions.AI; | ||
|
|
||
| /// <summary>Represents a hosted tool that can be specified to an AI service to enable it to perform image generation.</summary> | ||
| /// <remarks> | ||
| /// This tool does not itself implement image generation. It is a marker that can be used to inform a service | ||
| /// that the service is allowed to perform image generation if the service is capable of doing so. | ||
| /// </remarks> | ||
| [Experimental("MEAI001")] | ||
| public class HostedImageGenerationTool : AITool | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="HostedImageGenerationTool"/> class with the specified options. | ||
| /// </summary> | ||
| public HostedImageGenerationTool() | ||
| { | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the options used to configure image generation. | ||
| /// </summary> | ||
| public ImageGenerationOptions? Options { get; set; } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"ImageId" makes it sound to me like this is the ID of the resulting image. What is this? Is it the e equivalent of call id? Would RequestId be better?