Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal static partial class DecisionsCreateDecisionCommandApiCommand
private static Option<global::tryAGI.OpenAI.DecisionInput> InputOption { get; } = new(
name: @"--input")
{
Description = @"The text or images to evaluate for every question. Provide a text string or user messages containing text and images. Images can be base64 data URLs or publicly accessible HTTP(S) URLs; at most 128 images are allowed across all messages in one request. Files, audio, tools, and item references are not supported.",
Description = @"The input to evaluate for every question. Provide a text string or an ordered array of messages, function calls and outputs, or custom tool calls and outputs. Each tool output must identify a matching call by call ID. User messages and tool outputs can contain text and images; developer and system messages can contain only input text, and assistant messages can contain output text or refusals. Images can be base64 data URLs or publicly accessible HTTP(S) URLs; at most 128 images are allowed per request. Files, audio, and item references are not supported.",
Required = true,
};

Expand All @@ -33,6 +33,18 @@ internal static partial class DecisionsCreateDecisionCommandApiCommand
{
Description = @"Opaque caller-provided end-user identifier, scoped by the verified org. Match Responses' limit; this is never the authenticated user identity.",
};

private static Option<string?> PromptCacheKey { get; } = new(
name: @"--prompt-cache-key")
{
Description = @"Partition prompt cache reuse by caller-provided key.",
};

private static Option<global::tryAGI.OpenAI.DecisionRequestPromptCacheOptions?> PromptCacheOptions { get; } = new(
name: @"--prompt-cache-options")
{
Description = @"Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details.",
};
private static Option<string?> RequestInput { get; } = new(@"--request-input")
{
Description = "Load request JSON from a file path, '-' for stdin, or an inline JSON object/array string.",
Expand Down Expand Up @@ -80,6 +92,8 @@ public static Command Create(string? commandName = null)
command.Options.Add(InputOption);
command.Options.Add(Questions);
command.Options.Add(SafetyIdentifier);
command.Options.Add(PromptCacheKey);
command.Options.Add(PromptCacheOptions);
command.Options.Add(RequestInput);
command.Options.Add(RequestJson);
command.Options.Add(RequestFile);
Expand Down Expand Up @@ -109,6 +123,8 @@ await CliRuntime.RunAsync(async () =>
var input = parseResult.GetRequiredValue(InputOption);
var questions = parseResult.GetRequiredValue(Questions);
var safetyIdentifier = CliRuntime.WasSpecified(parseResult, SafetyIdentifier) ? parseResult.GetValue(SafetyIdentifier) : (__requestBase is { } __SafetyIdentifierBaseValue ? __SafetyIdentifierBaseValue.SafetyIdentifier : default);
var promptCacheKey = CliRuntime.WasSpecified(parseResult, PromptCacheKey) ? parseResult.GetValue(PromptCacheKey) : (__requestBase is { } __PromptCacheKeyBaseValue ? __PromptCacheKeyBaseValue.PromptCacheKey : default);
var promptCacheOptions = CliRuntime.WasSpecified(parseResult, PromptCacheOptions) ? parseResult.GetValue(PromptCacheOptions) : (__requestBase is { } __PromptCacheOptionsBaseValue ? __PromptCacheOptionsBaseValue.PromptCacheOptions : default);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


Expand All @@ -117,6 +133,8 @@ await CliRuntime.RunAsync(async () =>
input: input,
questions: questions,
safetyIdentifier: safetyIdentifier,
promptCacheKey: promptCacheKey,
promptCacheOptions: promptCacheOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,14 +441,20 @@ partial void ProcessCreateDecisionResponseContent(
/// The model to use. Only `gpt-6-luna` is supported.
/// </param>
/// <param name="input">
/// The text or images to evaluate for every question. Provide a text string or user messages containing text and images. Images can be base64 data URLs or publicly accessible HTTP(S) URLs; at most 128 images are allowed across all messages in one request. Files, audio, tools, and item references are not supported.
/// The input to evaluate for every question. Provide a text string or an ordered array of messages, function calls and outputs, or custom tool calls and outputs. Each tool output must identify a matching call by call ID. User messages and tool outputs can contain text and images; developer and system messages can contain only input text, and assistant messages can contain output text or refusals. Images can be base64 data URLs or publicly accessible HTTP(S) URLs; at most 128 images are allowed per request. Files, audio, and item references are not supported.
/// </param>
/// <param name="questions">
/// Ask 1–200 questions about the input. Each question can be a predicate, choice, or score. Answers come back in the same order.
/// </param>
/// <param name="safetyIdentifier">
/// Opaque caller-provided end-user identifier, scoped by the verified org. Match Responses' limit; this is never the authenticated user identity.
/// </param>
/// <param name="promptCacheKey">
/// Partition prompt cache reuse by caller-provided key.
/// </param>
/// <param name="promptCacheOptions">
/// Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details.
/// </param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
Expand All @@ -457,6 +463,8 @@ partial void ProcessCreateDecisionResponseContent(
global::tryAGI.OpenAI.DecisionInput input,
global::System.Collections.Generic.IList<global::tryAGI.OpenAI.QuestionParam> questions,
string? safetyIdentifier = default,
string? promptCacheKey = default,
global::tryAGI.OpenAI.DecisionRequestPromptCacheOptions? promptCacheOptions = default,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
Expand All @@ -466,6 +474,8 @@ partial void ProcessCreateDecisionResponseContent(
Input = input,
Questions = questions,
SafetyIdentifier = safetyIdentifier,
PromptCacheKey = promptCacheKey,
PromptCacheOptions = promptCacheOptions,
};

return await CreateDecisionAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,20 @@ public partial interface IDecisionsClient
/// The model to use. Only `gpt-6-luna` is supported.
/// </param>
/// <param name="input">
/// The text or images to evaluate for every question. Provide a text string or user messages containing text and images. Images can be base64 data URLs or publicly accessible HTTP(S) URLs; at most 128 images are allowed across all messages in one request. Files, audio, tools, and item references are not supported.
/// The input to evaluate for every question. Provide a text string or an ordered array of messages, function calls and outputs, or custom tool calls and outputs. Each tool output must identify a matching call by call ID. User messages and tool outputs can contain text and images; developer and system messages can contain only input text, and assistant messages can contain output text or refusals. Images can be base64 data URLs or publicly accessible HTTP(S) URLs; at most 128 images are allowed per request. Files, audio, and item references are not supported.
/// </param>
/// <param name="questions">
/// Ask 1–200 questions about the input. Each question can be a predicate, choice, or score. Answers come back in the same order.
/// </param>
/// <param name="safetyIdentifier">
/// Opaque caller-provided end-user identifier, scoped by the verified org. Match Responses' limit; this is never the authenticated user identity.
/// </param>
/// <param name="promptCacheKey">
/// Partition prompt cache reuse by caller-provided key.
/// </param>
/// <param name="promptCacheOptions">
/// Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details.
/// </param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
Expand All @@ -54,6 +60,8 @@ public partial interface IDecisionsClient
global::tryAGI.OpenAI.DecisionInput input,
global::System.Collections.Generic.IList<global::tryAGI.OpenAI.QuestionParam> questions,
string? safetyIdentifier = default,
string? promptCacheKey = default,
global::tryAGI.OpenAI.DecisionRequestPromptCacheOptions? promptCacheOptions = default,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,30 @@ public class DecisionInputContentPartsItemJsonConverter : global::System.Text.Js
throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::tryAGI.OpenAI.DecisionInputImage)}");
inputImage = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
}
global::tryAGI.OpenAI.DecisionInputOutputText? outputText = default;
if (discriminator?.Type == global::tryAGI.OpenAI.DecisionInputContentPartDiscriminatorType.OutputText)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::tryAGI.OpenAI.DecisionInputOutputText), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::tryAGI.OpenAI.DecisionInputOutputText> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::tryAGI.OpenAI.DecisionInputOutputText)}");
outputText = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
}
global::tryAGI.OpenAI.DecisionInputRefusal? refusal = default;
if (discriminator?.Type == global::tryAGI.OpenAI.DecisionInputContentPartDiscriminatorType.Refusal)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::tryAGI.OpenAI.DecisionInputRefusal), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::tryAGI.OpenAI.DecisionInputRefusal> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::tryAGI.OpenAI.DecisionInputRefusal)}");
refusal = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
}

