@runappsai/sdk 0.7.3 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -5
- package/dist/chat.d.ts +27 -0
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/realtime.d.ts.map +1 -1
- package/dist/realtime.js.map +1 -1
- package/dist/sdk.umd.js +3 -3
- package/dist/sdk.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/chat.ts +27 -0
- package/src/index.ts +1 -0
- package/src/realtime.ts +6 -3
package/package.json
CHANGED
package/src/chat.ts
CHANGED
|
@@ -40,9 +40,34 @@ export interface ChatTool {
|
|
|
40
40
|
name: string;
|
|
41
41
|
description?: string;
|
|
42
42
|
parameters?: Record<string, unknown>;
|
|
43
|
+
/**
|
|
44
|
+
* Guarantee arguments that validate against `parameters` (strict tool
|
|
45
|
+
* use). The schema should list `required` fields and close every
|
|
46
|
+
* object with `additionalProperties: false`.
|
|
47
|
+
*/
|
|
48
|
+
strict?: boolean;
|
|
43
49
|
};
|
|
44
50
|
}
|
|
45
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Constrains the reply. `json_schema` makes the reply a JSON document
|
|
54
|
+
* matching `schema` (structured outputs: on Claude it becomes
|
|
55
|
+
* `output_config.format`, and objects that leave `additionalProperties`
|
|
56
|
+
* unset are closed for you); `json_object` asks for any JSON object.
|
|
57
|
+
*/
|
|
58
|
+
export type ChatResponseFormat =
|
|
59
|
+
| { type: "text" }
|
|
60
|
+
| { type: "json_object" }
|
|
61
|
+
| {
|
|
62
|
+
type: "json_schema";
|
|
63
|
+
json_schema: {
|
|
64
|
+
name: string;
|
|
65
|
+
description?: string;
|
|
66
|
+
schema: Record<string, unknown>;
|
|
67
|
+
strict?: boolean;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
46
71
|
export interface StreamOptions {
|
|
47
72
|
include_usage: boolean;
|
|
48
73
|
}
|
|
@@ -108,6 +133,8 @@ export interface ChatCompletionParams {
|
|
|
108
133
|
n?: number;
|
|
109
134
|
tools?: ChatTool[];
|
|
110
135
|
tool_choice?: unknown;
|
|
136
|
+
/** Structured outputs — see {@link ChatResponseFormat}. */
|
|
137
|
+
response_format?: ChatResponseFormat;
|
|
111
138
|
user?: string;
|
|
112
139
|
metadata?: Record<string, unknown>;
|
|
113
140
|
stream?: boolean;
|
package/src/index.ts
CHANGED
package/src/realtime.ts
CHANGED
|
@@ -19,7 +19,9 @@ import type { Transport } from "./transport.js";
|
|
|
19
19
|
* → response.cancel interrupt the reply
|
|
20
20
|
* → session.close (close() sends it)
|
|
21
21
|
* ← session.created
|
|
22
|
-
* ← conversation.item.input_audio_transcription.delta / .completed (what the user said
|
|
22
|
+
* ← conversation.item.input_audio_transcription.delta / .completed (what the user said:
|
|
23
|
+
* delta = only the new text, as OpenAI's Realtime API; transcript = the
|
|
24
|
+
* sentence so far; completed.transcript = the final sentence)
|
|
23
25
|
* ← response.output_text.delta / .done (what the model says)
|
|
24
26
|
* ← response.output_audio.delta {delta: base64 PCM16, 24 kHz mono by default}
|
|
25
27
|
* ← response.done one turn finished, with token usage
|
|
@@ -36,8 +38,9 @@ import type { Transport } from "./transport.js";
|
|
|
36
38
|
* `session.mode: "transcription"`, `session.hotwords` (array or
|
|
37
39
|
* comma-separated string) favours words, and only the
|
|
38
40
|
* `…input_audio_transcription.started / .delta / .completed` events come
|
|
39
|
-
* back — `.delta`
|
|
40
|
-
* sentence
|
|
41
|
+
* back — `.delta` carries the new text in `delta` (append it) and the
|
|
42
|
+
* sentence so far, revisions included, in `transcript`; `.completed` a
|
|
43
|
+
* finished sentence (`transcript`) with `start_ms` / `end_ms`. `commitAudio()` or `close()` ends
|
|
41
44
|
* the audio; the last sentence settles before the session closes.
|
|
42
45
|
*/
|
|
43
46
|
|