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
3 changes: 2 additions & 1 deletion .claude/skills/tryagi-openai/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dnx tryAGI.OpenAI.CLI <group> --help
| `completion` | 1 | Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position. |
| `conversation` | 8 | Manage conversations and conversation items. |
| `data-retention` | 4 | |
| `decision` | 1 | |
| `embedding` | 1 | Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms. |
| `eval` | 12 | Manage and run evals in the OpenAI platform. |
| `file` | 5 | Files are used to upload documents that can be used with features like Assistants and Fine-tuning. |
Expand All @@ -61,7 +62,7 @@ dnx tryAGI.OpenAI.CLI <group> --help
| `usage` | 11 | |
| `user` | 4 | |
| `user-organization-role-assignment` | 4 | |
| `vault` | 9 | |
| `vault` | 10 | |
| `vector-store` | 16 | |
| `default` | 42 | |

Expand Down
7 changes: 7 additions & 0 deletions .claude/skills/tryagi-openai/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ Manage conversations and conversation items.
| `update-organization-data-retention` | `POST /organization/data_retention` | Update organization data retention |
| `update-project-data-retention` | `POST /organization/projects/{project_id}/data_retention` | Update project data retention |

## `decision`

| Command | Route | Description |
|---------|-------|-------------|
| `create-decision` | `POST /decisions` | Create a decision |

## `embedding`

Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
Expand Down Expand Up @@ -498,6 +504,7 @@ Use Uploads to upload large files in multiple parts.
| `retrieve-vault` | `GET /vaults/{vault_id}` | Retrieve a vault |
| `retrieve-vault-credential` | `GET /vaults/{vault_id}/credentials/{credential_id}` | Retrieve a vault credential |
| `rotate-vault-credential` | `POST /vaults/{vault_id}/credentials/{credential_id}` | Update a vault credential |
| `update-vault` | `POST /vaults/{vault_id}` | Update a vault |

## `vector-store`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ internal static partial class AgentsCreateAgentCommandApiCommand
private static Option<global::System.Collections.Generic.IList<global::tryAGI.OpenAI.PersistedAgentToolConfigParam>?> Tools { get; } = new(
name: @"--tools")
{
Description = @"Tools available to the agent. Defaults to an empty list.",
Description = @"Tools available to the agent. Defaults to an empty list. The tool list must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON.",
};
private static readonly MultiAgentConfigCurrentParamOptionSet MultiAgentOptions = MultiAgentConfigCurrentParamOptionSet.Create(@"multi-agent");
private static Option<string?> Input { get; } = new(@"--input")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ internal static partial class AgentsUpdateAgentCommandApiCommand
private static Option<global::System.Collections.Generic.IList<global::tryAGI.OpenAI.PersistedAgentToolConfigParam>?> Tools { get; } = new(
name: @"--tools")
{
Description = @"Tools available to the agent.",
Description = @"Replaces the tool list. Omit to leave it unchanged, or pass null to clear it. The replacement must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON.",
};
private static readonly MultiAgentConfigCurrentParamOptionSet MultiAgentOptions = MultiAgentConfigCurrentParamOptionSet.Create(@"multi-agent");
private static Option<string?> Input { get; } = new(@"--input")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public static Command Create()
command.Subcommands.Add(CompletionsApiGroupCommand.Create());
command.Subcommands.Add(ConversationsApiGroupCommand.Create());
command.Subcommands.Add(DataRetentionApiGroupCommand.Create());
command.Subcommands.Add(DecisionsApiGroupCommand.Create());
command.Subcommands.Add(DefaultApiGroupCommand.Create());
command.Subcommands.Add(EmbeddingsApiGroupCommand.Create());
command.Subcommands.Add(EvalsApiGroupCommand.Create());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#nullable enable

using System.CommandLine;

namespace tryAGI.OpenAI.Cli.GeneratedApi.Commands;

