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 @@ -13,28 +13,28 @@ internal static partial class AgentsListAgentSessionArtifactsCommandApiCommand
Description = @"The ID of the session.",
};

private static Option<global::tryAGI.OpenAI.ListOrderParam?> Order { get; } = new(
name: @"--order")
private static Option<long?> Limit { get; } = new(
name: @"--limit")
{
Description = @"Sort by creation time and ID. Defaults to descending.",
Description = @"The maximum number of resources to return, between 1 and 100. Defaults to 20.",
};

private static Option<string?> EnvironmentId { get; } = new(
name: @"--environment-id")
private static Option<global::tryAGI.OpenAI.ListOrderParam?> Order { get; } = new(
name: @"--order")
{
Description = @"Restrict the listing to artifacts produced by this environment.",
Description = @"The order in which resources are returned. Defaults to `desc`.",
};

private static Option<long?> Limit { get; } = new(
name: @"--limit")
private static Option<string?> After { get; } = new(
name: @"--after")
{
Description = @"The maximum number of artifacts to return, between 1 and 100.",
Description = @"Return resources after this resource ID in the selected order.",
};

private static Option<string?> After { get; } = new(
name: @"--after")
private static Option<string?> EnvironmentId { get; } = new(
name: @"--environment-id")
{
Description = @"Return artifacts after this immutable artifact ID.",
Description = @"Restrict the listing to artifacts produced by this environment.",
};

