Skip to content

Commit 469ad7b

Browse files
feat(api): Config update for pakrym-stream-param
1 parent 5b34fcd commit 469ad7b

File tree

6 files changed

+222
-46
lines changed

6 files changed

+222
-46
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 111
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fc64d7c2c8f51f750813375356c3f3fdfc7fc1b1b34f19c20a5410279d445d37.yml
3-
openapi_spec_hash: 618285fc70199ee32b9ebe4bf72f7e4c
4-
config_hash: 3b590818075ca4b54949578b97494525
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-d4bcffecf0cdadf746faa6708ed1ec81fac451f9b857deabbab26f0a343b9314.yml
3+
openapi_spec_hash: 7c54a18b4381248bda7cc34c52142615
4+
config_hash: 2102e4b25bbcab5d32d5ffa5d34daa0c

src/resources/beta/realtime/realtime.ts

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2094,6 +2094,11 @@ export namespace SessionUpdateEvent {
20942094
* Realtime session object configuration.
20952095
*/
20962096
export interface Session {
2097+
/**
2098+
* Configuration options for the generated client secret.
2099+
*/
2100+
client_secret?: Session.ClientSecret;
2101+
20972102
/**
20982103
* The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For
20992104
* `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel
@@ -2219,6 +2224,35 @@ export namespace SessionUpdateEvent {
22192224
}
22202225

22212226
export namespace Session {
2227+
/**
2228+
* Configuration options for the generated client secret.
2229+
*/
2230+
export interface ClientSecret {
2231+
/**
2232+
* Configuration for the ephemeral token expiration.
2233+
*/
2234+
expires_at?: ClientSecret.ExpiresAt;
2235+
}
2236+
2237+
export namespace ClientSecret {
2238+
/**
2239+
* Configuration for the ephemeral token expiration.
2240+
*/
2241+
export interface ExpiresAt {
2242+
/**
2243+
* The anchor point for the ephemeral token expiration. Only `created_at` is
2244+
* currently supported.
2245+
*/
2246+
anchor?: 'created_at';
2247+
2248+
/**
2249+
* The number of seconds from the anchor point to the expiration. Select a value
2250+
* between `10` and `7200`.
2251+
*/
2252+
seconds?: number;
2253+
}
2254+
}
2255+
22222256
/**
22232257
* Configuration for input audio noise reduction. This can be set to `null` to turn
22242258
* off. Noise reduction filters audio added to the input audio buffer before it is
@@ -2399,6 +2433,11 @@ export namespace TranscriptionSessionUpdate {
23992433
* Realtime transcription session object configuration.
24002434
*/
24012435
export interface Session {
2436+
/**
2437+
* Configuration options for the generated client secret.
2438+
*/
2439+
client_secret?: Session.ClientSecret;
2440+
24022441
/**
24032442
* The set of items to include in the transcription. Current available items are:
24042443
*
@@ -2451,6 +2490,35 @@ export namespace TranscriptionSessionUpdate {
24512490
}
24522491

24532492
export namespace Session {
2493+
/**
2494+
* Configuration options for the generated client secret.
2495+
*/
2496+
export interface ClientSecret {
2497+
/**
2498+
* Configuration for the ephemeral token expiration.
2499+
*/
2500+
expires_at?: ClientSecret.ExpiresAt;
2501+
}
2502+
2503+
export namespace ClientSecret {
2504+
/**
2505+
* Configuration for the ephemeral token expiration.
2506+
*/
2507+
export interface ExpiresAt {
2508+
/**
2509+
* The anchor point for the ephemeral token expiration. Only `created_at` is
2510+
* currently supported.
2511+
*/
2512+
anchor?: 'created_at';
2513+
2514+
/**
2515+
* The number of seconds from the anchor point to the expiration. Select a value
2516+
* between `10` and `7200`.
2517+
*/
2518+
seconds?: number;
2519+
}
2520+
}
2521+
24542522
/**
24552523
* Configuration for input audio noise reduction. This can be set to `null` to turn
24562524
* off. Noise reduction filters audio added to the input audio buffer before it is

src/resources/beta/realtime/sessions.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,11 @@ export namespace SessionCreateResponse {
485485
}
486486

487487
export interface SessionCreateParams {
488+
/**
489+
* Configuration options for the generated client secret.
490+
*/
491+
client_secret?: SessionCreateParams.ClientSecret;
492+
488493
/**
489494
* The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For
490495
* `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel
@@ -610,6 +615,35 @@ export interface SessionCreateParams {
610615
}
611616

612617
export namespace SessionCreateParams {
618+
/**
619+
* Configuration options for the generated client secret.
620+
*/
621+
export interface ClientSecret {
622+
/**
623+
* Configuration for the ephemeral token expiration.
624+
*/
625+
expires_at?: ClientSecret.ExpiresAt;
626+
}
627+
628+
export namespace ClientSecret {
629+
/**
630+
* Configuration for the ephemeral token expiration.
631+
*/
632+
export interface ExpiresAt {
633+
/**
634+
* The anchor point for the ephemeral token expiration. Only `created_at` is
635+
* currently supported.
636+
*/
637+
anchor?: 'created_at';
638+
639+
/**
640+
* The number of seconds from the anchor point to the expiration. Select a value
641+
* between `10` and `7200`.
642+
*/
643+
seconds?: number;
644+
}
645+
}
646+
613647
/**
614648
* Configuration for input audio noise reduction. This can be set to `null` to turn
615649
* off. Noise reduction filters audio added to the input audio buffer before it is

src/resources/beta/realtime/transcription-sessions.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ export namespace TranscriptionSession {
149149
}
150150

151151
export interface TranscriptionSessionCreateParams {
152+
/**
153+
* Configuration options for the generated client secret.
154+
*/
155+
client_secret?: TranscriptionSessionCreateParams.ClientSecret;
156+
152157
/**
153158
* The set of items to include in the transcription. Current available items are:
154159
*
@@ -201,6 +206,35 @@ export interface TranscriptionSessionCreateParams {
201206
}
202207

203208
export namespace TranscriptionSessionCreateParams {
209+
/**
210+
* Configuration options for the generated client secret.
211+
*/
212+
export interface ClientSecret {
213+
/**
214+
* Configuration for the ephemeral token expiration.
215+
*/
216+
expires_at?: ClientSecret.ExpiresAt;
217+
}
218+
219+
export namespace ClientSecret {
220+
/**
221+
* Configuration for the ephemeral token expiration.
222+
*/
223+
export interface ExpiresAt {
224+
/**
225+
* The anchor point for the ephemeral token expiration. Only `created_at` is
226+
* currently supported.
227+
*/
228+
anchor?: 'created_at';
229+
230+
/**
231+
* The number of seconds from the anchor point to the expiration. Select a value
232+
* between `10` and `7200`.
233+
*/
234+
seconds?: number;
235+
}
236+
}
237+
204238
/**
205239
* Configuration for input audio noise reduction. This can be set to `null` to turn
206240
* off. Noise reduction filters audio added to the input audio buffer before it is

src/resources/responses/responses.ts

Lines changed: 82 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
addOutputText,
88
} from '../../lib/ResponsesParser';
99
import * as Core from '../../core';
10-
import { APIPromise, isRequestOptions } from '../../core';
10+
import { APIPromise } from '../../core';
1111
import { APIResource } from '../../resource';
1212
import * as Shared from '../shared';
1313
import * as InputItemsAPI from './input-items';
@@ -117,38 +117,26 @@ export class Responses extends APIResource {
117117
responseId: string,
118118
query?: ResponseRetrieveParamsNonStreaming,
119119
options?: Core.RequestOptions,
120-
): Core.APIPromise<Response>;
120+
): APIPromise<Response>;
121121
retrieve(
122122
responseId: string,
123-
query?: ResponseRetrieveParamsStreaming,
123+
query: ResponseRetrieveParamsStreaming,
124124
options?: Core.RequestOptions,
125-
): Core.APIPromise<Stream<ResponseStreamEvent>>;
126-
retrieve(responseId: string, options?: Core.RequestOptions): Core.APIPromise<Response>;
125+
): APIPromise<Stream<ResponseStreamEvent>>;
127126
retrieve(
128127
responseId: string,
129-
query: ResponseRetrieveParams | Core.RequestOptions,
128+
query?: ResponseRetrieveParamsBase | undefined,
130129
options?: Core.RequestOptions,
131-
): Core.APIPromise<Response> | Core.APIPromise<Stream<ResponseStreamEvent>>;
130+
): APIPromise<Stream<ResponseStreamEvent> | Response>;
132131
retrieve(
133132
responseId: string,
134-
query: ResponseRetrieveParams | Core.RequestOptions = {},
133+
query: ResponseRetrieveParams | undefined = {},
135134
options?: Core.RequestOptions,
136-
): Core.APIPromise<Response> | Core.APIPromise<Stream<ResponseStreamEvent>> {
137-
if (isRequestOptions(query) && options === undefined) {
138-
return this.retrieve(responseId, {}, query);
139-
}
140-
return (
141-
this._client.get(`/responses/${responseId}`, {
142-
query,
143-
...options,
144-
stream: query.stream ?? false,
145-
}) as APIPromise<Response> | APIPromise<Stream<ResponseStreamEvent>>
146-
)._thenUnwrap((rsp) => {
147-
if ('object' in rsp && rsp.object === 'response') {
148-
addOutputText(rsp as Response);
149-
}
150-
151-
return rsp;
135+
): APIPromise<Response> | APIPromise<Stream<ResponseStreamEvent>> {
136+
return this._client.get(`/responses/${responseId}`, {
137+
query,
138+
...options,
139+
stream: query?.stream ?? false,
152140
}) as APIPromise<Response> | APIPromise<Stream<ResponseStreamEvent>>;
153141
}
154142

@@ -3320,6 +3308,8 @@ export interface ResponseOutputText {
33203308
* The type of the output text. Always `output_text`.
33213309
*/
33223310
type: 'output_text';
3311+
3312+
logprobs?: Array<ResponseOutputText.Logprob>;
33233313
}
33243314

33253315
export namespace ResponseOutputText {
@@ -3392,6 +3382,32 @@ export namespace ResponseOutputText {
33923382
*/
33933383
type: 'file_path';
33943384
}
3385+
3386+
/**
3387+
* The log probability of a token.
3388+
*/
3389+
export interface Logprob {
3390+
token: string;
3391+
3392+
bytes: Array<number>;
3393+
3394+
logprob: number;
3395+
3396+
top_logprobs: Array<Logprob.TopLogprob>;
3397+
}
3398+
3399+
export namespace Logprob {
3400+
/**
3401+
* The top log probability of a token.
3402+
*/
3403+
export interface TopLogprob {
3404+
token: string;
3405+
3406+
bytes: Array<number>;
3407+
3408+
logprob: number;
3409+
}
3410+
}
33953411
}
33963412

33973413
/**
@@ -4742,29 +4758,60 @@ export interface ResponseCreateParamsStreaming extends ResponseCreateParamsBase
47424758
stream: true;
47434759
}
47444760

4745-
export type ResponseRetrieveParams = ResponseRetrieveParamsStreaming | ResponseRetrieveParamsNonStreaming;
4761+
export type ResponseRetrieveParams = ResponseRetrieveParamsNonStreaming | ResponseRetrieveParamsStreaming;
4762+
47464763
export interface ResponseRetrieveParamsBase {
47474764
/**
47484765
* Additional fields to include in the response. See the `include` parameter for
47494766
* Response creation above for more information.
47504767
*/
47514768
include?: Array<ResponseIncludable>;
47524769

4753-
starting_after?: number | null;
4754-
stream?: boolean | null;
4770+
/**
4771+
* The sequence number of the event after which to start streaming.
4772+
*/
4773+
starting_after?: number;
4774+
4775+
/**
4776+
* If set to true, the model response data will be streamed to the client as it is
4777+
* generated using
4778+
* [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
4779+
* See the
4780+
* [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming)
4781+
* for more information.
4782+
*/
4783+
stream?: boolean;
47554784
}
47564785

4757-
export interface ResponseRetrieveParamsStreaming extends ResponseRetrieveParamsBase {
4758-
stream: true;
4786+
export namespace ResponseRetrieveParams {
4787+
export type ResponseRetrieveParamsNonStreaming = ResponsesAPI.ResponseRetrieveParamsNonStreaming;
4788+
export type ResponseRetrieveParamsStreaming = ResponsesAPI.ResponseRetrieveParamsStreaming;
47594789
}
4790+
47604791
export interface ResponseRetrieveParamsNonStreaming extends ResponseRetrieveParamsBase {
4761-
stream?: false | null;
4792+
/**
4793+
* If set to true, the model response data will be streamed to the client as it is
4794+
* generated using
4795+
* [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
4796+
* See the
4797+
* [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming)
4798+
* for more information.
4799+
*/
4800+
stream?: false;
47624801
}
47634802

4764-
export namespace ResponseRetrieveParams {
4765-
export type ResponseRetrieveParamsStreaming = ResponsesAPI.ResponseRetrieveParamsStreaming;
4766-
export type ResponseRetrieveParamsNonStreaming = ResponsesAPI.ResponseRetrieveParamsNonStreaming;
4803+
export interface ResponseRetrieveParamsStreaming extends ResponseRetrieveParamsBase {
4804+
/**
4805+
* If set to true, the model response data will be streamed to the client as it is
4806+
* generated using
4807+
* [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
4808+
* See the
4809+
* [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming)
4810+
* for more information.
4811+
*/
4812+
stream: true;
47674813
}
4814+
47684815
Responses.InputItems = InputItems;
47694816

47704817
export declare namespace Responses {
@@ -4870,6 +4917,8 @@ export declare namespace Responses {
48704917
type ResponseCreateParamsNonStreaming as ResponseCreateParamsNonStreaming,
48714918
type ResponseCreateParamsStreaming as ResponseCreateParamsStreaming,
48724919
type ResponseRetrieveParams as ResponseRetrieveParams,
4920+
type ResponseRetrieveParamsNonStreaming as ResponseRetrieveParamsNonStreaming,
4921+
type ResponseRetrieveParamsStreaming as ResponseRetrieveParamsStreaming,
48734922
};
48744923

48754924
export {

0 commit comments

Comments
 (0)