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
2 changes: 1 addition & 1 deletion .claude/skills/tryagi-openai/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ Manage and run evals in the OpenAI platform.

| Command | Route | Description |
|---------|-------|-------------|
| `cancel-eval-run` | `POST /evals/{eval_id}/runs/{run_id}` | Cancel eval run |
| `cancel-eval-run` | `POST /evals/{eval_id}/runs/{run_id}/cancel` | Cancel eval run |
| `create-eval` | `POST /evals` | Create eval |
| `create-eval-run` | `POST /evals/{eval_id}/runs` | Create eval run |
| `delete-eval` | `DELETE /evals/{eval_id}` | Delete an eval |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ internal static partial class LiveCreateLiveCommandApiCommand
Description = @"Startup configuration for the Live session.",
Required = true,
};
private static readonly LiveWebRTCTransportOptionSet TransportOptions = LiveWebRTCTransportOptionSet.Create(@"transport");

private static string FormatResponse(ParseResult parseResult, global::tryAGI.OpenAI.LiveCreateResponse value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
private static Option<global::tryAGI.OpenAI.Transport> Transport { get; } = new(
name: @"--transport")
{
Description = @"WebRTC transport with an SDP offer, or SIP transport with a destination and per-call trunk credentials.",
Required = true,
};

private static string FormatResponse(ParseResult parseResult, global::tryAGI.OpenAI.LiveSessionCreateResponse value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
{
string? text = null;
CustomizeResponseText(parseResult, value, ref text);
Expand All @@ -31,7 +37,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.LiveCreateResponse value, ref string? text);
static partial void CustomizeResponseText(ParseResult parseResult, global::tryAGI.OpenAI.LiveSessionCreateResponse value, ref string? text);
static partial void CustomizeResponseFormatHints(Dictionary<string, CliFormatHint> hints);


Expand All @@ -40,33 +46,39 @@ private static string FormatResponse(ParseResult parseResult, global::tryAGI.Ope
public static Command Create(string? commandName = null)
{
var command = new Command(commandName ?? @"create-live", @"Create session
Create a Live WebRTC session. Start with the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting).");
command.Options.Add(Session); command.Options.Add(TransportOptions.Type);
command.Options.Add(TransportOptions.Sdp);
Create a Live WebRTC session or place an outbound SIP call. Start with the
[Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) for session configuration
and [Telephony and SIP](https://developers.openai.com/api/docs/guides/voice-sip?api=live#place-an-outbound-call)
for trunk setup and call monitoring.

Set transport.type to `webrtc` and supply an SDP offer, or set it to `sip`
and supply an E.164 destination and trunk credentials. Outbound SIP calling
must be enabled for your organization.
Ringing is limited to 3 minutes and connected calls to 2 hours; these limits
are not configurable in the request.

Returns `201 Created` after session initialization. WebRTC responses include an
SDP answer. SIP responses do not wait for the callee to answer. Attach a
sideband connection using session.id to monitor SIP call progress.

Each SIP request creates a new call. If a request times out or the connection
fails, retry with caution: the original request may have succeeded, and a
retry can place another call.");
command.Options.Add(Session);
command.Options.Add(Transport);


command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) =>
await CliRuntime.RunAsync(async () =>
{
var session = parseResult.GetRequiredValue(Session);
var transportType = parseResult.GetValue(TransportOptions.Type);
var transportSdp = parseResult.GetValue(TransportOptions.Sdp);
var __TransportSpecified = CliRuntime.WasSpecified(parseResult, TransportOptions.Type) || CliRuntime.WasSpecified(parseResult, TransportOptions.Sdp);
var transport =
__TransportSpecified || false
? new global::tryAGI.OpenAI.LiveWebRTCTransport
{
Type = transportType,
Sdp = transportSdp!,

}
: null;
var transport = parseResult.GetRequiredValue(Transport);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = await client.Live.CreateLiveAsync(
session: session,
transport: transport!,
transport: transport,
cancellationToken: cancellationToken).ConfigureAwait(false);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ internal static partial class LiveForkLiveSessionCommandApiCommand
{
Description = @"Optional configuration overrides for the new Live session. Omit this object or send an empty object to inherit the stored session's settings.",
};
private static readonly LiveWebRTCTransportOptionSet TransportOptions = LiveWebRTCTransportOptionSet.Create(@"transport");

private static Option<global::tryAGI.OpenAI.LiveWebRTCTransport> Transport { get; } = new(
name: @"--transport")
{
Description = @"WebRTC transport with an SDP offer for the new connection to the forked session.",
Required = true,
};
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 @@ -63,8 +69,8 @@ public static Command Create(string? commandName = null)
var command = new Command(commandName ?? @"fork-live-session", @"Fork session
Fork a stored Live session onto a new WebRTC connection.");
command.Arguments.Add(SessionId);
command.Options.Add(Session); command.Options.Add(TransportOptions.Type);
command.Options.Add(TransportOptions.Sdp);
command.Options.Add(Session);
command.Options.Add(Transport);
command.Options.Add(Input);
command.Options.Add(RequestJson);
command.Options.Add(RequestFile);
Expand Down Expand Up @@ -92,26 +98,14 @@ await CliRuntime.RunAsync(async () =>
cancellationToken).ConfigureAwait(false);
var sessionId = parseResult.GetRequiredValue(SessionId);
var session = CliRuntime.WasSpecified(parseResult, Session) ? parseResult.GetValue(Session) : (__requestBase is { } __SessionBaseValue ? __SessionBaseValue.Session : default);

var __TransportBase = __requestBase is { } __TransportBaseValue ? __TransportBaseValue.Transport : default; var transportType = CliRuntime.WasSpecified(parseResult, TransportOptions.Type) ? parseResult.GetValue(TransportOptions.Type) : (__TransportBase is { } __TransporttypeBaseValue ? __TransporttypeBaseValue.Type : default);
var transportSdp = parseResult.GetValue(TransportOptions.Sdp);
var __TransportSpecified = CliRuntime.WasSpecified(parseResult, TransportOptions.Type) || CliRuntime.WasSpecified(parseResult, TransportOptions.Sdp);
var transport =
__TransportSpecified || __TransportBase is not null
? new global::tryAGI.OpenAI.LiveWebRTCTransport
{
Type = transportType,
Sdp = transportSdp!,

}
: __TransportBase;
var transport = parseResult.GetRequiredValue(Transport);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = await client.Live.ForkLiveSessionAsync(
sessionId: sessionId,
session: session,
transport: transport!,
transport: transport,
cancellationToken: cancellationToken).ConfigureAwait(false);


Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@
"Order": 12,
"Title": "Create session",
"Slug": "create-live",
"Description": "Create a Live WebRTC session. Start with the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting).",
"Description": "Create a Live WebRTC session or place an outbound SIP call. Start with the\n[Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) for session configuration\nand [Telephony and SIP](https://developers.openai.com/api/docs/guides/voice-sip?api=live#place-an-outbound-call)\nfor trunk setup and call monitoring.\n\nSet transport.type to \u0060webrtc\u0060 and supply an SDP offer, or set it to \u0060sip\u0060\nand supply an E.164 destination and trunk credentials. Outbound SIP calling\nmust be enabled for your organization.\nRinging is limited to 3 minutes and connected calls to 2 hours; these limits\nare not configurable in the request.\n\nReturns \u0060201 Created\u0060 after session initialization. WebRTC responses include an\nSDP answer. SIP responses do not wait for the callee to answer. Attach a\nsideband connection using session.id to monitor SIP call progress.\n\nEach SIP request creates a new call. If a request times out or the connection\nfails, retry with caution: the original request may have succeeded, and a\nretry can place another call.",
"Language": "http",
"Code": "### Create session\n# @name create-live\nPOST {{host}}/live/sessions\nAuthorization: Bearer {{token}}\nContent-Type: application/json\nAccept: application/json, text/plain\n\n{\n \u0022session\u0022: {\n \u0022model\u0022: \u0022gpt-live-1\u0022,\n \u0022instructions\u0022: \u0022string\u0022,\n \u0022audio\u0022: {\n \u0022output\u0022: {}\n },\n \u0022delegation\u0022: {\n \u0022type\u0022: \u0022client\u0022\n },\n \u0022store\u0022: true,\n \u0022input\u0022: [\n {}\n ],\n \u0022client\u0022: {\n \u0022data_channel\u0022: {}\n }\n },\n \u0022transport\u0022: {\n \u0022type\u0022: \u0022webrtc\u0022,\n \u0022sdp\u0022: \u0022string\u0022\n }\n}\n\n## Responses\n# 201\n# Description: Live session created with a WebRTC answer.\n# Content-Type: application/json\n# 400\n# Description: Invalid Live session request.\n# Content-Type: application/json, text/plain\n# 413\n# Description: The Live session request exceeds the supported size limit.\n# Content-Type: application/json, text/plain\n# 429\n# Description: The session could not start because a rate or quota limit was exceeded.\n# Content-Type: application/json\n# 500\n# Description: An internal error occurred. The response body is plain text.\n# Content-Type: text/plain\n# 503\n# Description: The session is temporarily unavailable.\n# Content-Type: application/json, text/plain",
"Code": "### Create session\n# @name create-live\nPOST {{host}}/live/sessions\nAuthorization: Bearer {{token}}\nContent-Type: application/json\nAccept: application/json, text/plain\n\n{\n \u0022session\u0022: {\n \u0022model\u0022: \u0022gpt-live-1\u0022,\n \u0022instructions\u0022: \u0022string\u0022,\n \u0022audio\u0022: {\n \u0022output\u0022: {}\n },\n \u0022delegation\u0022: {\n \u0022type\u0022: \u0022client\u0022\n },\n \u0022store\u0022: true,\n \u0022input\u0022: [\n {}\n ],\n \u0022client\u0022: {\n \u0022data_channel\u0022: {}\n }\n },\n \u0022transport\u0022: {\n \u0022type\u0022: \u0022webrtc\u0022,\n \u0022sdp\u0022: \u0022string\u0022\n }\n}\n\n## Responses\n# 201\n# Description: Returns 201 Created with a WebRTC answer or an initialized outbound SIP session. A SIP response does not mean the callee has answered.\n# Content-Type: application/json\n# 400\n# Description: Invalid Live session request.\n# Content-Type: application/json, text/plain\n# 413\n# Description: The Live session request exceeds the supported size limit.\n# Content-Type: application/json, text/plain\n# 429\n# Description: The session could not start because a rate or quota limit was exceeded.\n# Content-Type: application/json\n# 500\n# Description: An internal error occurred. The response body is plain text.\n# Content-Type: text/plain\n# 502\n# Description: The SIP gateway could not initialize the outbound call.\n# Content-Type: text/plain\n# 503\n# Description: The session is temporarily unavailable.\n# Content-Type: application/json, text/plain\n# 504\n# Description: SIP session initialization timed out. The error code is sip_setup_timeout.\n# Content-Type: application/json",
"Format": "http",
"OperationId": "create-live",
"Setup": null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ partial void ProcessCancelEvalRunResponseContent(
{

var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/evals/{evalId}/runs/{runId}",
path: $"/evals/{evalId}/runs/{runId}/cancel",
baseUri: HttpClient.BaseAddress);
var __path = __pathBuilder.ToString();
__path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
Expand Down Expand Up @@ -175,7 +175,7 @@ partial void ProcessCancelEvalRunResponseContent(
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
operationId: "CancelEvalRun",
methodName: "CancelEvalRunAsync",
pathTemplate: "$\"/evals/{evalId}/runs/{runId}\"",
pathTemplate: "$\"/evals/{evalId}/runs/{runId}/cancel\"",
httpMethod: "POST",
baseUri: BaseUri,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
Expand Down Expand Up @@ -209,7 +209,7 @@ partial void ProcessCancelEvalRunResponseContent(
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
operationId: "CancelEvalRun",
methodName: "CancelEvalRunAsync",
pathTemplate: "$\"/evals/{evalId}/runs/{runId}\"",
pathTemplate: "$\"/evals/{evalId}/runs/{runId}/cancel\"",
httpMethod: "POST",
baseUri: BaseUri,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
Expand Down Expand Up @@ -250,7 +250,7 @@ partial void ProcessCancelEvalRunResponseContent(
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
operationId: "CancelEvalRun",
methodName: "CancelEvalRunAsync",
pathTemplate: "$\"/evals/{evalId}/runs/{runId}\"",
pathTemplate: "$\"/evals/{evalId}/runs/{runId}/cancel\"",
httpMethod: "POST",
baseUri: BaseUri,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
Expand Down Expand Up @@ -298,7 +298,7 @@ partial void ProcessCancelEvalRunResponseContent(
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
operationId: "CancelEvalRun",
methodName: "CancelEvalRunAsync",
pathTemplate: "$\"/evals/{evalId}/runs/{runId}\"",
pathTemplate: "$\"/evals/{evalId}/runs/{runId}/cancel\"",
httpMethod: "POST",
baseUri: BaseUri,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
Expand All @@ -320,7 +320,7 @@ partial void ProcessCancelEvalRunResponseContent(
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
operationId: "CancelEvalRun",
methodName: "CancelEvalRunAsync",
pathTemplate: "$\"/evals/{evalId}/runs/{runId}\"",
pathTemplate: "$\"/evals/{evalId}/runs/{runId}/cancel\"",
httpMethod: "POST",
baseUri: BaseUri,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
Expand Down
Loading
Loading