private static string FormatResponse(ParseResult parseResult, global::tryAGI.OpenAI.SessionArtifactListResource value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
Expand Down Expand Up @@ -64,29 +64,29 @@ public static Command Create(string? commandName = null)
var command = new Command(commandName ?? @"list-agent-session-artifacts", @"List agent session artifacts
Lists immutable artifacts published by completed hosted session turns. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).");
command.Arguments.Add(SessionId);
command.Options.Add(Order);
command.Options.Add(EnvironmentId);
command.Options.Add(Limit);
command.Options.Add(Order);
command.Options.Add(After);
command.Options.Add(EnvironmentId);


command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) =>
await CliRuntime.RunAsync(async () =>
{
var sessionId = parseResult.GetRequiredValue(SessionId);
var order = parseResult.GetValue(Order);
var environmentId = parseResult.GetValue(EnvironmentId);
var limit = parseResult.GetValue(Limit);
var order = parseResult.GetValue(Order);
var after = parseResult.GetValue(After);
var environmentId = parseResult.GetValue(EnvironmentId);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = await client.Agents.ListAgentSessionArtifactsAsync(
sessionId: sessionId,
order: order,
environmentId: environmentId,
limit: limit,
order: order,
after: after,
environmentId: environmentId,
cancellationToken: cancellationToken).ConfigureAwait(false);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,13 @@ internal static partial class AgentsListAgentSessionsCommandApiCommand
private static Option<long?> Limit { get; } = new(
name: @"--limit")
{
Description = @"The maximum number of resources to return.",
Description = @"The maximum number of resources to return, between 1 and 100. Defaults to 20.",
};

private static Option<global::tryAGI.OpenAI.ListOrderParam?> Order { get; } = new(
name: @"--order")
{
Description = @"Sort order by the `created_at` timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `desc`.",
};

private static Option<string?> AgentId { get; } = new(
name: @"--agent-id")
{
Description = @"Only return sessions whose root agent has this ID. Omit to return sessions for all agents.",
Description = @"The order in which resources are returned. Defaults to `desc`.",
};

private static Option<string?> After { get; } = new(
Expand All @@ -31,6 +25,12 @@ internal static partial class AgentsListAgentSessionsCommandApiCommand
Description = @"Return resources after this resource ID in the selected order.",
};

private static Option<string?> AgentId { get; } = new(
name: @"--agent-id")
{
Description = @"Only return sessions whose root agent has this ID. Omit to return sessions for all agents.",
};

private static string FormatResponse(ParseResult parseResult, global::tryAGI.OpenAI.SessionListResource value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
{
string? text = null;
Expand Down Expand Up @@ -59,25 +59,25 @@ public static Command Create(string? commandName = null)
Lists managed agent sessions using ID-based pagination and the requested sort order. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage).");
command.Options.Add(Limit);
command.Options.Add(Order);
command.Options.Add(AgentId);
command.Options.Add(After);
command.Options.Add(AgentId);


command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) =>
await CliRuntime.RunAsync(async () =>
{
var limit = parseResult.GetValue(Limit);
var order = parseResult.GetValue(Order);
var agentId = parseResult.GetValue(AgentId);
var after = parseResult.GetValue(After);
var agentId = parseResult.GetValue(AgentId);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = await client.Agents.ListAgentSessionsAsync(
limit: limit,
order: order,
agentId: agentId,
after: after,
agentId: agentId,
cancellationToken: cancellationToken).ConfigureAwait(false);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ internal static partial class AgentsListAgentsCommandApiCommand
private static Option<long?> Limit { get; } = new(
name: @"--limit")
{
Description = @"The maximum number of resources to return.",
Description = @"The maximum number of resources to return, between 1 and 100. Defaults to 20.",
};

private static Option<global::tryAGI.OpenAI.ListOrderParam?> Order { get; } = new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal static partial class AudioCreateSpeechAsEventStreamCommandApiCommand
private static Option<global::tryAGI.OpenAI.AnyOf<global::tryAGI.OpenAI.AnyOf<global::tryAGI.OpenAI.VoiceIdsShared?, global::tryAGI.OpenAI.CreateSpeechRequestVoice?>?, global::tryAGI.OpenAI.CreateSpeechRequestVoice2>> Voice { get; } = new(
name: @"--voice")
{
Description = @"The voice to use when generating the audio. Supported built-in voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice object with an `id`, for example `{ ""id"": ""voice_1234"" }`. Previews of the voices are available in the [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options). Custom voices must be created from audio samples. Voices created from text prompts are supported only in Live.",
Description = @"The voice to use when generating the audio. Supported built-in voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice object with an `id`, for example `{ ""id"": ""voice_1234"" }`. Previews of the voices are available in the [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options). Custom voices must be created from audio samples.",
Required = true,
};
private static readonly CreateSpeechRequestOptionSet CreateSpeechRequestOptionSetOptions = CreateSpeechRequestOptionSet.Create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal static partial class AudioCreateSpeechCommandApiCommand
private static Option<global::tryAGI.OpenAI.AnyOf<global::tryAGI.OpenAI.AnyOf<global::tryAGI.OpenAI.VoiceIdsShared?, global::tryAGI.OpenAI.CreateSpeechRequestVoice?>?, global::tryAGI.OpenAI.CreateSpeechRequestVoice2>> Voice { get; } = new(
name: @"--voice")
{
Description = @"The voice to use when generating the audio. Supported built-in voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice object with an `id`, for example `{ ""id"": ""voice_1234"" }`. Previews of the voices are available in the [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options). Custom voices must be created from audio samples. Voices created from text prompts are supported only in Live.",
Description = @"The voice to use when generating the audio. Supported built-in voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice object with an `id`, for example `{ ""id"": ""voice_1234"" }`. Previews of the voices are available in the [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options). Custom voices must be created from audio samples.",
Required = true,
};
private static readonly CreateSpeechRequestOptionSet CreateSpeechRequestOptionSetOptions = CreateSpeechRequestOptionSet.Create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,7 @@ namespace tryAGI.OpenAI.Cli.GeneratedApi.Commands;

internal static partial class AudioCreateVoiceCommandApiCommand
{
private static Argument<string> NameOption { get; } = new(
name: @"name")
{
Description = @"The name of the new voice.",
};

private static Option<global::tryAGI.OpenAI.CreateVoicePromptRequestType> Type { get; } = new(
name: @"--type")
{
Description = @"Set to `prompt` to create a voice from a text description.",
};

private static Option<string> Prompt { get; } = new(
name: @"--prompt")
{
Description = @"A description of the desired voice. Must not contain only whitespace.",
Required = true,
};

private static Option<string?> ScriptHint { get; } = new(
name: @"--script-hint")
{
Description = @"Optional text for the voice to speak during creation. If omitted, a script is generated from the prompt. Must not be blank after trimming whitespace; scripts that are too short are rejected.",
};

private static Option<global::tryAGI.OpenAI.AnyOf<string, global::tryAGI.OpenAI.CreateVoicePromptRequestModel?>?> Model { get; } = new(
name: @"--model")
{
Description = @"The voice creation model to use. Defaults to `auto`.",
};
private static Option<string?> Input { get; } = new(@"--input")
{
Description = "Load request JSON from a file path, '-' for stdin, or an inline JSON object/array string.",
Expand Down Expand Up @@ -79,17 +50,13 @@ private static string FormatResponse(ParseResult parseResult, global::tryAGI.Ope
public static Command Create(string? commandName = null)
{
var command = new Command(commandName ?? @"create-voice", @"Create voice
Creates a voice from a text prompt or from a consent recording and an audio sample.
Create a custom voice you can use for audio output (for example, in Text-to-Speech and the Realtime API). This requires an audio sample and a previously uploaded consent recording.

For prompt-based creation, send `type: ""prompt""` with a `name` and `prompt` as JSON or multipart form data. For creation from an audio sample, send `type: ""audio_sample""` with a `name`, `audio_sample`, and `consent` recording ID as multipart form data. The type defaults to `audio_sample` when omitted.
Send `name`, `audio_sample`, and the `consent` recording ID as multipart form data. The optional `type` defaults to `audio_sample`.

Returns the saved voice's metadata. Voices created from text prompts are supported only in Live, not in Realtime or the speech endpoint. The response does not include preview audio.
Returns the saved voice's metadata. See the [custom voices guide](https://developers.openai.com/api/docs/guides/text-to-speech#custom-voices) for requirements and best practices. Custom voices are limited to eligible customers.
");
command.Arguments.Add(NameOption);
command.Options.Add(Type);
command.Options.Add(Prompt);
command.Options.Add(ScriptHint);
command.Options.Add(Model);

command.Options.Add(Input);
command.Options.Add(RequestJson);
command.Options.Add(RequestFile);
Expand All @@ -99,36 +66,29 @@ Creates a voice from a text prompt or from a consent recording and an audio samp
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)
if (specifiedCount != 1)
{
result.AddError(@"Specify at most one of --input, --request-json, or --request-file.");
result.AddError(@"Specify exactly one of --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.CreateVoicePromptRequest>(

var request = await CliRuntime.ReadRequestAsync<global::tryAGI.OpenAI.CreateVoiceRequest>(
parseResult,
Input,
RequestJson,
RequestFile,
global::tryAGI.OpenAI.SourceGenerationContext.Default,
cancellationToken).ConfigureAwait(false);
var name = parseResult.GetRequiredValue(NameOption);
var type = CliRuntime.WasSpecified(parseResult, Type) ? parseResult.GetValue(Type) : (__requestBase is { } __TypeBaseValue ? __TypeBaseValue.Type : default);
var prompt = parseResult.GetRequiredValue(Prompt);
var scriptHint = CliRuntime.WasSpecified(parseResult, ScriptHint) ? parseResult.GetValue(ScriptHint) : (__requestBase is { } __ScriptHintBaseValue ? __ScriptHintBaseValue.ScriptHint : default);
var model = CliRuntime.WasSpecified(parseResult, Model) ? parseResult.GetValue(Model) : (__requestBase is { } __ModelBaseValue ? __ModelBaseValue.Model : default);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = await client.Audio.CreateVoiceAsync(
name: name,
type: type,
prompt: prompt,
scriptHint: scriptHint,
model: model,

request: request,
cancellationToken: cancellationToken).ConfigureAwait(false);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal static partial class ModelsRetrieveModelCommandApiCommand
Description = @"The ID of the model to use for this request",
};

private static string FormatResponse(ParseResult parseResult, global::tryAGI.OpenAI.Model19 value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
private static string FormatResponse(ParseResult parseResult, global::tryAGI.OpenAI.Model18 value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
{
string? text = null;
CustomizeResponseText(parseResult, value, ref text);
Expand All @@ -29,7 +29,7 @@ private static string FormatResponse(ParseResult parseResult, global::tryAGI.Ope
return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints);
}

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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ set this to [""text""].
`marin`, and `cedar`. You may also provide a custom voice object with an
`id`, for example `{ ""id"": ""voice_1234"" }`. Voice cannot be changed during
the session once the model has responded with audio at least once.
Custom voices must be created from audio samples. Voices created from text prompts are supported only in Live.
Custom voices must be created from audio samples.
",
};

Expand Down
Loading
Loading