telnyx 6.49.0 → 6.50.0
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/CHANGELOG.md +13 -0
- package/package.json +1 -1
- package/resources/ai/ai.d.mts +8 -11
- package/resources/ai/ai.d.mts.map +1 -1
- package/resources/ai/ai.d.ts +8 -11
- package/resources/ai/ai.d.ts.map +1 -1
- package/resources/ai/ai.js +6 -9
- package/resources/ai/ai.js.map +1 -1
- package/resources/ai/ai.mjs +6 -9
- package/resources/ai/ai.mjs.map +1 -1
- package/resources/ai/chat.d.mts +14 -13
- package/resources/ai/chat.d.mts.map +1 -1
- package/resources/ai/chat.d.ts +14 -13
- package/resources/ai/chat.d.ts.map +1 -1
- package/resources/ai/chat.js +3 -13
- package/resources/ai/chat.js.map +1 -1
- package/resources/ai/chat.mjs +3 -13
- package/resources/ai/chat.mjs.map +1 -1
- package/resources/ai/index.d.mts +1 -1
- package/resources/ai/index.d.mts.map +1 -1
- package/resources/ai/index.d.ts +1 -1
- package/resources/ai/index.d.ts.map +1 -1
- package/resources/ai/index.js.map +1 -1
- package/resources/ai/index.mjs.map +1 -1
- package/resources/ai/openai/chat.d.mts +204 -0
- package/resources/ai/openai/chat.d.mts.map +1 -0
- package/resources/ai/openai/chat.d.ts +204 -0
- package/resources/ai/openai/chat.d.ts.map +1 -0
- package/resources/ai/openai/chat.js +32 -0
- package/resources/ai/openai/chat.js.map +1 -0
- package/resources/ai/openai/chat.mjs +28 -0
- package/resources/ai/openai/chat.mjs.map +1 -0
- package/resources/ai/openai/index.d.mts +2 -1
- package/resources/ai/openai/index.d.mts.map +1 -1
- package/resources/ai/openai/index.d.ts +2 -1
- package/resources/ai/openai/index.d.ts.map +1 -1
- package/resources/ai/openai/index.js +3 -1
- package/resources/ai/openai/index.js.map +1 -1
- package/resources/ai/openai/index.mjs +1 -0
- package/resources/ai/openai/index.mjs.map +1 -1
- package/resources/ai/openai/openai.d.mts +32 -0
- package/resources/ai/openai/openai.d.mts.map +1 -1
- package/resources/ai/openai/openai.d.ts +32 -0
- package/resources/ai/openai/openai.d.ts.map +1 -1
- package/resources/ai/openai/openai.js +19 -0
- package/resources/ai/openai/openai.js.map +1 -1
- package/resources/ai/openai/openai.mjs +19 -0
- package/resources/ai/openai/openai.mjs.map +1 -1
- package/src/resources/ai/ai.ts +8 -11
- package/src/resources/ai/chat.ts +16 -13
- package/src/resources/ai/index.ts +1 -1
- package/src/resources/ai/openai/chat.ts +249 -0
- package/src/resources/ai/openai/index.ts +2 -1
- package/src/resources/ai/openai/openai.ts +48 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { APIResource } from "../../../core/resource.mjs";
|
|
2
|
+
import * as ChatAPI from "../chat.mjs";
|
|
3
|
+
import { APIPromise } from "../../../core/api-promise.mjs";
|
|
4
|
+
import { RequestOptions } from "../../../internal/request-options.mjs";
|
|
5
|
+
export declare class Chat extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Chat with a language model. This endpoint is consistent with the
|
|
8
|
+
* [OpenAI Chat Completions API](https://platform.openai.com/docs/api-reference/chat)
|
|
9
|
+
* and may be used with the OpenAI JS or Python SDK by setting the base URL to
|
|
10
|
+
* `https://api.telnyx.com/v2/ai/openai`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const response =
|
|
15
|
+
* await client.ai.openai.chat.createCompletion({
|
|
16
|
+
* messages: [
|
|
17
|
+
* {
|
|
18
|
+
* role: 'system',
|
|
19
|
+
* content: 'You are a friendly chatbot.',
|
|
20
|
+
* },
|
|
21
|
+
* { role: 'user', content: 'Hello, world!' },
|
|
22
|
+
* ],
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
createCompletion(body: ChatCreateCompletionParams, options?: RequestOptions): APIPromise<ChatCreateCompletionResponse>;
|
|
27
|
+
}
|
|
28
|
+
export type ChatCreateCompletionResponse = {
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
};
|
|
31
|
+
export interface ChatCreateCompletionParams {
|
|
32
|
+
/**
|
|
33
|
+
* A list of the previous chat messages for context.
|
|
34
|
+
*/
|
|
35
|
+
messages: Array<ChatCreateCompletionParams.Message>;
|
|
36
|
+
/**
|
|
37
|
+
* If you are using an external inference provider like xAI or OpenAI, this field
|
|
38
|
+
* allows you to pass along a reference to your API key. After creating an
|
|
39
|
+
* [integration secret](https://developers.telnyx.com/api-reference/integration-secrets/create-a-secret)
|
|
40
|
+
* for you API key, pass the secret's `identifier` in this field.
|
|
41
|
+
*/
|
|
42
|
+
api_key_ref?: string;
|
|
43
|
+
/**
|
|
44
|
+
* This is used with `use_beam_search` to determine how many candidate beams to
|
|
45
|
+
* explore.
|
|
46
|
+
*/
|
|
47
|
+
best_of?: number;
|
|
48
|
+
/**
|
|
49
|
+
* This is used with `use_beam_search`. If `true`, generation stops as soon as
|
|
50
|
+
* there are `best_of` complete candidates; if `false`, a heuristic is applied and
|
|
51
|
+
* the generation stops when is it very unlikely to find better candidates.
|
|
52
|
+
*/
|
|
53
|
+
early_stopping?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Whether to enable the thinking/reasoning phase for models that support it (e.g.,
|
|
56
|
+
* QwQ, Qwen3). When set to false, the model will skip the internal reasoning step
|
|
57
|
+
* and respond directly, which can reduce latency. Defaults to true.
|
|
58
|
+
*/
|
|
59
|
+
enable_thinking?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Higher values will penalize the model from repeating the same output tokens.
|
|
62
|
+
*/
|
|
63
|
+
frequency_penalty?: number;
|
|
64
|
+
/**
|
|
65
|
+
* If specified, the output will be exactly one of the choices.
|
|
66
|
+
*/
|
|
67
|
+
guided_choice?: Array<string>;
|
|
68
|
+
/**
|
|
69
|
+
* Must be a valid JSON schema. If specified, the output will follow the JSON
|
|
70
|
+
* schema.
|
|
71
|
+
*/
|
|
72
|
+
guided_json?: {
|
|
73
|
+
[key: string]: unknown;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* If specified, the output will follow the regex pattern.
|
|
77
|
+
*/
|
|
78
|
+
guided_regex?: string;
|
|
79
|
+
/**
|
|
80
|
+
* This is used with `use_beam_search` to prefer shorter or longer completions.
|
|
81
|
+
*/
|
|
82
|
+
length_penalty?: number;
|
|
83
|
+
/**
|
|
84
|
+
* Whether to return log probabilities of the output tokens or not. If true,
|
|
85
|
+
* returns the log probabilities of each output token returned in the `content` of
|
|
86
|
+
* `message`.
|
|
87
|
+
*/
|
|
88
|
+
logprobs?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Maximum number of completion tokens the model should generate.
|
|
91
|
+
*/
|
|
92
|
+
max_tokens?: number;
|
|
93
|
+
/**
|
|
94
|
+
* This is an alternative to `top_p` that
|
|
95
|
+
* [many prefer](https://github.com/huggingface/transformers/issues/27670). Must be
|
|
96
|
+
* in [0, 1].
|
|
97
|
+
*/
|
|
98
|
+
min_p?: number;
|
|
99
|
+
/**
|
|
100
|
+
* The language model to chat with.
|
|
101
|
+
*/
|
|
102
|
+
model?: string;
|
|
103
|
+
/**
|
|
104
|
+
* This will return multiple choices for you instead of a single chat completion.
|
|
105
|
+
*/
|
|
106
|
+
n?: number;
|
|
107
|
+
/**
|
|
108
|
+
* Higher values will penalize the model from repeating the same output tokens.
|
|
109
|
+
*/
|
|
110
|
+
presence_penalty?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Use this is you want to guarantee a JSON output without defining a schema. For
|
|
113
|
+
* control over the schema, use `guided_json`.
|
|
114
|
+
*/
|
|
115
|
+
response_format?: ChatCreateCompletionParams.ResponseFormat;
|
|
116
|
+
/**
|
|
117
|
+
* If specified, the system will make a best effort to sample deterministically,
|
|
118
|
+
* such that repeated requests with the same `seed` and parameters should return
|
|
119
|
+
* the same result.
|
|
120
|
+
*/
|
|
121
|
+
seed?: number;
|
|
122
|
+
/**
|
|
123
|
+
* Up to 4 sequences where the API will stop generating further tokens. The
|
|
124
|
+
* returned text will not contain the stop sequence.
|
|
125
|
+
*/
|
|
126
|
+
stop?: string | Array<string>;
|
|
127
|
+
/**
|
|
128
|
+
* Whether or not to stream data-only server-sent events as they become available.
|
|
129
|
+
*/
|
|
130
|
+
stream?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Adjusts the "creativity" of the model. Lower values make the model more
|
|
133
|
+
* deterministic and repetitive, while higher values make the model more random and
|
|
134
|
+
* creative.
|
|
135
|
+
*/
|
|
136
|
+
temperature?: number;
|
|
137
|
+
tool_choice?: 'none' | 'auto' | 'required';
|
|
138
|
+
/**
|
|
139
|
+
* The `function` tool type follows the same schema as the
|
|
140
|
+
* [OpenAI Chat Completions API](https://platform.openai.com/docs/api-reference/chat).
|
|
141
|
+
* The `retrieval` tool type is unique to Telnyx. You may pass a list of
|
|
142
|
+
* [embedded storage buckets](https://developers.telnyx.com/api-reference/embeddings/embed-documents)
|
|
143
|
+
* for retrieval-augmented generation.
|
|
144
|
+
*/
|
|
145
|
+
tools?: Array<ChatCreateCompletionParams.Function | ChatCreateCompletionParams.Retrieval>;
|
|
146
|
+
/**
|
|
147
|
+
* This is used with `logprobs`. An integer between 0 and 20 specifying the number
|
|
148
|
+
* of most likely tokens to return at each token position, each with an associated
|
|
149
|
+
* log probability.
|
|
150
|
+
*/
|
|
151
|
+
top_logprobs?: number;
|
|
152
|
+
/**
|
|
153
|
+
* An alternative or complement to `temperature`. This adjusts how many of the top
|
|
154
|
+
* possibilities to consider.
|
|
155
|
+
*/
|
|
156
|
+
top_p?: number;
|
|
157
|
+
/**
|
|
158
|
+
* Setting this to `true` will allow the model to
|
|
159
|
+
* [explore more completion options](https://huggingface.co/blog/how-to-generate#beam-search).
|
|
160
|
+
* This is not supported by OpenAI.
|
|
161
|
+
*/
|
|
162
|
+
use_beam_search?: boolean;
|
|
163
|
+
}
|
|
164
|
+
export declare namespace ChatCreateCompletionParams {
|
|
165
|
+
interface Message {
|
|
166
|
+
content: string | Array<Message.TextAndImageArray>;
|
|
167
|
+
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
168
|
+
}
|
|
169
|
+
namespace Message {
|
|
170
|
+
interface TextAndImageArray {
|
|
171
|
+
type: 'text' | 'image_url';
|
|
172
|
+
image_url?: string;
|
|
173
|
+
text?: string;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Use this is you want to guarantee a JSON output without defining a schema. For
|
|
178
|
+
* control over the schema, use `guided_json`.
|
|
179
|
+
*/
|
|
180
|
+
interface ResponseFormat {
|
|
181
|
+
type: 'text' | 'json_object';
|
|
182
|
+
}
|
|
183
|
+
interface Function {
|
|
184
|
+
function: Function.Function;
|
|
185
|
+
type: 'function';
|
|
186
|
+
}
|
|
187
|
+
namespace Function {
|
|
188
|
+
interface Function {
|
|
189
|
+
name: string;
|
|
190
|
+
description?: string;
|
|
191
|
+
parameters?: {
|
|
192
|
+
[key: string]: unknown;
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
interface Retrieval {
|
|
197
|
+
retrieval: ChatAPI.BucketIDs;
|
|
198
|
+
type: 'retrieval';
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
export declare namespace Chat {
|
|
202
|
+
export { type ChatCreateCompletionResponse as ChatCreateCompletionResponse, type ChatCreateCompletionParams as ChatCreateCompletionParams, };
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=chat.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.d.mts","sourceRoot":"","sources":["../../../src/resources/ai/openai/chat.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,OAAO;OACZ,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,IAAK,SAAQ,WAAW;IACnC;;;;;;;;;;;;;;;;;;;OA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GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;aAAE,CAAC;SACzC;KACF;IAED,UAAiB,SAAS;QACxB,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC;QAE7B,IAAI,EAAE,WAAW,CAAC;KACnB;CACF;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;CACH"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { APIResource } from "../../../core/resource.js";
|
|
2
|
+
import * as ChatAPI from "../chat.js";
|
|
3
|
+
import { APIPromise } from "../../../core/api-promise.js";
|
|
4
|
+
import { RequestOptions } from "../../../internal/request-options.js";
|
|
5
|
+
export declare class Chat extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Chat with a language model. This endpoint is consistent with the
|
|
8
|
+
* [OpenAI Chat Completions API](https://platform.openai.com/docs/api-reference/chat)
|
|
9
|
+
* and may be used with the OpenAI JS or Python SDK by setting the base URL to
|
|
10
|
+
* `https://api.telnyx.com/v2/ai/openai`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const response =
|
|
15
|
+
* await client.ai.openai.chat.createCompletion({
|
|
16
|
+
* messages: [
|
|
17
|
+
* {
|
|
18
|
+
* role: 'system',
|
|
19
|
+
* content: 'You are a friendly chatbot.',
|
|
20
|
+
* },
|
|
21
|
+
* { role: 'user', content: 'Hello, world!' },
|
|
22
|
+
* ],
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
createCompletion(body: ChatCreateCompletionParams, options?: RequestOptions): APIPromise<ChatCreateCompletionResponse>;
|
|
27
|
+
}
|
|
28
|
+
export type ChatCreateCompletionResponse = {
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
};
|
|
31
|
+
export interface ChatCreateCompletionParams {
|
|
32
|
+
/**
|
|
33
|
+
* A list of the previous chat messages for context.
|
|
34
|
+
*/
|
|
35
|
+
messages: Array<ChatCreateCompletionParams.Message>;
|
|
36
|
+
/**
|
|
37
|
+
* If you are using an external inference provider like xAI or OpenAI, this field
|
|
38
|
+
* allows you to pass along a reference to your API key. After creating an
|
|
39
|
+
* [integration secret](https://developers.telnyx.com/api-reference/integration-secrets/create-a-secret)
|
|
40
|
+
* for you API key, pass the secret's `identifier` in this field.
|
|
41
|
+
*/
|
|
42
|
+
api_key_ref?: string;
|
|
43
|
+
/**
|
|
44
|
+
* This is used with `use_beam_search` to determine how many candidate beams to
|
|
45
|
+
* explore.
|
|
46
|
+
*/
|
|
47
|
+
best_of?: number;
|
|
48
|
+
/**
|
|
49
|
+
* This is used with `use_beam_search`. If `true`, generation stops as soon as
|
|
50
|
+
* there are `best_of` complete candidates; if `false`, a heuristic is applied and
|
|
51
|
+
* the generation stops when is it very unlikely to find better candidates.
|
|
52
|
+
*/
|
|
53
|
+
early_stopping?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Whether to enable the thinking/reasoning phase for models that support it (e.g.,
|
|
56
|
+
* QwQ, Qwen3). When set to false, the model will skip the internal reasoning step
|
|
57
|
+
* and respond directly, which can reduce latency. Defaults to true.
|
|
58
|
+
*/
|
|
59
|
+
enable_thinking?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Higher values will penalize the model from repeating the same output tokens.
|
|
62
|
+
*/
|
|
63
|
+
frequency_penalty?: number;
|
|
64
|
+
/**
|
|
65
|
+
* If specified, the output will be exactly one of the choices.
|
|
66
|
+
*/
|
|
67
|
+
guided_choice?: Array<string>;
|
|
68
|
+
/**
|
|
69
|
+
* Must be a valid JSON schema. If specified, the output will follow the JSON
|
|
70
|
+
* schema.
|
|
71
|
+
*/
|
|
72
|
+
guided_json?: {
|
|
73
|
+
[key: string]: unknown;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* If specified, the output will follow the regex pattern.
|
|
77
|
+
*/
|
|
78
|
+
guided_regex?: string;
|
|
79
|
+
/**
|
|
80
|
+
* This is used with `use_beam_search` to prefer shorter or longer completions.
|
|
81
|
+
*/
|
|
82
|
+
length_penalty?: number;
|
|
83
|
+
/**
|
|
84
|
+
* Whether to return log probabilities of the output tokens or not. If true,
|
|
85
|
+
* returns the log probabilities of each output token returned in the `content` of
|
|
86
|
+
* `message`.
|
|
87
|
+
*/
|
|
88
|
+
logprobs?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Maximum number of completion tokens the model should generate.
|
|
91
|
+
*/
|
|
92
|
+
max_tokens?: number;
|
|
93
|
+
/**
|
|
94
|
+
* This is an alternative to `top_p` that
|
|
95
|
+
* [many prefer](https://github.com/huggingface/transformers/issues/27670). Must be
|
|
96
|
+
* in [0, 1].
|
|
97
|
+
*/
|
|
98
|
+
min_p?: number;
|
|
99
|
+
/**
|
|
100
|
+
* The language model to chat with.
|
|
101
|
+
*/
|
|
102
|
+
model?: string;
|
|
103
|
+
/**
|
|
104
|
+
* This will return multiple choices for you instead of a single chat completion.
|
|
105
|
+
*/
|
|
106
|
+
n?: number;
|
|
107
|
+
/**
|
|
108
|
+
* Higher values will penalize the model from repeating the same output tokens.
|
|
109
|
+
*/
|
|
110
|
+
presence_penalty?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Use this is you want to guarantee a JSON output without defining a schema. For
|
|
113
|
+
* control over the schema, use `guided_json`.
|
|
114
|
+
*/
|
|
115
|
+
response_format?: ChatCreateCompletionParams.ResponseFormat;
|
|
116
|
+
/**
|
|
117
|
+
* If specified, the system will make a best effort to sample deterministically,
|
|
118
|
+
* such that repeated requests with the same `seed` and parameters should return
|
|
119
|
+
* the same result.
|
|
120
|
+
*/
|
|
121
|
+
seed?: number;
|
|
122
|
+
/**
|
|
123
|
+
* Up to 4 sequences where the API will stop generating further tokens. The
|
|
124
|
+
* returned text will not contain the stop sequence.
|
|
125
|
+
*/
|
|
126
|
+
stop?: string | Array<string>;
|
|
127
|
+
/**
|
|
128
|
+
* Whether or not to stream data-only server-sent events as they become available.
|
|
129
|
+
*/
|
|
130
|
+
stream?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Adjusts the "creativity" of the model. Lower values make the model more
|
|
133
|
+
* deterministic and repetitive, while higher values make the model more random and
|
|
134
|
+
* creative.
|
|
135
|
+
*/
|
|
136
|
+
temperature?: number;
|
|
137
|
+
tool_choice?: 'none' | 'auto' | 'required';
|
|
138
|
+
/**
|
|
139
|
+
* The `function` tool type follows the same schema as the
|
|
140
|
+
* [OpenAI Chat Completions API](https://platform.openai.com/docs/api-reference/chat).
|
|
141
|
+
* The `retrieval` tool type is unique to Telnyx. You may pass a list of
|
|
142
|
+
* [embedded storage buckets](https://developers.telnyx.com/api-reference/embeddings/embed-documents)
|
|
143
|
+
* for retrieval-augmented generation.
|
|
144
|
+
*/
|
|
145
|
+
tools?: Array<ChatCreateCompletionParams.Function | ChatCreateCompletionParams.Retrieval>;
|
|
146
|
+
/**
|
|
147
|
+
* This is used with `logprobs`. An integer between 0 and 20 specifying the number
|
|
148
|
+
* of most likely tokens to return at each token position, each with an associated
|
|
149
|
+
* log probability.
|
|
150
|
+
*/
|
|
151
|
+
top_logprobs?: number;
|
|
152
|
+
/**
|
|
153
|
+
* An alternative or complement to `temperature`. This adjusts how many of the top
|
|
154
|
+
* possibilities to consider.
|
|
155
|
+
*/
|
|
156
|
+
top_p?: number;
|
|
157
|
+
/**
|
|
158
|
+
* Setting this to `true` will allow the model to
|
|
159
|
+
* [explore more completion options](https://huggingface.co/blog/how-to-generate#beam-search).
|
|
160
|
+
* This is not supported by OpenAI.
|
|
161
|
+
*/
|
|
162
|
+
use_beam_search?: boolean;
|
|
163
|
+
}
|
|
164
|
+
export declare namespace ChatCreateCompletionParams {
|
|
165
|
+
interface Message {
|
|
166
|
+
content: string | Array<Message.TextAndImageArray>;
|
|
167
|
+
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
168
|
+
}
|
|
169
|
+
namespace Message {
|
|
170
|
+
interface TextAndImageArray {
|
|
171
|
+
type: 'text' | 'image_url';
|
|
172
|
+
image_url?: string;
|
|
173
|
+
text?: string;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Use this is you want to guarantee a JSON output without defining a schema. For
|
|
178
|
+
* control over the schema, use `guided_json`.
|
|
179
|
+
*/
|
|
180
|
+
interface ResponseFormat {
|
|
181
|
+
type: 'text' | 'json_object';
|
|
182
|
+
}
|
|
183
|
+
interface Function {
|
|
184
|
+
function: Function.Function;
|
|
185
|
+
type: 'function';
|
|
186
|
+
}
|
|
187
|
+
namespace Function {
|
|
188
|
+
interface Function {
|
|
189
|
+
name: string;
|
|
190
|
+
description?: string;
|
|
191
|
+
parameters?: {
|
|
192
|
+
[key: string]: unknown;
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
interface Retrieval {
|
|
197
|
+
retrieval: ChatAPI.BucketIDs;
|
|
198
|
+
type: 'retrieval';
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
export declare namespace Chat {
|
|
202
|
+
export { type ChatCreateCompletionResponse as ChatCreateCompletionResponse, type ChatCreateCompletionParams as ChatCreateCompletionParams, };
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/resources/ai/openai/chat.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,OAAO;OACZ,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,IAAK,SAAQ,WAAW;IACnC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,gBAAgB,CACd,IAAI,EAAE,0BAA0B,EAChC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,4BAA4B,CAAC;CAG5C;AAED,MAAM,MAAM,4BAA4B,GAAG;IAAE,CAAC,G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ACF;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;CACH"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Chat = void 0;
|
|
5
|
+
const resource_1 = require("../../../core/resource.js");
|
|
6
|
+
class Chat extends resource_1.APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* Chat with a language model. This endpoint is consistent with the
|
|
9
|
+
* [OpenAI Chat Completions API](https://platform.openai.com/docs/api-reference/chat)
|
|
10
|
+
* and may be used with the OpenAI JS or Python SDK by setting the base URL to
|
|
11
|
+
* `https://api.telnyx.com/v2/ai/openai`.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const response =
|
|
16
|
+
* await client.ai.openai.chat.createCompletion({
|
|
17
|
+
* messages: [
|
|
18
|
+
* {
|
|
19
|
+
* role: 'system',
|
|
20
|
+
* content: 'You are a friendly chatbot.',
|
|
21
|
+
* },
|
|
22
|
+
* { role: 'user', content: 'Hello, world!' },
|
|
23
|
+
* ],
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
createCompletion(body, options) {
|
|
28
|
+
return this._client.post('/ai/openai/chat/completions', { body, ...options });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.Chat = Chat;
|
|
32
|
+
//# sourceMappingURL=chat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../../src/resources/ai/openai/chat.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wDAAqD;AAKrD,MAAa,IAAK,SAAQ,sBAAW;IACnC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,gBAAgB,CACd,IAAgC,EAChC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChF,CAAC;CACF;AA3BD,oBA2BC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../../core/resource.mjs";
|
|
3
|
+
export class Chat extends APIResource {
|
|
4
|
+
/**
|
|
5
|
+
* Chat with a language model. This endpoint is consistent with the
|
|
6
|
+
* [OpenAI Chat Completions API](https://platform.openai.com/docs/api-reference/chat)
|
|
7
|
+
* and may be used with the OpenAI JS or Python SDK by setting the base URL to
|
|
8
|
+
* `https://api.telnyx.com/v2/ai/openai`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const response =
|
|
13
|
+
* await client.ai.openai.chat.createCompletion({
|
|
14
|
+
* messages: [
|
|
15
|
+
* {
|
|
16
|
+
* role: 'system',
|
|
17
|
+
* content: 'You are a friendly chatbot.',
|
|
18
|
+
* },
|
|
19
|
+
* { role: 'user', content: 'Hello, world!' },
|
|
20
|
+
* ],
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
createCompletion(body, options) {
|
|
25
|
+
return this._client.post('/ai/openai/chat/completions', { body, ...options });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=chat.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.mjs","sourceRoot":"","sources":["../../../src/resources/ai/openai/chat.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAKtB,MAAM,OAAO,IAAK,SAAQ,WAAW;IACnC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,gBAAgB,CACd,IAAgC,EAChC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChF,CAAC;CACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { Chat, type ChatCreateCompletionResponse, type ChatCreateCompletionParams } from "./chat.mjs";
|
|
1
2
|
export { Embeddings, type EmbeddingCreateEmbeddingsResponse, type EmbeddingListEmbeddingModelsResponse, type EmbeddingCreateEmbeddingsParams, } from "./embeddings.mjs";
|
|
2
|
-
export { OpenAI } from "./openai.mjs";
|
|
3
|
+
export { OpenAI, type OpenAIListModelsResponse } from "./openai.mjs";
|
|
3
4
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/resources/ai/openai/index.ts"],"names":[],"mappings":"OAEO,EACL,UAAU,EACV,KAAK,iCAAiC,EACtC,KAAK,oCAAoC,EACzC,KAAK,+BAA+B,GACrC;OACM,EAAE,MAAM,EAAE"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/resources/ai/openai/index.ts"],"names":[],"mappings":"OAEO,EAAE,IAAI,EAAE,KAAK,4BAA4B,EAAE,KAAK,0BAA0B,EAAE;OAC5E,EACL,UAAU,EACV,KAAK,iCAAiC,EACtC,KAAK,oCAAoC,EACzC,KAAK,+BAA+B,GACrC;OACM,EAAE,MAAM,EAAE,KAAK,wBAAwB,EAAE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { Chat, type ChatCreateCompletionResponse, type ChatCreateCompletionParams } from "./chat.js";
|
|
1
2
|
export { Embeddings, type EmbeddingCreateEmbeddingsResponse, type EmbeddingListEmbeddingModelsResponse, type EmbeddingCreateEmbeddingsParams, } from "./embeddings.js";
|
|
2
|
-
export { OpenAI } from "./openai.js";
|
|
3
|
+
export { OpenAI, type OpenAIListModelsResponse } from "./openai.js";
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/ai/openai/index.ts"],"names":[],"mappings":"OAEO,EACL,UAAU,EACV,KAAK,iCAAiC,EACtC,KAAK,oCAAoC,EACzC,KAAK,+BAA+B,GACrC;OACM,EAAE,MAAM,EAAE"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/ai/openai/index.ts"],"names":[],"mappings":"OAEO,EAAE,IAAI,EAAE,KAAK,4BAA4B,EAAE,KAAK,0BAA0B,EAAE;OAC5E,EACL,UAAU,EACV,KAAK,iCAAiC,EACtC,KAAK,oCAAoC,EACzC,KAAK,+BAA+B,GACrC;OACM,EAAE,MAAM,EAAE,KAAK,wBAAwB,EAAE"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.OpenAI = exports.Embeddings = void 0;
|
|
4
|
+
exports.OpenAI = exports.Embeddings = exports.Chat = void 0;
|
|
5
|
+
var chat_1 = require("./chat.js");
|
|
6
|
+
Object.defineProperty(exports, "Chat", { enumerable: true, get: function () { return chat_1.Chat; } });
|
|
5
7
|
var embeddings_1 = require("./embeddings.js");
|
|
6
8
|
Object.defineProperty(exports, "Embeddings", { enumerable: true, get: function () { return embeddings_1.Embeddings; } });
|
|
7
9
|
var openai_1 = require("./openai.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/ai/openai/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,8CAKsB;AAJpB,wGAAA,UAAU,OAAA;AAKZ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/ai/openai/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kCAAkG;AAAzF,4FAAA,IAAI,OAAA;AACb,8CAKsB;AAJpB,wGAAA,UAAU,OAAA;AAKZ,sCAAiE;AAAxD,gGAAA,MAAM,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/resources/ai/openai/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,UAAU,GAIX;OACM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/resources/ai/openai/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,IAAI,EAAsE;OAC5E,EACL,UAAU,GAIX;OACM,EAAE,MAAM,EAAiC"}
|
|
@@ -1,10 +1,42 @@
|
|
|
1
1
|
import { APIResource } from "../../../core/resource.mjs";
|
|
2
|
+
import * as ChatAPI from "./chat.mjs";
|
|
3
|
+
import { Chat, ChatCreateCompletionParams, ChatCreateCompletionResponse } from "./chat.mjs";
|
|
2
4
|
import * as EmbeddingsAPI from "./embeddings.mjs";
|
|
3
5
|
import { EmbeddingCreateEmbeddingsParams, EmbeddingCreateEmbeddingsResponse, EmbeddingListEmbeddingModelsResponse, Embeddings } from "./embeddings.mjs";
|
|
6
|
+
import { APIPromise } from "../../../core/api-promise.mjs";
|
|
7
|
+
import { RequestOptions } from "../../../internal/request-options.mjs";
|
|
4
8
|
export declare class OpenAI extends APIResource {
|
|
5
9
|
embeddings: EmbeddingsAPI.Embeddings;
|
|
10
|
+
chat: ChatAPI.Chat;
|
|
11
|
+
/**
|
|
12
|
+
* This endpoint returns a list of Open Source and OpenAI models that are available
|
|
13
|
+
* for use. <br /><br /> **Note**: Model `id`'s will be in the form
|
|
14
|
+
* `{source}/{model_name}`. For example `openai/gpt-4` or
|
|
15
|
+
* `mistralai/Mistral-7B-Instruct-v0.1` consistent with HuggingFace naming
|
|
16
|
+
* conventions.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const response = await client.ai.openai.listModels();
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
listModels(options?: RequestOptions): APIPromise<OpenAIListModelsResponse>;
|
|
24
|
+
}
|
|
25
|
+
export interface OpenAIListModelsResponse {
|
|
26
|
+
data: Array<OpenAIListModelsResponse.Data>;
|
|
27
|
+
object?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare namespace OpenAIListModelsResponse {
|
|
30
|
+
interface Data {
|
|
31
|
+
id: string;
|
|
32
|
+
created: number;
|
|
33
|
+
owned_by: string;
|
|
34
|
+
object?: string;
|
|
35
|
+
}
|
|
6
36
|
}
|
|
7
37
|
export declare namespace OpenAI {
|
|
38
|
+
export { type OpenAIListModelsResponse as OpenAIListModelsResponse };
|
|
8
39
|
export { Embeddings as Embeddings, type EmbeddingCreateEmbeddingsResponse as EmbeddingCreateEmbeddingsResponse, type EmbeddingListEmbeddingModelsResponse as EmbeddingListEmbeddingModelsResponse, type EmbeddingCreateEmbeddingsParams as EmbeddingCreateEmbeddingsParams, };
|
|
40
|
+
export { Chat as Chat, type ChatCreateCompletionResponse as ChatCreateCompletionResponse, type ChatCreateCompletionParams as ChatCreateCompletionParams, };
|
|
9
41
|
}
|
|
10
42
|
//# sourceMappingURL=openai.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.d.mts","sourceRoot":"","sources":["../../../src/resources/ai/openai/openai.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,aAAa;OAClB,EACL,+BAA+B,EAC/B,iCAAiC,EACjC,oCAAoC,EACpC,UAAU,EACX;
|
|
1
|
+
{"version":3,"file":"openai.d.mts","sourceRoot":"","sources":["../../../src/resources/ai/openai/openai.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,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chat, ChatCreateCompletionParams, ChatCreateCompletionResponse } from "./chat.js";
|
|
2
4
|
import * as EmbeddingsAPI from "./embeddings.js";
|
|
3
5
|
import { EmbeddingCreateEmbeddingsParams, EmbeddingCreateEmbeddingsResponse, EmbeddingListEmbeddingModelsResponse, Embeddings } from "./embeddings.js";
|
|
6
|
+
import { APIPromise } from "../../../core/api-promise.js";
|
|
7
|
+
import { RequestOptions } from "../../../internal/request-options.js";
|
|
4
8
|
export declare class OpenAI extends APIResource {
|
|
5
9
|
embeddings: EmbeddingsAPI.Embeddings;
|
|
10
|
+
chat: ChatAPI.Chat;
|
|
11
|
+
/**
|
|
12
|
+
* This endpoint returns a list of Open Source and OpenAI models that are available
|
|
13
|
+
* for use. <br /><br /> **Note**: Model `id`'s will be in the form
|
|
14
|
+
* `{source}/{model_name}`. For example `openai/gpt-4` or
|
|
15
|
+
* `mistralai/Mistral-7B-Instruct-v0.1` consistent with HuggingFace naming
|
|
16
|
+
* conventions.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const response = await client.ai.openai.listModels();
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
listModels(options?: RequestOptions): APIPromise<OpenAIListModelsResponse>;
|
|
24
|
+
}
|
|
25
|
+
export interface OpenAIListModelsResponse {
|
|
26
|
+
data: Array<OpenAIListModelsResponse.Data>;
|
|
27
|
+
object?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare namespace OpenAIListModelsResponse {
|
|
30
|
+
interface Data {
|
|
31
|
+
id: string;
|
|
32
|
+
created: number;
|
|
33
|
+
owned_by: string;
|
|
34
|
+
object?: string;
|
|
35
|
+
}
|
|
6
36
|
}
|
|
7
37
|
export declare namespace OpenAI {
|
|
38
|
+
export { type OpenAIListModelsResponse as OpenAIListModelsResponse };
|
|
8
39
|
export { Embeddings as Embeddings, type EmbeddingCreateEmbeddingsResponse as EmbeddingCreateEmbeddingsResponse, type EmbeddingListEmbeddingModelsResponse as EmbeddingListEmbeddingModelsResponse, type EmbeddingCreateEmbeddingsParams as EmbeddingCreateEmbeddingsParams, };
|
|
40
|
+
export { Chat as Chat, type ChatCreateCompletionResponse as ChatCreateCompletionResponse, type ChatCreateCompletionParams as ChatCreateCompletionParams, };
|
|
9
41
|
}
|
|
10
42
|
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/resources/ai/openai/openai.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,aAAa;OAClB,EACL,+BAA+B,EAC/B,iCAAiC,EACjC,oCAAoC,EACpC,UAAU,EACX;
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/resources/ai/openai/openai.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,OAAO;OACZ,EAAE,IAAI,EAAE,0BAA0B,EAAE,4BAA4B,EAAE;OAClE,KAAK,aAAa;OAClB,EACL,+BAA+B,EAC/B,iCAAiC,EACjC,oCAAoC,EACpC,UAAU,EACX;OACM,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,MAAO,SAAQ,WAAW;IACrC,UAAU,EAAE,aAAa,CAAC,UAAU,CAA8C;IAClF,IAAI,EAAE,OAAO,CAAC,IAAI,CAAkC;IAEpD;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,wBAAwB,CAAC;CAG3E;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,KAAK,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAE3C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,yBAAiB,wBAAwB,CAAC;IACxC,UAAiB,IAAI;QACnB,EAAE,EAAE,MAAM,CAAC;QAEX,OAAO,EAAE,MAAM,CAAC;QAEhB,QAAQ,E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