1+ #nullable enable
2+
3+ using System . Collections . Generic ;
4+ using System . IO ;
5+ using ServiceStack ;
6+ using ServiceStack . DataAnnotations ;
7+
8+ namespace Test . ServiceModel ;
9+
10+ public interface IGeneration
11+ {
12+ string ? RefId { get ; set ; }
13+ string ? Tag { get ; set ; }
14+ }
15+
16+ [ Description ( "Output object for generated artifacts" ) ]
17+ public class ArtifactOutput
18+ {
19+ [ ApiMember ( Description = "URL to access the generated image" ) ]
20+ [ Description ( "URL to access the generated image" ) ]
21+ public string ? Url { get ; set ; }
22+
23+ [ ApiMember ( Description = "Filename of the generated image" ) ]
24+ [ Description ( "Filename of the generated image" ) ]
25+ public string ? FileName { get ; set ; }
26+
27+ [ ApiMember ( Description = "Provider used for image generation" ) ]
28+ [ Description ( "Provider used for image generation" ) ]
29+ public string ? Provider { get ; set ; }
30+ }
31+
32+ [ Description ( "Output object for generated text" ) ]
33+ public class TextOutput
34+ {
35+ [ ApiMember ( Description = "The generated text" ) ]
36+ [ Description ( "The generated text" ) ]
37+ public string ? Text { get ; set ; }
38+ }
39+
40+ [ Description ( "Response object for generation requests" ) ]
41+ public class GenerationResponse
42+ {
43+ [ ApiMember ( Description = "List of generated outputs" ) ]
44+ [ Description ( "List of generated outputs" ) ]
45+ public List < ArtifactOutput > ? Outputs { get ; set ; }
46+
47+ [ ApiMember ( Description = "List of generated text outputs" ) ]
48+ [ Description ( "List of generated text outputs" ) ]
49+ public List < TextOutput > ? TextOutputs { get ; set ; }
50+
51+ [ ApiMember ( Description = "Detailed response status information" ) ]
52+ [ Description ( "Detailed response status information" ) ]
53+ public ResponseStatus ? ResponseStatus { get ; set ; }
54+ }
55+
56+ [ ValidateApiKey ]
57+ [ Tag ( "AI" ) ]
58+ [ Api ( "Convert speech to text" ) ]
59+ [ Description ( "Transcribe audio content to text" ) ]
60+ [ SystemJson ( UseSystemJson . Response ) ]
61+ public class SpeechToText : IGeneration , IReturn < GenerationResponse >
62+ {
63+ [ ApiMember ( Description = "The audio stream containing the speech to be transcribed" ) ]
64+ [ Description ( "The audio stream containing the speech to be transcribed" ) ]
65+ [ Required ]
66+ [ Input ( Type = "file" ) ]
67+ public Stream Audio { get ; set ; }
68+
69+ [ ApiMember ( Description = "Optional client-provided identifier for the request" ) ]
70+ [ Description ( "Optional client-provided identifier for the request" ) ]
71+ public string ? RefId { get ; set ; }
72+
73+ [ ApiMember ( Description = "Tag to identify the request" ) ]
74+ [ Description ( "Tag to identify the request" ) ]
75+ public string ? Tag { get ; set ; }
76+ }
77+
78+ public class UploadInfo
79+ {
80+ public string Name { get ; set ; }
81+ public string FileName { get ; set ; }
82+ public long ContentLength { get ; set ; }
83+ public string ContentType { get ; set ; }
84+ }
85+
86+ public class TestFileUploads : IReturn < TestFileUploadsResponse >
87+ {
88+ public int ? Id { get ; set ; }
89+ public string ? RefId { get ; set ; }
90+ }
91+
92+ public class TestFileUploadsResponse
93+ {
94+ public int ? Id { get ; set ; }
95+ public string ? RefId { get ; set ; }
96+ public List < UploadInfo > Files { get ; set ; } = [ ] ;
97+ public ResponseStatus ? ResponseStatus { get ; set ; }
98+ }
0 commit comments