Skip to content

Commit

Permalink
Update DTOs
Browse files Browse the repository at this point in the history
  • Loading branch information
Layoric committed Oct 7, 2024
1 parent cc93f14 commit 1bb0fa7
Show file tree
Hide file tree
Showing 4 changed files with 226 additions and 285 deletions.
144 changes: 39 additions & 105 deletions AiServer.ServiceModel/Generations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,19 @@ public class ActiveMediaModels : IGet, IReturn<StringsResponse> {}
[Description("Transcribe audio content to text")]
public class SpeechToText : IGeneration, IReturn<GenerationResponse>
{
[ApiMember(Description = "The audio stream containing the speech to be transcribed", ParameterType = "body")]
[ApiMember(Description = "The audio stream containing the speech to be transcribed")]
[Description("The audio stream containing the speech to be transcribed")]
[Required]
[Input(Type = "file")]
public Stream Speech { get; set; }

[ApiMember(Description = "Optional client-provided identifier for the request", ParameterType = "query")]
[ApiMember(Description = "Optional client-provided identifier for the request")]
[Description("Optional client-provided identifier for the request")]
public string? RefId { get; set; }

[ApiMember(Description = "Optional queue or topic to reply to", ParameterType = "query")]
[Description("Optional queue or topic to reply to")]
public string? ReplyTo { get; set; }

[ApiMember(Description = "Tag to identify the request", ParameterType = "query")]
[ApiMember(Description = "Tag to identify the request")]
[Description("Tag to identify the request")]
public string? Tag { get; set; }

[ApiMember(Description = "Optional state to associate with the request", ParameterType = "query")]
[Description("Optional state to associate with the request")]
[Input(Type = "hidden")]
public string? State { get; set; }
}

[ValidateApiKey]
Expand All @@ -44,32 +35,23 @@ public class SpeechToText : IGeneration, IReturn<GenerationResponse>
[Description("Generate speech audio from text input")]
public class TextToSpeech : IGeneration, IReturn<GenerationResponse>
{
[ApiMember(Description = "The text to be converted to speech", ParameterType = "body")]
[ApiMember(Description = "The text to be converted to speech")]
[Description("The text to be converted to speech")]
[Required]
public string Text { get; set; }

[ApiMember(Description = "Optional seed for reproducible results in speech generation", ParameterType = "query")]
[ApiMember(Description = "Optional seed for reproducible results in speech generation")]
[Description("Optional seed for reproducible results in speech generation")]
[Range(0, int.MaxValue)]
public int? Seed { get; set; }

[ApiMember(Description = "Optional client-provided identifier for the request", ParameterType = "query")]
[ApiMember(Description = "Optional client-provided identifier for the request")]
[Description("Optional client-provided identifier for the request")]
public string? RefId { get; set; }

[ApiMember(Description = "Optional queue or topic to reply to", ParameterType = "query")]
[Description("Optional queue or topic to reply to")]
public string? ReplyTo { get; set; }

[ApiMember(Description = "Tag to identify the request", ParameterType = "query")]
[ApiMember(Description = "Tag to identify the request")]
[Description("Tag to identify the request")]
public string? Tag { get; set; }

[ApiMember(Description = "Optional state to associate with the request", ParameterType = "query")]
[Description("Optional state to associate with the request")]
[Input(Type = "hidden")]
public string? State { get; set; }
}

[ValidateApiKey]
Expand All @@ -78,57 +60,48 @@ public class TextToSpeech : IGeneration, IReturn<GenerationResponse>
[Description("Create an image based on a text prompt")]
public class TextToImage : IGeneration, IReturn<GenerationResponse>
{
[ApiMember(Description = "The main prompt describing the desired image", ParameterType = "body")]
[ApiMember(Description = "The main prompt describing the desired image")]
[Description("The main prompt describing the desired image")]
[ValidateNotEmpty]
[Input(Type = "textarea")]
public string PositivePrompt { get; set; }

[ApiMember(Description = "Optional prompt specifying what should not be in the image", ParameterType = "body")]
[ApiMember(Description = "Optional prompt specifying what should not be in the image")]
[Description("Optional prompt specifying what should not be in the image")]
[Input(Type = "textarea")]
public string? NegativePrompt { get; set; }

[ApiMember(Description = "Desired width of the generated image", ParameterType = "query")]
[ApiMember(Description = "Desired width of the generated image")]
[Description("Desired width of the generated image")]
[Range(64, 2048)]
public int? Width { get; set; }

[ApiMember(Description = "Desired height of the generated image", ParameterType = "query")]
[ApiMember(Description = "Desired height of the generated image")]
[Description("Desired height of the generated image")]
[Range(64, 2048)]
public int? Height { get; set; }

[ApiMember(Description = "Number of images to generate in a single batch", ParameterType = "query")]
[ApiMember(Description = "Number of images to generate in a single batch")]
[Description("Number of images to generate in a single batch")]
[Range(1, 10)]
public int? BatchSize { get; set; }

[ApiMember(Description = "The AI model to use for image generation", ParameterType = "query")]
[ApiMember(Description = "The AI model to use for image generation")]
[Description("The AI model to use for image generation")]
public string? Model { get; set; }

[ApiMember(Description = "Optional seed for reproducible results", ParameterType = "query")]
[ApiMember(Description = "Optional seed for reproducible results")]
[Description("Optional seed for reproducible results")]
[Range(0, int.MaxValue)]
public int? Seed { get; set; }

[ApiMember(Description = "Optional client-provided identifier for the request", ParameterType = "query")]
[ApiMember(Description = "Optional client-provided identifier for the request")]
[Description("Optional client-provided identifier for the request")]
public string? RefId { get; set; }

[ApiMember(Description = "Optional queue or topic to reply to", ParameterType = "query")]
[Description("Optional queue or topic to reply to")]
public string? ReplyTo { get; set; }

[ApiMember(Description = "Tag to identify the request", ParameterType = "query")]
[ApiMember(Description = "Tag to identify the request")]
[Description("Tag to identify the request")]
public string? Tag { get; set; }

[ApiMember(Description = "Optional state to associate with the request", ParameterType = "query")]
[Description("Optional state to associate with the request")]
[Input(Type = "hidden")]
public string? State { get; set; }
}