internal static partial class DecisionsApiGroupCommand
{
static partial void CustomizeCommand(ref Command command);

public static Command Create()
{
var command = new Command(@"decisions", @"Decisions endpoint commands.");
command.Subcommands.Add(DecisionsCreateDecisionCommandApiCommand.Create());
CustomizeCommand(ref command);
return command;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
#nullable enable
#pragma warning disable CS0618

using System.CommandLine;

namespace tryAGI.OpenAI.Cli.GeneratedApi.Commands;

internal static partial class DecisionsCreateDecisionCommandApiCommand
{
private static Option<string> Model { get; } = new(
name: @"--model")
{
Description = @"",
Required = true,
};

private static Option<global::tryAGI.OpenAI.DecisionInput> InputOption { get; } = new(
name: @"--input")
{
Description = @"Shared evidence, as a string or an array of user messages containing text and inline images. Non-user roles, function calls, function-call outputs, files, audio, and item references are not supported. At most 128 image parts are allowed across all messages in one request.",
Required = true,
};

private static Option<global::System.Collections.Generic.IList<global::tryAGI.OpenAI.QuestionParam>> Questions { get; } = new(
name: @"--questions")
{
Description = @"",
Required = true,
};

private static Option<string?> SafetyIdentifier { get; } = new(
name: @"--safety-identifier")
{
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?> RequestInput { get; } = new(@"--request-input")
{
Description = "Load request JSON from a file path, '-' for stdin, or an inline JSON object/array string.",
};

private static Option<string?> RequestJson { get; } = new(@"--request-json")
{
Description = "Request body as JSON.",
Hidden = true,
};

private static Option<string?> RequestFile { get; } = new(@"--request-file")
{
Description = "Path to a JSON request file, or '-' for stdin.",
Hidden = true,
};

private static string FormatResponse(ParseResult parseResult, global::tryAGI.OpenAI.DecisionResponse value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
{
string? text = null;
CustomizeResponseText(parseResult, value, ref text);
if (!string.IsNullOrWhiteSpace(text))
{
return text;
}

var hints = new Dictionary<string, CliFormatHint>(StringComparer.OrdinalIgnoreCase)
{
};
CustomizeResponseFormatHints(hints);
return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints);
}

static partial void CustomizeResponseText(ParseResult parseResult, global::tryAGI.OpenAI.DecisionResponse value, ref string? text);
static partial void CustomizeResponseFormatHints(Dictionary<string, CliFormatHint> hints);


static partial void CustomizeCommand(ref Command command);

public static Command Create(string? commandName = null)
{
var command = new Command(commandName ?? @"create-decision", @"Create a decision
Evaluate ordered classification and scoring questions against shared input. Answers are returned in question order.

Supply input as a string or user messages containing text and inline images. Only user messages with `input_text` and `input_image` parts are supported; non-user roles, function calls, files, audio, and item references are not supported. Images require a data URL, not an external URL or file ID. At most 128 images are allowed across the request.

Each question can return a refusal instead of a scored answer. A refusal has type `refusal` and the corresponding question name, or null if unnamed.");
command.Options.Add(Model);
command.Options.Add(InputOption);
command.Options.Add(Questions);
command.Options.Add(SafetyIdentifier);
command.Options.Add(RequestInput);
command.Options.Add(RequestJson);
command.Options.Add(RequestFile);
command.Validators.Add(result =>
{
var hasInput = result.GetResult(RequestInput) is not null;
var hasRequestJson = result.GetResult(RequestJson) is not null;
var hasRequestFile = result.GetResult(RequestFile) is not null;
var specifiedCount = (hasInput ? 1 : 0) + (hasRequestJson ? 1 : 0) + (hasRequestFile ? 1 : 0);
if (specifiedCount > 1)
{
result.AddError(@"Specify at most one of --request-input, --request-json, or --request-file.");
}
});

command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) =>
await CliRuntime.RunAsync(async () =>
{
var __requestBase = await CliRuntime.ReadRequestOrDefaultAsync<global::tryAGI.OpenAI.DecisionRequest>(
parseResult,
RequestInput,
RequestJson,
RequestFile,
global::tryAGI.OpenAI.SourceGenerationContext.Default,
cancellationToken).ConfigureAwait(false);
var model = parseResult.GetRequiredValue(Model);
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);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = await client.Decisions.CreateDecisionAsync(
model: model,
input: input,
questions: questions,
safetyIdentifier: safetyIdentifier,
cancellationToken: cancellationToken).ConfigureAwait(false);


if (!await CliRuntime.TryWriteOutputDirectoryAsync(
parseResult,
response,
global::tryAGI.OpenAI.SourceGenerationContext.Default,
@"Answers",
cancellationToken).ConfigureAwait(false))
{
await CliRuntime.WriteResponseAsync(
parseResult,
response,
global::tryAGI.OpenAI.SourceGenerationContext.Default,
FormatResponse,
cancellationToken).ConfigureAwait(false);
}
}, cancellationToken).ConfigureAwait(false));
CustomizeCommand(ref command);
return command;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public static Command Create()
command.Subcommands.Add(VaultsRetrieveVaultCommandApiCommand.Create());
command.Subcommands.Add(VaultsRetrieveVaultCredentialCommandApiCommand.Create());
command.Subcommands.Add(VaultsRotateVaultCredentialCommandApiCommand.Create());
command.Subcommands.Add(VaultsUpdateVaultCommandApiCommand.Create());
CustomizeCommand(ref command);
return command;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ internal static partial class VaultsListVaultCredentialsCommandApiCommand
Description = @"The ID of the vault.",
};

private static Option<global::System.Collections.Generic.Dictionary<string, string>?> Metadata { get; } = new(
name: @"--metadata")
{
Description = @"Exact string matches supplied as `metadata[key]=value`. All supplied pairs must match. Up to 16 pairs, with keys from 1 to 64 characters and values up to 512 characters. Filtering is eventually consistent; metadata changes may take time to appear.",
};

private static Option<global::tryAGI.OpenAI.ListOrderParam?> Order { get; } = new(
name: @"--order")
{
Expand Down Expand Up @@ -64,6 +70,7 @@ public static Command Create(string? commandName = null)
var command = new Command(commandName ?? @"list-vault-credentials", @"List vault credentials
Lists a vault's credentials using ID-based pagination without returning secret values. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).");
command.Arguments.Add(VaultId);
command.Options.Add(Metadata);
command.Options.Add(Order);
command.Options.Add(Limit);
command.Options.Add(Status);
Expand All @@ -74,6 +81,7 @@ public static Command Create(string? commandName = null)
await CliRuntime.RunAsync(async () =>
{
var vaultId = parseResult.GetRequiredValue(VaultId);
var metadata = parseResult.GetValue(Metadata);
var order = parseResult.GetValue(Order);
var limit = parseResult.GetValue(Limit);
var status = parseResult.GetValue(Status);
Expand All @@ -83,6 +91,7 @@ await CliRuntime.RunAsync(async () =>

var response = await client.Vaults.ListVaultCredentialsAsync(
vaultId: vaultId,
metadata: metadata,
order: order,
limit: limit,
status: status,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ namespace tryAGI.OpenAI.Cli.GeneratedApi.Commands;

internal static partial class VaultsListVaultsCommandApiCommand
{
private static Option<global::System.Collections.Generic.Dictionary<string, string>?> Metadata { get; } = new(
name: @"--metadata")
{
Description = @"Exact string matches supplied as `metadata[key]=value`. All supplied pairs must match. Up to 16 pairs, with keys from 1 to 64 characters and values up to 512 characters. Filtering is eventually consistent; metadata changes may take time to appear.",
};

private static Option<global::tryAGI.OpenAI.ListOrderParam?> Order { get; } = new(
name: @"--order")
{
Expand Down Expand Up @@ -57,6 +63,7 @@ public static Command Create(string? commandName = null)
{
var command = new Command(commandName ?? @"list-vaults", @"List vaults
Lists vaults using ID-based pagination. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).");
command.Options.Add(Metadata);
command.Options.Add(Order);
command.Options.Add(Limit);
command.Options.Add(Status);
Expand All @@ -66,6 +73,7 @@ public static Command Create(string? commandName = null)
command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) =>
await CliRuntime.RunAsync(async () =>
{
var metadata = parseResult.GetValue(Metadata);
var order = parseResult.GetValue(Order);
var limit = parseResult.GetValue(Limit);
var status = parseResult.GetValue(Status);
Expand All @@ -74,6 +82,7 @@ await CliRuntime.RunAsync(async () =>


var response = await client.Vaults.ListVaultsAsync(
metadata: metadata,
order: order,
limit: limit,
status: status,
Expand Down
Loading
Loading