telnyx 7.7.0 → 7.9.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 +17 -0
- package/client.d.mts +9 -6
- package/client.d.mts.map +1 -1
- package/client.d.ts +9 -6
- package/client.d.ts.map +1 -1
- package/client.js +3 -0
- package/client.js.map +1 -1
- package/client.mjs +3 -0
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/ai/ai.d.mts +9 -38
- package/resources/ai/ai.d.mts.map +1 -1
- package/resources/ai/ai.d.ts +9 -38
- package/resources/ai/ai.d.ts.map +1 -1
- package/resources/ai/ai.js +4 -30
- package/resources/ai/ai.js.map +1 -1
- package/resources/ai/ai.mjs +5 -31
- package/resources/ai/ai.mjs.map +1 -1
- package/resources/ai/anthropic/anthropic.d.mts +10 -0
- package/resources/ai/anthropic/anthropic.d.mts.map +1 -0
- package/resources/ai/anthropic/anthropic.d.ts +10 -0
- package/resources/ai/anthropic/anthropic.d.ts.map +1 -0
- package/resources/ai/anthropic/anthropic.js +17 -0
- package/resources/ai/anthropic/anthropic.js.map +1 -0
- package/resources/ai/anthropic/anthropic.mjs +12 -0
- package/resources/ai/anthropic/anthropic.mjs.map +1 -0
- package/resources/ai/anthropic/index.d.mts +3 -0
- package/resources/ai/anthropic/index.d.mts.map +1 -0
- package/resources/ai/anthropic/index.d.ts +3 -0
- package/resources/ai/anthropic/index.d.ts.map +1 -0
- package/resources/ai/anthropic/index.js +9 -0
- package/resources/ai/anthropic/index.js.map +1 -0
- package/resources/ai/anthropic/index.mjs +4 -0
- package/resources/ai/anthropic/index.mjs.map +1 -0
- package/resources/ai/anthropic/v1.d.mts +148 -0
- package/resources/ai/anthropic/v1.d.mts.map +1 -0
- package/resources/ai/anthropic/v1.d.ts +148 -0
- package/resources/ai/anthropic/v1.d.ts.map +1 -0
- package/resources/ai/anthropic/v1.js +35 -0
- package/resources/ai/anthropic/v1.js.map +1 -0
- package/resources/ai/anthropic/v1.mjs +31 -0
- package/resources/ai/anthropic/v1.mjs.map +1 -0
- package/resources/ai/anthropic.d.mts +2 -0
- package/resources/ai/anthropic.d.mts.map +1 -0
- package/resources/ai/anthropic.d.ts +2 -0
- package/resources/ai/anthropic.d.ts.map +1 -0
- package/resources/ai/anthropic.js +6 -0
- package/resources/ai/anthropic.js.map +1 -0
- package/resources/ai/anthropic.mjs +3 -0
- package/resources/ai/anthropic.mjs.map +1 -0
- package/resources/ai/assistants/assistants.d.mts +58 -5
- package/resources/ai/assistants/assistants.d.mts.map +1 -1
- package/resources/ai/assistants/assistants.d.ts +58 -5
- package/resources/ai/assistants/assistants.d.ts.map +1 -1
- package/resources/ai/assistants/assistants.js +2 -2
- package/resources/ai/assistants/assistants.js.map +1 -1
- package/resources/ai/assistants/assistants.mjs +2 -2
- package/resources/ai/assistants/assistants.mjs.map +1 -1
- package/resources/ai/chat.d.mts +1 -188
- package/resources/ai/chat.d.mts.map +1 -1
- package/resources/ai/chat.d.ts +1 -188
- package/resources/ai/chat.d.ts.map +1 -1
- package/resources/ai/chat.js +0 -14
- package/resources/ai/chat.js.map +1 -1
- package/resources/ai/chat.mjs +0 -14
- package/resources/ai/chat.mjs.map +1 -1
- package/resources/ai/conversations/conversation-insights.d.mts +105 -0
- package/resources/ai/conversations/conversation-insights.d.mts.map +1 -0
- package/resources/ai/conversations/conversation-insights.d.ts +105 -0
- package/resources/ai/conversations/conversation-insights.d.ts.map +1 -0
- package/resources/ai/conversations/conversation-insights.js +24 -0
- package/resources/ai/conversations/conversation-insights.js.map +1 -0
- package/resources/ai/conversations/conversation-insights.mjs +20 -0
- package/resources/ai/conversations/conversation-insights.mjs.map +1 -0
- package/resources/ai/conversations/conversations.d.mts +4 -0
- package/resources/ai/conversations/conversations.d.mts.map +1 -1
- package/resources/ai/conversations/conversations.d.ts +4 -0
- package/resources/ai/conversations/conversations.d.ts.map +1 -1
- package/resources/ai/conversations/conversations.js +4 -0
- package/resources/ai/conversations/conversations.js.map +1 -1
- package/resources/ai/conversations/conversations.mjs +4 -0
- package/resources/ai/conversations/conversations.mjs.map +1 -1
- package/resources/ai/conversations/index.d.mts +1 -0
- package/resources/ai/conversations/index.d.mts.map +1 -1
- package/resources/ai/conversations/index.d.ts +1 -0
- package/resources/ai/conversations/index.d.ts.map +1 -1
- package/resources/ai/conversations/index.js +3 -1
- package/resources/ai/conversations/index.js.map +1 -1
- package/resources/ai/conversations/index.mjs +1 -0
- package/resources/ai/conversations/index.mjs.map +1 -1
- package/resources/ai/index.d.mts +4 -3
- package/resources/ai/index.d.mts.map +1 -1
- package/resources/ai/index.d.ts +4 -3
- package/resources/ai/index.d.ts.map +1 -1
- package/resources/ai/index.js +17 -15
- package/resources/ai/index.js.map +1 -1
- package/resources/ai/index.mjs +2 -1
- package/resources/ai/index.mjs.map +1 -1
- package/resources/ai/tools.d.mts +28 -1
- package/resources/ai/tools.d.mts.map +1 -1
- package/resources/ai/tools.d.ts +28 -1
- package/resources/ai/tools.d.ts.map +1 -1
- package/resources/calls/actions.d.mts +31 -5
- package/resources/calls/actions.d.mts.map +1 -1
- package/resources/calls/actions.d.ts +31 -5
- package/resources/calls/actions.d.ts.map +1 -1
- package/resources/calls/calls.d.mts +11 -0
- package/resources/calls/calls.d.mts.map +1 -1
- package/resources/calls/calls.d.ts +11 -0
- package/resources/calls/calls.d.ts.map +1 -1
- package/resources/calls/calls.js.map +1 -1
- package/resources/calls/calls.mjs.map +1 -1
- package/resources/conferences/actions.d.mts +6 -0
- package/resources/conferences/actions.d.mts.map +1 -1
- package/resources/conferences/actions.d.ts +6 -0
- package/resources/conferences/actions.d.ts.map +1 -1
- package/resources/index.d.mts +3 -3
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -3
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/managed-accounts/managed-accounts.d.mts +11 -2
- package/resources/managed-accounts/managed-accounts.d.mts.map +1 -1
- package/resources/managed-accounts/managed-accounts.d.ts +11 -2
- package/resources/managed-accounts/managed-accounts.d.ts.map +1 -1
- package/resources/managed-accounts/managed-accounts.js.map +1 -1
- package/resources/managed-accounts/managed-accounts.mjs.map +1 -1
- package/resources/messages/index.d.mts +1 -1
- package/resources/messages/index.d.mts.map +1 -1
- package/resources/messages/index.d.ts +1 -1
- package/resources/messages/index.d.ts.map +1 -1
- package/resources/messages/index.js.map +1 -1
- package/resources/messages/index.mjs.map +1 -1
- package/resources/messages/messages.d.mts +4 -82
- package/resources/messages/messages.d.mts.map +1 -1
- package/resources/messages/messages.d.ts +4 -82
- package/resources/messages/messages.d.ts.map +1 -1
- package/resources/messages/messages.js +3 -15
- package/resources/messages/messages.js.map +1 -1
- package/resources/messages/messages.mjs +3 -15
- package/resources/messages/messages.mjs.map +1 -1
- package/resources/phone-numbers/phone-numbers.d.mts +21 -0
- package/resources/phone-numbers/phone-numbers.d.mts.map +1 -1
- package/resources/phone-numbers/phone-numbers.d.ts +21 -0
- package/resources/phone-numbers/phone-numbers.d.ts.map +1 -1
- package/resources/phone-numbers/phone-numbers.js.map +1 -1
- package/resources/phone-numbers/phone-numbers.mjs.map +1 -1
- package/resources/requirements.d.mts +28 -3
- package/resources/requirements.d.mts.map +1 -1
- package/resources/requirements.d.ts +28 -3
- package/resources/requirements.d.ts.map +1 -1
- package/resources/requirements.js +2 -2
- package/resources/requirements.js.map +1 -1
- package/resources/requirements.mjs +2 -2
- package/resources/requirements.mjs.map +1 -1
- package/resources/speech-to-text/speech-to-text.d.mts +1 -1
- package/resources/speech-to-text/speech-to-text.d.mts.map +1 -1
- package/resources/speech-to-text/speech-to-text.d.ts +1 -1
- package/resources/speech-to-text/speech-to-text.d.ts.map +1 -1
- package/resources/storage/cloudfs/actions.d.mts +43 -0
- package/resources/storage/cloudfs/actions.d.mts.map +1 -0
- package/resources/storage/cloudfs/actions.d.ts +43 -0
- package/resources/storage/cloudfs/actions.d.ts.map +1 -0
- package/resources/storage/cloudfs/actions.js +39 -0
- package/resources/storage/cloudfs/actions.js.map +1 -0
- package/resources/storage/cloudfs/actions.mjs +35 -0
- package/resources/storage/cloudfs/actions.mjs.map +1 -0
- package/resources/storage/cloudfs/cloudfs.d.mts +345 -0
- package/resources/storage/cloudfs/cloudfs.d.mts.map +1 -0
- package/resources/storage/cloudfs/cloudfs.d.ts +345 -0
- package/resources/storage/cloudfs/cloudfs.d.ts.map +1 -0
- package/resources/storage/cloudfs/cloudfs.js +116 -0
- package/resources/storage/cloudfs/cloudfs.js.map +1 -0
- package/resources/storage/cloudfs/cloudfs.mjs +111 -0
- package/resources/storage/cloudfs/cloudfs.mjs.map +1 -0
- package/resources/storage/cloudfs/index.d.mts +3 -0
- package/resources/storage/cloudfs/index.d.mts.map +1 -0
- package/resources/storage/cloudfs/index.d.ts +3 -0
- package/resources/storage/cloudfs/index.d.ts.map +1 -0
- package/resources/storage/cloudfs/index.js +9 -0
- package/resources/storage/cloudfs/index.js.map +1 -0
- package/resources/storage/cloudfs/index.mjs +4 -0
- package/resources/storage/cloudfs/index.mjs.map +1 -0
- package/resources/storage/cloudfs.d.mts +2 -0
- package/resources/storage/cloudfs.d.mts.map +1 -0
- package/resources/storage/cloudfs.d.ts +2 -0
- package/resources/storage/cloudfs.d.ts.map +1 -0
- package/resources/storage/cloudfs.js +6 -0
- package/resources/storage/cloudfs.js.map +1 -0
- package/resources/storage/cloudfs.mjs +3 -0
- package/resources/storage/cloudfs.mjs.map +1 -0
- package/resources/storage/index.d.mts +1 -0
- package/resources/storage/index.d.mts.map +1 -1
- package/resources/storage/index.d.ts +1 -0
- package/resources/storage/index.d.ts.map +1 -1
- package/resources/storage/index.js +7 -5
- package/resources/storage/index.js.map +1 -1
- package/resources/storage/index.mjs +1 -0
- package/resources/storage/index.mjs.map +1 -1
- package/resources/storage/storage.d.mts +4 -0
- package/resources/storage/storage.d.mts.map +1 -1
- package/resources/storage/storage.d.ts +4 -0
- package/resources/storage/storage.d.ts.map +1 -1
- package/resources/storage/storage.js +4 -0
- package/resources/storage/storage.js.map +1 -1
- package/resources/storage/storage.mjs +4 -0
- package/resources/storage/storage.mjs.map +1 -1
- package/resources/text-to-speech/text-to-speech.d.mts +16 -11
- package/resources/text-to-speech/text-to-speech.d.mts.map +1 -1
- package/resources/text-to-speech/text-to-speech.d.ts +16 -11
- package/resources/text-to-speech/text-to-speech.d.ts.map +1 -1
- package/resources/verify-profiles.d.mts +3 -3
- package/resources/verify-profiles.d.ts +3 -3
- package/resources/webhooks.d.mts +125 -19
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +125 -19
- package/resources/webhooks.d.ts.map +1 -1
- package/src/client.ts +5 -8
- package/src/resources/ai/ai.ts +10 -57
- package/src/resources/ai/anthropic/anthropic.ts +19 -0
- package/src/resources/ai/anthropic/index.ts +4 -0
- package/src/resources/ai/anthropic/v1.ts +157 -0
- package/src/resources/ai/anthropic.ts +3 -0
- package/src/resources/ai/assistants/assistants.ts +68 -5
- package/src/resources/ai/chat.ts +2 -234
- package/src/resources/ai/conversations/conversation-insights.ts +125 -0
- package/src/resources/ai/conversations/conversations.ts +15 -0
- package/src/resources/ai/conversations/index.ts +5 -0
- package/src/resources/ai/index.ts +3 -9
- package/src/resources/ai/tools.ts +32 -0
- package/src/resources/calls/actions.ts +31 -5
- package/src/resources/calls/calls.ts +12 -0
- package/src/resources/conferences/actions.ts +6 -0
- package/src/resources/index.ts +1 -4
- package/src/resources/managed-accounts/managed-accounts.ts +13 -2
- package/src/resources/messages/index.ts +0 -2
- package/src/resources/messages/messages.ts +3 -112
- package/src/resources/phone-numbers/phone-numbers.ts +24 -0
- package/src/resources/requirements.ts +38 -3
- package/src/resources/speech-to-text/speech-to-text.ts +1 -1
- package/src/resources/storage/cloudfs/actions.ts +59 -0
- package/src/resources/storage/cloudfs/cloudfs.ts +446 -0
- package/src/resources/storage/cloudfs/index.ts +13 -0
- package/src/resources/storage/cloudfs.ts +3 -0
- package/src/resources/storage/index.ts +10 -0
- package/src/resources/storage/storage.ts +24 -0
- package/src/resources/text-to-speech/text-to-speech.ts +16 -11
- package/src/resources/verify-profiles.ts +3 -3
- package/src/resources/webhooks.ts +152 -11
- 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
package/resources/ai/chat.d.mts
CHANGED
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
import { APIResource } from "../../core/resource.mjs";
|
|
2
2
|
import * as ChatAPI from "./chat.mjs";
|
|
3
|
-
import { APIPromise } from "../../core/api-promise.mjs";
|
|
4
|
-
import { RequestOptions } from "../../internal/request-options.mjs";
|
|
5
|
-
/**
|
|
6
|
-
* Generate text with LLMs
|
|
7
|
-
*/
|
|
8
3
|
export declare class Chat extends APIResource {
|
|
9
|
-
/**
|
|
10
|
-
* **Deprecated**: Use `POST /v2/ai/openai/chat/completions` instead. Chat with a
|
|
11
|
-
* language model. This endpoint is consistent with the
|
|
12
|
-
* [OpenAI Chat Completions API](https://platform.openai.com/docs/api-reference/chat)
|
|
13
|
-
* and may be used with the OpenAI JS or Python SDK.
|
|
14
|
-
*
|
|
15
|
-
* @deprecated
|
|
16
|
-
*/
|
|
17
|
-
createCompletion(body: ChatCreateCompletionParams, options?: RequestOptions): APIPromise<ChatCreateCompletionResponse>;
|
|
18
4
|
}
|
|
19
5
|
export interface BucketIDs {
|
|
20
6
|
/**
|
|
@@ -198,180 +184,7 @@ export declare namespace ChatCompletionRequest {
|
|
|
198
184
|
type: 'retrieval';
|
|
199
185
|
}
|
|
200
186
|
}
|
|
201
|
-
export type ChatCreateCompletionResponse = {
|
|
202
|
-
[key: string]: unknown;
|
|
203
|
-
};
|
|
204
|
-
export interface ChatCreateCompletionParams {
|
|
205
|
-
/**
|
|
206
|
-
* A list of the previous chat messages for context.
|
|
207
|
-
*/
|
|
208
|
-
messages: Array<ChatCreateCompletionParams.Message>;
|
|
209
|
-
/**
|
|
210
|
-
* If you are using an external inference provider like xAI or OpenAI, this field
|
|
211
|
-
* allows you to pass along a reference to your API key. After creating an
|
|
212
|
-
* [integration secret](https://developers.telnyx.com/api-reference/integration-secrets/create-a-secret)
|
|
213
|
-
* for you API key, pass the secret's `identifier` in this field.
|
|
214
|
-
*/
|
|
215
|
-
api_key_ref?: string;
|
|
216
|
-
/**
|
|
217
|
-
* This is used with `use_beam_search` to determine how many candidate beams to
|
|
218
|
-
* explore.
|
|
219
|
-
*/
|
|
220
|
-
best_of?: number;
|
|
221
|
-
/**
|
|
222
|
-
* This is used with `use_beam_search`. If `true`, generation stops as soon as
|
|
223
|
-
* there are `best_of` complete candidates; if `false`, a heuristic is applied and
|
|
224
|
-
* the generation stops when is it very unlikely to find better candidates.
|
|
225
|
-
*/
|
|
226
|
-
early_stopping?: boolean;
|
|
227
|
-
/**
|
|
228
|
-
* Whether to enable the thinking/reasoning phase for models that support it (e.g.,
|
|
229
|
-
* QwQ, Qwen3). When set to false, the model will skip the internal reasoning step
|
|
230
|
-
* and respond directly, which can reduce latency. Defaults to true.
|
|
231
|
-
*/
|
|
232
|
-
enable_thinking?: boolean;
|
|
233
|
-
/**
|
|
234
|
-
* Higher values will penalize the model from repeating the same output tokens.
|
|
235
|
-
*/
|
|
236
|
-
frequency_penalty?: number;
|
|
237
|
-
/**
|
|
238
|
-
* If specified, the output will be exactly one of the choices.
|
|
239
|
-
*/
|
|
240
|
-
guided_choice?: Array<string>;
|
|
241
|
-
/**
|
|
242
|
-
* Must be a valid JSON schema. If specified, the output will follow the JSON
|
|
243
|
-
* schema.
|
|
244
|
-
*/
|
|
245
|
-
guided_json?: {
|
|
246
|
-
[key: string]: unknown;
|
|
247
|
-
};
|
|
248
|
-
/**
|
|
249
|
-
* If specified, the output will follow the regex pattern.
|
|
250
|
-
*/
|
|
251
|
-
guided_regex?: string;
|
|
252
|
-
/**
|
|
253
|
-
* This is used with `use_beam_search` to prefer shorter or longer completions.
|
|
254
|
-
*/
|
|
255
|
-
length_penalty?: number;
|
|
256
|
-
/**
|
|
257
|
-
* Whether to return log probabilities of the output tokens or not. If true,
|
|
258
|
-
* returns the log probabilities of each output token returned in the `content` of
|
|
259
|
-
* `message`.
|
|
260
|
-
*/
|
|
261
|
-
logprobs?: boolean;
|
|
262
|
-
/**
|
|
263
|
-
* Maximum number of completion tokens the model should generate.
|
|
264
|
-
*/
|
|
265
|
-
max_tokens?: number;
|
|
266
|
-
/**
|
|
267
|
-
* This is an alternative to `top_p` that
|
|
268
|
-
* [many prefer](https://github.com/huggingface/transformers/issues/27670). Must be
|
|
269
|
-
* in [0, 1].
|
|
270
|
-
*/
|
|
271
|
-
min_p?: number;
|
|
272
|
-
/**
|
|
273
|
-
* The language model to chat with.
|
|
274
|
-
*/
|
|
275
|
-
model?: string;
|
|
276
|
-
/**
|
|
277
|
-
* This will return multiple choices for you instead of a single chat completion.
|
|
278
|
-
*/
|
|
279
|
-
n?: number;
|
|
280
|
-
/**
|
|
281
|
-
* Higher values will penalize the model from repeating the same output tokens.
|
|
282
|
-
*/
|
|
283
|
-
presence_penalty?: number;
|
|
284
|
-
/**
|
|
285
|
-
* Use this is you want to guarantee a JSON output without defining a schema. For
|
|
286
|
-
* control over the schema, use `guided_json`.
|
|
287
|
-
*/
|
|
288
|
-
response_format?: ChatCreateCompletionParams.ResponseFormat;
|
|
289
|
-
/**
|
|
290
|
-
* If specified, the system will make a best effort to sample deterministically,
|
|
291
|
-
* such that repeated requests with the same `seed` and parameters should return
|
|
292
|
-
* the same result.
|
|
293
|
-
*/
|
|
294
|
-
seed?: number;
|
|
295
|
-
/**
|
|
296
|
-
* Up to 4 sequences where the API will stop generating further tokens. The
|
|
297
|
-
* returned text will not contain the stop sequence.
|
|
298
|
-
*/
|
|
299
|
-
stop?: string | Array<string>;
|
|
300
|
-
/**
|
|
301
|
-
* Whether or not to stream data-only server-sent events as they become available.
|
|
302
|
-
*/
|
|
303
|
-
stream?: boolean;
|
|
304
|
-
/**
|
|
305
|
-
* Adjusts the "creativity" of the model. Lower values make the model more
|
|
306
|
-
* deterministic and repetitive, while higher values make the model more random and
|
|
307
|
-
* creative.
|
|
308
|
-
*/
|
|
309
|
-
temperature?: number;
|
|
310
|
-
tool_choice?: 'none' | 'auto' | 'required';
|
|
311
|
-
/**
|
|
312
|
-
* The `function` tool type follows the same schema as the
|
|
313
|
-
* [OpenAI Chat Completions API](https://platform.openai.com/docs/api-reference/chat).
|
|
314
|
-
* The `retrieval` tool type is unique to Telnyx. You may pass a list of
|
|
315
|
-
* [embedded storage buckets](https://developers.telnyx.com/api-reference/embeddings/embed-documents)
|
|
316
|
-
* for retrieval-augmented generation.
|
|
317
|
-
*/
|
|
318
|
-
tools?: Array<ChatCreateCompletionParams.Function | ChatCreateCompletionParams.Retrieval>;
|
|
319
|
-
/**
|
|
320
|
-
* This is used with `logprobs`. An integer between 0 and 20 specifying the number
|
|
321
|
-
* of most likely tokens to return at each token position, each with an associated
|
|
322
|
-
* log probability.
|
|
323
|
-
*/
|
|
324
|
-
top_logprobs?: number;
|
|
325
|
-
/**
|
|
326
|
-
* An alternative or complement to `temperature`. This adjusts how many of the top
|
|
327
|
-
* possibilities to consider.
|
|
328
|
-
*/
|
|
329
|
-
top_p?: number;
|
|
330
|
-
/**
|
|
331
|
-
* Setting this to `true` will allow the model to
|
|
332
|
-
* [explore more completion options](https://huggingface.co/blog/how-to-generate#beam-search).
|
|
333
|
-
* This is not supported by OpenAI.
|
|
334
|
-
*/
|
|
335
|
-
use_beam_search?: boolean;
|
|
336
|
-
}
|
|
337
|
-
export declare namespace ChatCreateCompletionParams {
|
|
338
|
-
interface Message {
|
|
339
|
-
content: string | Array<Message.TextAndImageArray>;
|
|
340
|
-
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
341
|
-
}
|
|
342
|
-
namespace Message {
|
|
343
|
-
interface TextAndImageArray {
|
|
344
|
-
type: 'text' | 'image_url';
|
|
345
|
-
image_url?: string;
|
|
346
|
-
text?: string;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Use this is you want to guarantee a JSON output without defining a schema. For
|
|
351
|
-
* control over the schema, use `guided_json`.
|
|
352
|
-
*/
|
|
353
|
-
interface ResponseFormat {
|
|
354
|
-
type: 'text' | 'json_object';
|
|
355
|
-
}
|
|
356
|
-
interface Function {
|
|
357
|
-
function: Function.Function;
|
|
358
|
-
type: 'function';
|
|
359
|
-
}
|
|
360
|
-
namespace Function {
|
|
361
|
-
interface Function {
|
|
362
|
-
name: string;
|
|
363
|
-
description?: string;
|
|
364
|
-
parameters?: {
|
|
365
|
-
[key: string]: unknown;
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
interface Retrieval {
|
|
370
|
-
retrieval: ChatAPI.BucketIDs;
|
|
371
|
-
type: 'retrieval';
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
187
|
export declare namespace Chat {
|
|
375
|
-
export { type BucketIDs as BucketIDs, type ChatCompletionRequest as ChatCompletionRequest
|
|
188
|
+
export { type BucketIDs as BucketIDs, type ChatCompletionRequest as ChatCompletionRequest };
|
|
376
189
|
}
|
|
377
190
|
//# sourceMappingURL=chat.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.mts","sourceRoot":"","sources":["../../src/resources/ai/chat.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAClD,OAAO,KAAK,OAAO,mBAAe;
|
|
1
|
+
{"version":3,"file":"chat.d.mts","sourceRoot":"","sources":["../../src/resources/ai/chat.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAClD,OAAO,KAAK,OAAO,mBAAe;AAElC,qBAAa,IAAK,SAAQ,WAAW;CAAG;AAExC,MAAM,WAAW,SAAS;IACxB;;;;OAIG;IACH,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAE1B;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,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E,KAAK,SAAS,IAAI,SAAS,EAAE,KAAK,qBAAqB,IAAI,qBAAqB,EAAE,CAAC;CAC7F"}
|
package/resources/ai/chat.d.ts
CHANGED
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
import { APIResource } from "../../core/resource.js";
|
|
2
2
|
import * as ChatAPI from "./chat.js";
|
|
3
|
-
import { APIPromise } from "../../core/api-promise.js";
|
|
4
|
-
import { RequestOptions } from "../../internal/request-options.js";
|
|
5
|
-
/**
|
|
6
|
-
* Generate text with LLMs
|
|
7
|
-
*/
|
|
8
3
|
export declare class Chat extends APIResource {
|
|
9
|
-
/**
|
|
10
|
-
* **Deprecated**: Use `POST /v2/ai/openai/chat/completions` instead. Chat with a
|
|
11
|
-
* language model. This endpoint is consistent with the
|
|
12
|
-
* [OpenAI Chat Completions API](https://platform.openai.com/docs/api-reference/chat)
|
|
13
|
-
* and may be used with the OpenAI JS or Python SDK.
|
|
14
|
-
*
|
|
15
|
-
* @deprecated
|
|
16
|
-
*/
|
|
17
|
-
createCompletion(body: ChatCreateCompletionParams, options?: RequestOptions): APIPromise<ChatCreateCompletionResponse>;
|
|
18
4
|
}
|
|
19
5
|
export interface BucketIDs {
|
|
20
6
|
/**
|
|
@@ -198,180 +184,7 @@ export declare namespace ChatCompletionRequest {
|
|
|
198
184
|
type: 'retrieval';
|
|
199
185
|
}
|
|
200
186
|
}
|
|
201
|
-
export type ChatCreateCompletionResponse = {
|
|
202
|
-
[key: string]: unknown;
|
|
203
|
-
};
|
|
204
|
-
export interface ChatCreateCompletionParams {
|
|
205
|
-
/**
|
|
206
|
-
* A list of the previous chat messages for context.
|
|
207
|
-
*/
|
|
208
|
-
messages: Array<ChatCreateCompletionParams.Message>;
|
|
209
|
-
/**
|
|
210
|
-
* If you are using an external inference provider like xAI or OpenAI, this field
|
|
211
|
-
* allows you to pass along a reference to your API key. After creating an
|
|
212
|
-
* [integration secret](https://developers.telnyx.com/api-reference/integration-secrets/create-a-secret)
|
|
213
|
-
* for you API key, pass the secret's `identifier` in this field.
|
|
214
|
-
*/
|
|
215
|
-
api_key_ref?: string;
|
|
216
|
-
/**
|
|
217
|
-
* This is used with `use_beam_search` to determine how many candidate beams to
|
|
218
|
-
* explore.
|
|
219
|
-
*/
|
|
220
|
-
best_of?: number;
|
|
221
|
-
/**
|
|
222
|
-
* This is used with `use_beam_search`. If `true`, generation stops as soon as
|
|
223
|
-
* there are `best_of` complete candidates; if `false`, a heuristic is applied and
|
|
224
|
-
* the generation stops when is it very unlikely to find better candidates.
|
|
225
|
-
*/
|
|
226
|
-
early_stopping?: boolean;
|
|
227
|
-
/**
|
|
228
|
-
* Whether to enable the thinking/reasoning phase for models that support it (e.g.,
|
|
229
|
-
* QwQ, Qwen3). When set to false, the model will skip the internal reasoning step
|
|
230
|
-
* and respond directly, which can reduce latency. Defaults to true.
|
|
231
|
-
*/
|
|
232
|
-
enable_thinking?: boolean;
|
|
233
|
-
/**
|
|
234
|
-
* Higher values will penalize the model from repeating the same output tokens.
|
|
235
|
-
*/
|
|
236
|
-
frequency_penalty?: number;
|
|
237
|
-
/**
|
|
238
|
-
* If specified, the output will be exactly one of the choices.
|
|
239
|
-
*/
|
|
240
|
-
guided_choice?: Array<string>;
|
|
241
|
-
/**
|
|
242
|
-
* Must be a valid JSON schema. If specified, the output will follow the JSON
|
|
243
|
-
* schema.
|
|
244
|
-
*/
|
|
245
|
-
guided_json?: {
|
|
246
|
-
[key: string]: unknown;
|
|
247
|
-
};
|
|
248
|
-
/**
|
|
249
|
-
* If specified, the output will follow the regex pattern.
|
|
250
|
-
*/
|
|
251
|
-
guided_regex?: string;
|
|
252
|
-
/**
|
|
253
|
-
* This is used with `use_beam_search` to prefer shorter or longer completions.
|
|
254
|
-
*/
|
|
255
|
-
length_penalty?: number;
|
|
256
|
-
/**
|
|
257
|
-
* Whether to return log probabilities of the output tokens or not. If true,
|
|
258
|
-
* returns the log probabilities of each output token returned in the `content` of
|
|
259
|
-
* `message`.
|
|
260
|
-
*/
|
|
261
|
-
logprobs?: boolean;
|
|
262
|
-
/**
|
|
263
|
-
* Maximum number of completion tokens the model should generate.
|
|
264
|
-
*/
|
|
265
|
-
max_tokens?: number;
|
|
266
|
-
/**
|
|
267
|
-
* This is an alternative to `top_p` that
|
|
268
|
-
* [many prefer](https://github.com/huggingface/transformers/issues/27670). Must be
|
|
269
|
-
* in [0, 1].
|
|
270
|
-
*/
|
|
271
|
-
min_p?: number;
|
|
272
|
-
/**
|
|
273
|
-
* The language model to chat with.
|
|
274
|
-
*/
|
|
275
|
-
model?: string;
|
|
276
|
-
/**
|
|
277
|
-
* This will return multiple choices for you instead of a single chat completion.
|
|
278
|
-
*/
|
|
279
|
-
n?: number;
|
|
280
|
-
/**
|
|
281
|
-
* Higher values will penalize the model from repeating the same output tokens.
|
|
282
|
-
*/
|
|
283
|
-
presence_penalty?: number;
|
|
284
|
-
/**
|
|
285
|
-
* Use this is you want to guarantee a JSON output without defining a schema. For
|
|
286
|
-
* control over the schema, use `guided_json`.
|
|
287
|
-
*/
|
|
288
|
-
response_format?: ChatCreateCompletionParams.ResponseFormat;
|
|
289
|
-
/**
|
|
290
|
-
* If specified, the system will make a best effort to sample deterministically,
|
|
291
|
-
* such that repeated requests with the same `seed` and parameters should return
|
|
292
|
-
* the same result.
|
|
293
|
-
*/
|
|
294
|
-
seed?: number;
|
|
295
|
-
/**
|
|
296
|
-
* Up to 4 sequences where the API will stop generating further tokens. The
|
|
297
|
-
* returned text will not contain the stop sequence.
|
|
298
|
-
*/
|
|
299
|
-
stop?: string | Array<string>;
|
|
300
|
-
/**
|
|
301
|
-
* Whether or not to stream data-only server-sent events as they become available.
|
|
302
|
-
*/
|
|
303
|
-
stream?: boolean;
|
|
304
|
-
/**
|
|
305
|
-
* Adjusts the "creativity" of the model. Lower values make the model more
|
|
306
|
-
* deterministic and repetitive, while higher values make the model more random and
|
|
307
|
-
* creative.
|
|
308
|
-
*/
|
|
309
|
-
temperature?: number;
|
|
310
|
-
tool_choice?: 'none' | 'auto' | 'required';
|
|
311
|
-
/**
|
|
312
|
-
* The `function` tool type follows the same schema as the
|
|
313
|
-
* [OpenAI Chat Completions API](https://platform.openai.com/docs/api-reference/chat).
|
|
314
|
-
* The `retrieval` tool type is unique to Telnyx. You may pass a list of
|
|
315
|
-
* [embedded storage buckets](https://developers.telnyx.com/api-reference/embeddings/embed-documents)
|
|
316
|
-
* for retrieval-augmented generation.
|
|
317
|
-
*/
|
|
318
|
-
tools?: Array<ChatCreateCompletionParams.Function | ChatCreateCompletionParams.Retrieval>;
|
|
319
|
-
/**
|
|
320
|
-
* This is used with `logprobs`. An integer between 0 and 20 specifying the number
|
|
321
|
-
* of most likely tokens to return at each token position, each with an associated
|
|
322
|
-
* log probability.
|
|
323
|
-
*/
|
|
324
|
-
top_logprobs?: number;
|
|
325
|
-
/**
|
|
326
|
-
* An alternative or complement to `temperature`. This adjusts how many of the top
|
|
327
|
-
* possibilities to consider.
|
|
328
|
-
*/
|
|
329
|
-
top_p?: number;
|
|
330
|
-
/**
|
|
331
|
-
* Setting this to `true` will allow the model to
|
|
332
|
-
* [explore more completion options](https://huggingface.co/blog/how-to-generate#beam-search).
|
|
333
|
-
* This is not supported by OpenAI.
|
|
334
|
-
*/
|
|
335
|
-
use_beam_search?: boolean;
|
|
336
|
-
}
|
|
337
|
-
export declare namespace ChatCreateCompletionParams {
|
|
338
|
-
interface Message {
|
|
339
|
-
content: string | Array<Message.TextAndImageArray>;
|
|
340
|
-
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
341
|
-
}
|
|
342
|
-
namespace Message {
|
|
343
|
-
interface TextAndImageArray {
|
|
344
|
-
type: 'text' | 'image_url';
|
|
345
|
-
image_url?: string;
|
|
346
|
-
text?: string;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Use this is you want to guarantee a JSON output without defining a schema. For
|
|
351
|
-
* control over the schema, use `guided_json`.
|
|
352
|
-
*/
|
|
353
|
-
interface ResponseFormat {
|
|
354
|
-
type: 'text' | 'json_object';
|
|
355
|
-
}
|
|
356
|
-
interface Function {
|
|
357
|
-
function: Function.Function;
|
|
358
|
-
type: 'function';
|
|
359
|
-
}
|
|
360
|
-
namespace Function {
|
|
361
|
-
interface Function {
|
|
362
|
-
name: string;
|
|
363
|
-
description?: string;
|
|
364
|
-
parameters?: {
|
|
365
|
-
[key: string]: unknown;
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
interface Retrieval {
|
|
370
|
-
retrieval: ChatAPI.BucketIDs;
|
|
371
|
-
type: 'retrieval';
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
187
|
export declare namespace Chat {
|
|
375
|
-
export { type BucketIDs as BucketIDs, type ChatCompletionRequest as ChatCompletionRequest
|
|
188
|
+
export { type BucketIDs as BucketIDs, type ChatCompletionRequest as ChatCompletionRequest };
|
|
376
189
|
}
|
|
377
190
|
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/resources/ai/chat.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,KAAK,OAAO,kBAAe;
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/resources/ai/chat.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,KAAK,OAAO,kBAAe;AAElC,qBAAa,IAAK,SAAQ,WAAW;CAAG;AAExC,MAAM,WAAW,SAAS;IACxB;;;;OAIG;IACH,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAE1B;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAE/C;;;;;OAKG;IACH,WAAW,CA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3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.Chat = void 0;
|
|
5
5
|
const resource_1 = require("../../core/resource.js");
|
|
6
|
-
/**
|
|
7
|
-
* Generate text with LLMs
|
|
8
|
-
*/
|
|
9
6
|
class Chat extends resource_1.APIResource {
|
|
10
|
-
/**
|
|
11
|
-
* **Deprecated**: Use `POST /v2/ai/openai/chat/completions` instead. Chat with a
|
|
12
|
-
* language model. This endpoint is consistent with the
|
|
13
|
-
* [OpenAI Chat Completions API](https://platform.openai.com/docs/api-reference/chat)
|
|
14
|
-
* and may be used with the OpenAI JS or Python SDK.
|
|
15
|
-
*
|
|
16
|
-
* @deprecated
|
|
17
|
-
*/
|
|
18
|
-
createCompletion(body, options) {
|
|
19
|
-
return this._client.post('/ai/chat/completions', { body, ...options });
|
|
20
|
-
}
|
|
21
7
|
}
|
|
22
8
|
exports.Chat = Chat;
|
|
23
9
|
//# sourceMappingURL=chat.js.map
|
package/resources/ai/chat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/resources/ai/chat.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/resources/ai/chat.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAGlD,MAAa,IAAK,SAAQ,sBAAW;CAAG;AAAxC,oBAAwC"}
|
package/resources/ai/chat.mjs
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
import { APIResource } from "../../core/resource.mjs";
|
|
3
|
-
/**
|
|
4
|
-
* Generate text with LLMs
|
|
5
|
-
*/
|
|
6
3
|
export class Chat extends APIResource {
|
|
7
|
-
/**
|
|
8
|
-
* **Deprecated**: Use `POST /v2/ai/openai/chat/completions` instead. Chat with a
|
|
9
|
-
* language model. This endpoint is consistent with the
|
|
10
|
-
* [OpenAI Chat Completions API](https://platform.openai.com/docs/api-reference/chat)
|
|
11
|
-
* and may be used with the OpenAI JS or Python SDK.
|
|
12
|
-
*
|
|
13
|
-
* @deprecated
|
|
14
|
-
*/
|
|
15
|
-
createCompletion(body, options) {
|
|
16
|
-
return this._client.post('/ai/chat/completions', { body, ...options });
|
|
17
|
-
}
|
|
18
4
|
}
|
|
19
5
|
//# sourceMappingURL=chat.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.mjs","sourceRoot":"","sources":["../../src/resources/ai/chat.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;
|
|
1
|
+
{"version":3,"file":"chat.mjs","sourceRoot":"","sources":["../../src/resources/ai/chat.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAGlD,MAAM,OAAO,IAAK,SAAQ,WAAW;CAAG"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { APIResource } from "../../../core/resource.mjs";
|
|
2
|
+
import { APIPromise } from "../../../core/api-promise.mjs";
|
|
3
|
+
import { RequestOptions } from "../../../internal/request-options.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Manage historical AI assistant conversations
|
|
6
|
+
*/
|
|
7
|
+
export declare class ConversationInsights extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Aggregate conversation insights by specified fields
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const response =
|
|
14
|
+
* await client.ai.conversations.conversationInsights.retrieveAggregates();
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
retrieveAggregates(query?: ConversationInsightRetrieveAggregatesParams | null | undefined, options?: RequestOptions): APIPromise<ConversationInsightRetrieveAggregatesResponse>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Aggregated conversation insight counts grouped by the specified fields. Each
|
|
21
|
+
* item in `data` contains the grouped field values and a `record_count` indicating
|
|
22
|
+
* how many conversation insights match that combination.
|
|
23
|
+
*/
|
|
24
|
+
export interface ConversationInsightRetrieveAggregatesResponse {
|
|
25
|
+
/**
|
|
26
|
+
* Aggregation result rows. Each row contains the grouped field values and a
|
|
27
|
+
* `record_count`.
|
|
28
|
+
*/
|
|
29
|
+
data: Array<ConversationInsightRetrieveAggregatesResponse.Data>;
|
|
30
|
+
}
|
|
31
|
+
export declare namespace ConversationInsightRetrieveAggregatesResponse {
|
|
32
|
+
/**
|
|
33
|
+
* An aggregation row. Contains the grouped field values (keyed by the group_by
|
|
34
|
+
* field names) and a `record_count` integer. For example, when grouping by
|
|
35
|
+
* `score`, each row has a `score` value and a `record_count` of conversations with
|
|
36
|
+
* that score. When also splitting by `metadata.assistant_version_id`, each row
|
|
37
|
+
* includes both `score` and `metadata.assistant_version_id` plus their combined
|
|
38
|
+
* `record_count`.
|
|
39
|
+
*/
|
|
40
|
+
interface Data {
|
|
41
|
+
/**
|
|
42
|
+
* Number of conversation insights that match this combination of grouped field
|
|
43
|
+
* values.
|
|
44
|
+
*/
|
|
45
|
+
record_count: number;
|
|
46
|
+
[k: string]: unknown;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export interface ConversationInsightRetrieveAggregatesParams {
|
|
50
|
+
/**
|
|
51
|
+
* Filter by creation datetime to scope the aggregation window. Supports range
|
|
52
|
+
* operators (e.g., `created_at=gte.2025-01-01T00:00:00Z` for the start of the
|
|
53
|
+
* range, `created_at=lt.2025-01-02T00:00:00Z` for the end). To build per-day time
|
|
54
|
+
* series (as the portal does for the 'Insights Over Time' chart), issue one
|
|
55
|
+
* request per day bounded by `created_at=gte.<day_start>` and
|
|
56
|
+
* `created_at=lt.<next_day_start>`.
|
|
57
|
+
*/
|
|
58
|
+
created_at?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Fields to group by (can be comma-separated or multiple parameters). Prefix a
|
|
61
|
+
* field with 'metadata.' (e.g. 'metadata.assistant_id') to group by the
|
|
62
|
+
* conversation's metadata instead of the insight result.
|
|
63
|
+
*
|
|
64
|
+
* Common fields used for over-time charts:
|
|
65
|
+
*
|
|
66
|
+
* - `score` — Group by the insight's score value (e.g. for Agent Instruction
|
|
67
|
+
* Following, User Satisfaction).
|
|
68
|
+
* - `metadata.assistant_id` — Group by the assistant that handled the
|
|
69
|
+
* conversation.
|
|
70
|
+
* - `metadata.assistant_version_id` — Group by the assistant version, useful for
|
|
71
|
+
* comparing performance across versions in the portal's 'Insights Over Time'
|
|
72
|
+
* chart.
|
|
73
|
+
* - `metadata.telnyx_conversation_channel` — Group by conversation channel
|
|
74
|
+
* (phone_call, web_chat, etc.).
|
|
75
|
+
*/
|
|
76
|
+
group_by?: Array<string>;
|
|
77
|
+
/**
|
|
78
|
+
* Optional insight ID to filter conversation insights. Only insights matching this
|
|
79
|
+
* ID will be included in the aggregation.
|
|
80
|
+
*/
|
|
81
|
+
insight_id?: string;
|
|
82
|
+
metadata?: ConversationInsightRetrieveAggregatesParams.Metadata;
|
|
83
|
+
/**
|
|
84
|
+
* Fields to include in the result (can be comma-separated or multiple parameters).
|
|
85
|
+
* Supports the same 'metadata.<key>' prefix as group_by. Each returned row will
|
|
86
|
+
* contain the grouped field values plus a `record_count` indicating how many
|
|
87
|
+
* conversation insights match that combination.
|
|
88
|
+
*/
|
|
89
|
+
show?: Array<string>;
|
|
90
|
+
}
|
|
91
|
+
export declare namespace ConversationInsightRetrieveAggregatesParams {
|
|
92
|
+
interface Metadata {
|
|
93
|
+
/**
|
|
94
|
+
* Filter by assistant ID (e.g., `metadata.assistant_id=eq.<assistant_id>`). When
|
|
95
|
+
* provided, only conversation insights for the specified assistant are aggregated.
|
|
96
|
+
* Used by the portal to scope the 'Insights Over Time' chart to a single
|
|
97
|
+
* assistant.
|
|
98
|
+
*/
|
|
99
|
+
assistant_id?: string;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
export declare namespace ConversationInsights {
|
|
103
|
+
export { type ConversationInsightRetrieveAggregatesResponse as ConversationInsightRetrieveAggregatesResponse, type ConversationInsightRetrieveAggregatesParams as ConversationInsightRetrieveAggregatesParams, };
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=conversation-insights.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-insights.d.mts","sourceRoot":"","sources":["../../../src/resources/ai/conversations/conversation-insights.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,mCAA+B;AACrD,OAAO,EAAE,UAAU,EAAE,sCAAkC;AACvD,OAAO,EAAE,cAAc,EAAE,8CAA0C;AAEnE;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,WAAW;IACnD;;;;;;;;OAQG;IACH,kBAAkB,CAChB,KAAK,GAAE,2CAA2C,GAAG,IAAI,GAAG,SAAc,EAC1E,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,6CAA6C,CAAC;CAG7D;AAED;;;;GAIG;AACH,MAAM,WAAW,6CAA6C;IAC5D;;;OAGG;IACH,IAAI,EAAE,KAAK,CAAC,6CAA6C,CAAC,IAAI,CAAC,CAAC;CACjE;AAED,yBAAiB,6CAA6C,CAAC;IAC7D;;;;;;;OAOG;IACH,UAAiB,IAAI;QACnB;;;WAGG;QACH,YAAY,EAAE,MAAM,CAAC;QAErB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB;CACF;AAED,MAAM,WAAW,2CAA2C;IAC1D;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAEzB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,QAAQ,CAAC,EAAE,2CAA2C,CAAC,QAAQ,CAAC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