Interface IGenerativeRequest
Defines the common contract for all Unified API generative requests.
Namespace: Glitch9.AIDevKit
Assembly: Glitch9.AIDevKit.dll
Syntax
public interface IGenerativeRequest
Properties
| Edit this page View SourceApi
Gets the provider API for this request. Usually resolved from Model when not explicitly assigned.
Declaration
Api Api { get; }
Property Value
| Type | Description |
|---|---|
| Api |
ContentType
Gets the request content MIME type.
Declaration
MimeType ContentType { get; }
Property Value
| Type | Description |
|---|---|
| MimeType |
DownloadOptions
Gets download/save options for generated outputs.
Declaration
DownloadOptions DownloadOptions { get; }
Property Value
| Type | Description |
|---|---|
| DownloadOptions |
EndpointType
Gets the legacy endpoint category.
Declaration
[Obsolete("EndpointType is deprecated. Use RequestType instead.")]
RequestType EndpointType { get; }
Property Value
| Type | Description |
|---|---|
| RequestType |
LogOptions
Gets logging behavior for the HTTP layer.
Declaration
CurlLogOptions LogOptions { get; }
Property Value
| Type | Description |
|---|---|
| CurlLogOptions |
MeasureLatency
Gets whether latency should be measured for this request.
Declaration
bool MeasureLatency { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Model
Gets or sets the model identifier. It can be a provider model ID or deployment name.
Declaration
string Model { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
N
Gets the number of outputs to generate.
Declaration
NCount N { get; }
Property Value
| Type | Description |
|---|---|
| NCount |
OnLatencyMeasured
Gets callback invoked with measured latency (seconds).
Declaration
Action<double> OnLatencyMeasured { get; }
Property Value
| Type | Description |
|---|---|
| Action<double> |
RecordOptions
Gets generation-record behavior and callbacks.
Declaration
GenerationRecordOptions RecordOptions { get; }
Property Value
| Type | Description |
|---|---|
| GenerationRecordOptions |
RecordedContext
Gets recorded curl/request context for diagnostics.
Declaration
CurlContext RecordedContext { get; }
Property Value
| Type | Description |
|---|---|
| CurlContext |
RequestType
Gets the request endpoint category.
Declaration
RequestType RequestType { get; }
Property Value
| Type | Description |
|---|---|
| RequestType |
RequestedAt
Gets the request timestamp captured when dispatch starts.
Declaration
DateTime RequestedAt { get; }
Property Value
| Type | Description |
|---|---|
| DateTime |
ResponseType
Gets the expected response MIME type.
Declaration
MimeType ResponseType { get; }
Property Value
| Type | Description |
|---|---|
| MimeType |
SafetyIdentifier
Gets the safety identifier for provider-side policy routing.
Declaration
SafetyIdentifier SafetyIdentifier { get; }
Property Value
| Type | Description |
|---|---|
| SafetyIdentifier |
Sender
Gets or sets the logical sender for routing/history context.
Declaration
string Sender { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ServiceTier
Gets the provider service tier, when supported.
Declaration
ServiceTier? ServiceTier { get; }
Property Value
| Type | Description |
|---|---|
| ServiceTier? |
Stream
Gets or sets whether this request should run in streaming mode.
Declaration
bool Stream { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
| Edit this page View SourceCancel()
Cancels this request if it is running.
Declaration
void Cancel()
ExecuteAsyncT<T>(CancellationToken)
Executes the request and casts the generated asset to T.
Declaration
UniTask<Generated<T>> ExecuteAsyncT<T>(CancellationToken ct = default) where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| UniTask<Generated<T>> |
Type Parameters
| Name | Description |
|---|---|
| T | Target generated asset type. |
GetPrompt()
Gets the prompt payload used to build this request.
Declaration
IPrompt GetPrompt()
Returns
| Type | Description |
|---|---|
| IPrompt |
GetPromptStringToRecord()
Gets a prompt string suitable for history/recording.
Declaration
string GetPromptStringToRecord()
Returns
| Type | Description |
|---|---|
| string |
ProcessPostRequestTasks(IResult)
Processes post-request tasks for raw results.
Declaration
void ProcessPostRequestTasks(IResult result)
Parameters
| Type | Name | Description |
|---|---|---|
| IResult | result | Request result. |
ProcessPostRequestTasks<T>(Generated<T>)
Processes post-request tasks for generated outputs.
Declaration
void ProcessPostRequestTasks<T>(Generated<T> output) where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| Generated<T> | output | Generated output. |
Type Parameters
| Name | Description |
|---|---|
| T | Generated asset type. |
SetPlaygroundSettings(string, string, string, bool, Action<double>, Action<GenerationRecord>)
Applies editor playground settings used for generation history and diagnostics.
Declaration
void SetPlaygroundSettings(string sender, string fileName, string selectedPath, bool measureLatency, Action<double> onLatencyMeasured, Action<GenerationRecord> onRecordCreated)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sender | Playground sender identifier. |
| string | fileName | Requested output file name. |
| string | selectedPath | Selected output directory path. |
| bool | measureLatency | Whether to force latency measurement. |
| Action<double> | onLatencyMeasured | Latency callback. |
| Action<GenerationRecord> | onRecordCreated | Record-created callback. |
ShouldMeasureLatency()
Returns true when latency should be measured.
Declaration
bool ShouldMeasureLatency()
Returns
| Type | Description |
|---|---|
| bool | true if latency measurement is enabled. |
ShouldWriteRecord()
Returns true when a generation record should be written.
Declaration
bool ShouldWriteRecord()
Returns
| Type | Description |
|---|---|
| bool | true if prompt history should be saved. |