[ValidateApiKey]
Expand All @@ -137,54 +110,45 @@ public class TextToImage : IGeneration, IReturn<GenerationResponse>
[Description("Create a new image based on an existing image and a text prompt")]
public class ImageToImage : IGeneration, IReturn<GenerationResponse>
{
[ApiMember(Description = "The image to use as input", ParameterType = "body")]
[ApiMember(Description = "The image to use as input")]
[Description("The image to use as input")]
[Required]
[Input(Type = "file")]
public Stream Image { get; set; }

[ApiMember(Description = "Prompt describing the desired output", ParameterType = "body")]
[ApiMember(Description = "Prompt describing the desired output")]
[Description("Prompt describing the desired output")]
[ValidateNotEmpty]
[Input(Type = "textarea")]
public string PositivePrompt { get; set; }

[ApiMember(Description = "Negative prompt describing what should not be in the image", ParameterType = "body")]
[ApiMember(Description = "Negative prompt describing what should not be in the image")]
[Description("Negative prompt describing what should not be in the image")]
[Input(Type = "textarea")]
public string? NegativePrompt { get; set; }

[ApiMember(Description = "Optional specific amount of denoise to apply", ParameterType = "query")]
[ApiMember(Description = "Optional specific amount of denoise to apply")]
[Description("Optional specific amount of denoise to apply")]
[Range(0, 1)]
public float? Denoise { get; set; }

[ApiMember(Description = "Number of images to generate in a single batch", ParameterType = "query")]
[ApiMember(Description = "Number of images to generate in a single batch")]
[Description("Number of images to generate in a single batch")]
[Range(1, 10)]
public int? BatchSize { get; set; }

[ApiMember(Description = "Optional seed for reproducible results in image generation", ParameterType = "query")]
[ApiMember(Description = "Optional seed for reproducible results in image generation")]
[Description("Optional seed for reproducible results in image generation")]
[Range(0, int.MaxValue)]
public int? Seed { get; set; }

[ApiMember(Description = "Optional client-provided identifier for the request", ParameterType = "query")]
[ApiMember(Description = "Optional client-provided identifier for the request")]
[Description("Optional client-provided identifier for the request")]
public string? RefId { get; set; }

[ApiMember(Description = "Optional queue or topic to reply to", ParameterType = "query")]
[Description("Optional queue or topic to reply to")]
public string? ReplyTo { get; set; }

[ApiMember(Description = "Tag to identify the request", ParameterType = "query")]
[ApiMember(Description = "Tag to identify the request")]
[Description("Tag to identify the request")]
public string? Tag { get; set; }

[ApiMember(Description = "Optional state to associate with the request", ParameterType = "query")]
[Description("Optional state to associate with the request")]
[Input(Type = "hidden")]
public string? State { get; set; }
}

[ValidateApiKey]
Expand All @@ -193,33 +157,24 @@ public class ImageToImage : IGeneration, IReturn<GenerationResponse>
[Description("Increase the resolution and quality of an input image")]
public class ImageUpscale : IGeneration, IReturn<GenerationResponse>
{
[ApiMember(Description = "The image to upscale", ParameterType = "body")]
[ApiMember(Description = "The image to upscale")]
[Description("The image to upscale")]
[Required]
[Input(Type = "file")]
public Stream Image { get; set; }

[ApiMember(Description = "Optional seed for reproducible results in image generation", ParameterType = "query")]
[ApiMember(Description = "Optional seed for reproducible results in image generation")]
[Description("Optional seed for reproducible results in image generation")]
[Range(0, int.MaxValue)]
public int? Seed { get; set; }

[ApiMember(Description = "Optional client-provided identifier for the request", ParameterType = "query")]
[ApiMember(Description = "Optional client-provided identifier for the request")]
[Description("Optional client-provided identifier for the request")]
public string? RefId { get; set; }

[ApiMember(Description = "Optional queue or topic to reply to", ParameterType = "query")]
[Description("Optional queue or topic to reply to")]
public string? ReplyTo { get; set; }

[ApiMember(Description = "Tag to identify the request", ParameterType = "query")]
[ApiMember(Description = "Tag to identify the request")]
[Description("Tag to identify the request")]
public string? Tag { get; set; }

[ApiMember(Description = "Optional state to associate with the request", ParameterType = "query")]
[Description("Optional state to associate with the request")]
[Input(Type = "hidden")]
public string? State { get; set; }
}