var __value = new global::tryAGI.OpenAI.DecisionInputContentPartsItem(
discriminator?.Type,
inputText,

inputImage
inputImage,

outputText,

refusal
);

return __value;
Expand All @@ -67,6 +85,18 @@ public override void Write(
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::tryAGI.OpenAI.DecisionInputImage).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickInputImage(), typeInfo);
}
else if (value.IsOutputText)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::tryAGI.OpenAI.DecisionInputOutputText), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::tryAGI.OpenAI.DecisionInputOutputText?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::tryAGI.OpenAI.DecisionInputOutputText).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickOutputText(), typeInfo);
}
else if (value.IsRefusal)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::tryAGI.OpenAI.DecisionInputRefusal), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::tryAGI.OpenAI.DecisionInputRefusal?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::tryAGI.OpenAI.DecisionInputRefusal).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickRefusal(), typeInfo);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#nullable enable

namespace tryAGI.OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class DecisionInputCustomToolCallOutputTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::tryAGI.OpenAI.DecisionInputCustomToolCallOutputType>
{
/// <inheritdoc />
public override global::tryAGI.OpenAI.DecisionInputCustomToolCallOutputType Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::tryAGI.OpenAI.DecisionInputCustomToolCallOutputTypeExtensions.ToEnum(stringValue) ?? default;
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::tryAGI.OpenAI.DecisionInputCustomToolCallOutputType)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::tryAGI.OpenAI.DecisionInputCustomToolCallOutputType);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::tryAGI.OpenAI.DecisionInputCustomToolCallOutputType value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

writer.WriteStringValue(global::tryAGI.OpenAI.DecisionInputCustomToolCallOutputTypeExtensions.ToValueString(value));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#nullable enable

namespace tryAGI.OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class DecisionInputCustomToolCallOutputTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::tryAGI.OpenAI.DecisionInputCustomToolCallOutputType?>
{
/// <inheritdoc />
public override global::tryAGI.OpenAI.DecisionInputCustomToolCallOutputType? Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::tryAGI.OpenAI.DecisionInputCustomToolCallOutputTypeExtensions.ToEnum(stringValue);
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::tryAGI.OpenAI.DecisionInputCustomToolCallOutputType)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::tryAGI.OpenAI.DecisionInputCustomToolCallOutputType?);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::tryAGI.OpenAI.DecisionInputCustomToolCallOutputType? value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

if (value == null)
{
writer.WriteNullValue();
}
else
{
writer.WriteStringValue(global::tryAGI.OpenAI.DecisionInputCustomToolCallOutputTypeExtensions.ToValueString(value.Value));
}
}
}
}
Loading
Loading