[ValidateApiKey]
Expand All @@ -228,55 +183,46 @@ public class ImageUpscale : IGeneration, IReturn<GenerationResponse>
[Description("Create a new image by applying a mask to an existing image and generating content for the masked area")]
public class ImageWithMask : IGeneration, IReturn<GenerationResponse>
{
[ApiMember(Description = "Prompt describing the desired output in the masked area", ParameterType = "body")]
[ApiMember(Description = "Prompt describing the desired output in the masked area")]
[Description("Prompt describing the desired output in the masked area")]
[ValidateNotEmpty]
[Input(Type = "textarea")]
public string PositivePrompt { get; set; }

[ApiMember(Description = "Negative prompt describing what should not be in the masked area", ParameterType = "body")]
[ApiMember(Description = "Negative prompt describing what should not be in the masked area")]
[Description("Negative prompt describing what should not be in the masked area")]
[Input(Type = "textarea")]
public string? NegativePrompt { get; set; }

[ApiMember(Description = "The image to use as input", ParameterType = "body")]
[ApiMember(Description = "The image to use as input")]
[Description("The image to use as input")]
[Required]
[Input(Type = "file")]
public Stream Image { get; set; }

[ApiMember(Description = "The mask to use as input", ParameterType = "body")]
[ApiMember(Description = "The mask to use as input")]
[Description("The mask to use as input")]
[Required]
[Input(Type = "file")]
public Stream Mask { get; set; }

[ApiMember(Description = "Optional specific amount of denoise to apply", ParameterType = "query")]
[ApiMember(Description = "Optional specific amount of denoise to apply")]
[Description("Optional specific amount of denoise to apply")]
[Range(0, 1)]
public float? Denoise { get; set; }

[ApiMember(Description = "Optional seed for reproducible results in image generation", ParameterType = "query")]
[ApiMember(Description = "Optional seed for reproducible results in image generation")]
[Description("Optional seed for reproducible results in image generation")]
[Range(0, int.MaxValue)]
public int? Seed { get; set; }

[ApiMember(Description = "Optional client-provided identifier for the request", ParameterType = "query")]
[ApiMember(Description = "Optional client-provided identifier for the request")]
[Description("Optional client-provided identifier for the request")]
public string? RefId { get; set; }

[ApiMember(Description = "Optional queue or topic to reply to", ParameterType = "query")]
[Description("Optional queue or topic to reply to")]
public string? ReplyTo { get; set; }

[ApiMember(Description = "Tag to identify the request", ParameterType = "query")]
[ApiMember(Description = "Tag to identify the request")]
[Description("Tag to identify the request")]
public string? Tag { get; set; }

[ApiMember(Description = "Optional state to associate with the request", ParameterType = "query")]
[Description("Optional state to associate with the request")]
[Input(Type = "hidden")]
public string? State { get; set; }
}

[ValidateApiKey]
Expand All @@ -285,28 +231,19 @@ public class ImageWithMask : IGeneration, IReturn<GenerationResponse>
[Description("Extract text content from an image")]
public class ImageToText : IGeneration, IReturn<GenerationResponse>
{
[ApiMember(Description = "The image to convert to text", ParameterType = "body")]
[ApiMember(Description = "The image to convert to text")]
[Description("The image to convert to text")]
[Required]
[Input(Type = "file")]
public Stream Image { get; set; }

[ApiMember(Description = "Optional client-provided identifier for the request", ParameterType = "query")]
[ApiMember(Description = "Optional client-provided identifier for the request")]
[Description("Optional client-provided identifier for the request")]
public string? RefId { get; set; }

[ApiMember(Description = "Optional queue or topic to reply to", ParameterType = "query")]
[Description("Optional queue or topic to reply to")]
public string? ReplyTo { get; set; }

[ApiMember(Description = "Tag to identify the request", ParameterType = "query")]
[ApiMember(Description = "Tag to identify the request")]
[Description("Tag to identify the request")]
public string? Tag { get; set; }

[ApiMember(Description = "Optional state to associate with the request", ParameterType = "query")]
[Description("Optional state to associate with the request")]
[Input(Type = "hidden")]
public string? State { get; set; }
}

[Description("Response object for generation requests")]
Expand All @@ -328,8 +265,5 @@ public class GenerationResponse
public interface IGeneration
{
string? RefId { get; set; }
string? ReplyTo { get; set; }
string? State { get; set; }

string? Tag { get; set; }
}
Loading

0 comments on commit 1bb0fa7

Please sign in to comment.