@ai-sdk/provider 2.0.0-canary.0 → 2.0.0-canary.2
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 +19 -0
- package/dist/index.d.mts +1050 -1
- package/dist/index.d.ts +1050 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
@@ -1242,6 +1242,1009 @@ represents no support for object generation.
|
|
1242
1242
|
*/
|
1243
1243
|
type LanguageModelV1ObjectGenerationMode = 'json' | 'tool' | undefined;
|
1244
1244
|
|
1245
|
+
/**
|
1246
|
+
A tool has a name, a description, and a set of parameters.
|
1247
|
+
|
1248
|
+
Note: this is **not** the user-facing tool definition. The AI SDK methods will
|
1249
|
+
map the user-facing tool definitions to this format.
|
1250
|
+
*/
|
1251
|
+
type LanguageModelV2FunctionTool = {
|
1252
|
+
/**
|
1253
|
+
The type of the tool (always 'function').
|
1254
|
+
*/
|
1255
|
+
type: 'function';
|
1256
|
+
/**
|
1257
|
+
The name of the tool. Unique within this model call.
|
1258
|
+
*/
|
1259
|
+
name: string;
|
1260
|
+
/**
|
1261
|
+
A description of the tool. The language model uses this to understand the
|
1262
|
+
tool's purpose and to provide better completion suggestions.
|
1263
|
+
*/
|
1264
|
+
description?: string;
|
1265
|
+
/**
|
1266
|
+
The parameters that the tool expects. The language model uses this to
|
1267
|
+
understand the tool's input requirements and to provide matching suggestions.
|
1268
|
+
*/
|
1269
|
+
parameters: JSONSchema7;
|
1270
|
+
};
|
1271
|
+
|
1272
|
+
/**
|
1273
|
+
* Additional provider-specific options.
|
1274
|
+
* Options are additional input to the provider.
|
1275
|
+
* They are passed through to the provider from the AI SDK
|
1276
|
+
* and enable provider-specific functionality
|
1277
|
+
* that can be fully encapsulated in the provider.
|
1278
|
+
*
|
1279
|
+
* This enables us to quickly ship provider-specific functionality
|
1280
|
+
* without affecting the core AI SDK.
|
1281
|
+
*
|
1282
|
+
* The outer record is keyed by the provider name, and the inner
|
1283
|
+
* record is keyed by the provider-specific metadata key.
|
1284
|
+
*
|
1285
|
+
* ```ts
|
1286
|
+
* {
|
1287
|
+
* "anthropic": {
|
1288
|
+
* "cacheControl": { "type": "ephemeral" }
|
1289
|
+
* }
|
1290
|
+
* }
|
1291
|
+
* ```
|
1292
|
+
*/
|
1293
|
+
type LanguageModelV2ProviderOptions = Record<string, Record<string, JSONValue>>;
|
1294
|
+
|
1295
|
+
/**
|
1296
|
+
A prompt is a list of messages.
|
1297
|
+
|
1298
|
+
Note: Not all models and prompt formats support multi-modal inputs and
|
1299
|
+
tool calls. The validation happens at runtime.
|
1300
|
+
|
1301
|
+
Note: This is not a user-facing prompt. The AI SDK methods will map the
|
1302
|
+
user-facing prompt types such as chat or instruction prompts to this format.
|
1303
|
+
*/
|
1304
|
+
type LanguageModelV2Prompt = Array<LanguageModelV2Message>;
|
1305
|
+
type LanguageModelV2Message = ({
|
1306
|
+
role: 'system';
|
1307
|
+
content: string;
|
1308
|
+
} | {
|
1309
|
+
role: 'user';
|
1310
|
+
content: Array<LanguageModelV2TextPart | LanguageModelV2FilePart>;
|
1311
|
+
} | {
|
1312
|
+
role: 'assistant';
|
1313
|
+
content: Array<LanguageModelV2TextPart | LanguageModelV2FilePart | LanguageModelV2ReasoningPart | LanguageModelV2RedactedReasoningPart | LanguageModelV2ToolCallPart>;
|
1314
|
+
} | {
|
1315
|
+
role: 'tool';
|
1316
|
+
content: Array<LanguageModelV2ToolResultPart>;
|
1317
|
+
}) & {
|
1318
|
+
/**
|
1319
|
+
* Additional provider-specific options. They are passed through
|
1320
|
+
* to the provider from the AI SDK and enable provider-specific
|
1321
|
+
* functionality that can be fully encapsulated in the provider.
|
1322
|
+
*/
|
1323
|
+
providerOptions?: LanguageModelV2ProviderOptions;
|
1324
|
+
};
|
1325
|
+
/**
|
1326
|
+
Text content part of a prompt. It contains a string of text.
|
1327
|
+
*/
|
1328
|
+
interface LanguageModelV2TextPart {
|
1329
|
+
type: 'text';
|
1330
|
+
/**
|
1331
|
+
The text content.
|
1332
|
+
*/
|
1333
|
+
text: string;
|
1334
|
+
/**
|
1335
|
+
* Additional provider-specific options. They are passed through
|
1336
|
+
* to the provider from the AI SDK and enable provider-specific
|
1337
|
+
* functionality that can be fully encapsulated in the provider.
|
1338
|
+
*/
|
1339
|
+
providerOptions?: LanguageModelV2ProviderOptions;
|
1340
|
+
}
|
1341
|
+
/**
|
1342
|
+
Reasoning content part of a prompt. It contains a string of reasoning text.
|
1343
|
+
*/
|
1344
|
+
interface LanguageModelV2ReasoningPart {
|
1345
|
+
type: 'reasoning';
|
1346
|
+
/**
|
1347
|
+
The reasoning text.
|
1348
|
+
*/
|
1349
|
+
text: string;
|
1350
|
+
/**
|
1351
|
+
An optional signature for verifying that the reasoning originated from the model.
|
1352
|
+
*/
|
1353
|
+
signature?: string;
|
1354
|
+
/**
|
1355
|
+
* Additional provider-specific options. They are passed through
|
1356
|
+
* to the provider from the AI SDK and enable provider-specific
|
1357
|
+
* functionality that can be fully encapsulated in the provider.
|
1358
|
+
*/
|
1359
|
+
providerOptions?: LanguageModelV2ProviderOptions;
|
1360
|
+
}
|
1361
|
+
/**
|
1362
|
+
Redacted reasoning content part of a prompt.
|
1363
|
+
*/
|
1364
|
+
interface LanguageModelV2RedactedReasoningPart {
|
1365
|
+
type: 'redacted-reasoning';
|
1366
|
+
/**
|
1367
|
+
Redacted reasoning data.
|
1368
|
+
*/
|
1369
|
+
data: string;
|
1370
|
+
/**
|
1371
|
+
* Additional provider-specific options. They are passed through
|
1372
|
+
* to the provider from the AI SDK and enable provider-specific
|
1373
|
+
* functionality that can be fully encapsulated in the provider.
|
1374
|
+
*/
|
1375
|
+
providerOptions?: LanguageModelV2ProviderOptions;
|
1376
|
+
}
|
1377
|
+
/**
|
1378
|
+
File content part of a prompt. It contains a file.
|
1379
|
+
*/
|
1380
|
+
interface LanguageModelV2FilePart {
|
1381
|
+
type: 'file';
|
1382
|
+
/**
|
1383
|
+
* Optional filename of the file.
|
1384
|
+
*/
|
1385
|
+
filename?: string;
|
1386
|
+
/**
|
1387
|
+
File data as base64 encoded string or as a URL.
|
1388
|
+
*/
|
1389
|
+
data: string | URL;
|
1390
|
+
/**
|
1391
|
+
IANA media type of the file.
|
1392
|
+
|
1393
|
+
Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action).
|
1394
|
+
|
1395
|
+
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
1396
|
+
*/
|
1397
|
+
mediaType: string;
|
1398
|
+
/**
|
1399
|
+
* Additional provider-specific options. They are passed through
|
1400
|
+
* to the provider from the AI SDK and enable provider-specific
|
1401
|
+
* functionality that can be fully encapsulated in the provider.
|
1402
|
+
*/
|
1403
|
+
providerOptions?: LanguageModelV2ProviderOptions;
|
1404
|
+
}
|
1405
|
+
/**
|
1406
|
+
Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
1407
|
+
*/
|
1408
|
+
interface LanguageModelV2ToolCallPart {
|
1409
|
+
type: 'tool-call';
|
1410
|
+
/**
|
1411
|
+
ID of the tool call. This ID is used to match the tool call with the tool result.
|
1412
|
+
*/
|
1413
|
+
toolCallId: string;
|
1414
|
+
/**
|
1415
|
+
Name of the tool that is being called.
|
1416
|
+
*/
|
1417
|
+
toolName: string;
|
1418
|
+
/**
|
1419
|
+
Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
1420
|
+
*/
|
1421
|
+
args: unknown;
|
1422
|
+
/**
|
1423
|
+
* Additional provider-specific options. They are passed through
|
1424
|
+
* to the provider from the AI SDK and enable provider-specific
|
1425
|
+
* functionality that can be fully encapsulated in the provider.
|
1426
|
+
*/
|
1427
|
+
providerOptions?: LanguageModelV2ProviderOptions;
|
1428
|
+
}
|
1429
|
+
/**
|
1430
|
+
Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
1431
|
+
*/
|
1432
|
+
interface LanguageModelV2ToolResultPart {
|
1433
|
+
type: 'tool-result';
|
1434
|
+
/**
|
1435
|
+
ID of the tool call that this result is associated with.
|
1436
|
+
*/
|
1437
|
+
toolCallId: string;
|
1438
|
+
/**
|
1439
|
+
Name of the tool that generated this result.
|
1440
|
+
*/
|
1441
|
+
toolName: string;
|
1442
|
+
/**
|
1443
|
+
Result of the tool call. This is a JSON-serializable object.
|
1444
|
+
*/
|
1445
|
+
result: unknown;
|
1446
|
+
/**
|
1447
|
+
Optional flag if the result is an error or an error message.
|
1448
|
+
*/
|
1449
|
+
isError?: boolean;
|
1450
|
+
/**
|
1451
|
+
Tool results as an array of parts. This enables advanced tool results including images.
|
1452
|
+
When this is used, the `result` field should be ignored (if the provider supports content).
|
1453
|
+
*/
|
1454
|
+
content?: Array<{
|
1455
|
+
type: 'text';
|
1456
|
+
/**
|
1457
|
+
Text content.
|
1458
|
+
*/
|
1459
|
+
text: string;
|
1460
|
+
} | {
|
1461
|
+
type: 'image';
|
1462
|
+
/**
|
1463
|
+
base-64 encoded image data
|
1464
|
+
*/
|
1465
|
+
data: string;
|
1466
|
+
/**
|
1467
|
+
IANA media type of the image.
|
1468
|
+
|
1469
|
+
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
1470
|
+
*/
|
1471
|
+
mediaType?: string;
|
1472
|
+
}>;
|
1473
|
+
/**
|
1474
|
+
* Additional provider-specific options. They are passed through
|
1475
|
+
* to the provider from the AI SDK and enable provider-specific
|
1476
|
+
* functionality that can be fully encapsulated in the provider.
|
1477
|
+
*/
|
1478
|
+
providerOptions?: LanguageModelV2ProviderOptions;
|
1479
|
+
}
|
1480
|
+
|
1481
|
+
/**
|
1482
|
+
The configuration of a tool that is defined by the provider.
|
1483
|
+
*/
|
1484
|
+
type LanguageModelV2ProviderDefinedTool = {
|
1485
|
+
/**
|
1486
|
+
The type of the tool (always 'provider-defined').
|
1487
|
+
*/
|
1488
|
+
type: 'provider-defined';
|
1489
|
+
/**
|
1490
|
+
The ID of the tool. Should follow the format `<provider-name>.<tool-name>`.
|
1491
|
+
*/
|
1492
|
+
id: `${string}.${string}`;
|
1493
|
+
/**
|
1494
|
+
The name of the tool. Unique within this model call.
|
1495
|
+
*/
|
1496
|
+
name: string;
|
1497
|
+
/**
|
1498
|
+
The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool.
|
1499
|
+
*/
|
1500
|
+
args: Record<string, unknown>;
|
1501
|
+
};
|
1502
|
+
|
1503
|
+
type LanguageModelV2ToolChoice = {
|
1504
|
+
type: 'auto';
|
1505
|
+
} | {
|
1506
|
+
type: 'none';
|
1507
|
+
} | {
|
1508
|
+
type: 'required';
|
1509
|
+
} | {
|
1510
|
+
type: 'tool';
|
1511
|
+
toolName: string;
|
1512
|
+
};
|
1513
|
+
|
1514
|
+
type LanguageModelV2CallOptions = {
|
1515
|
+
/**
|
1516
|
+
Whether the user provided the input as messages or as
|
1517
|
+
a prompt. This can help guide non-chat models in the
|
1518
|
+
expansion, bc different expansions can be needed for
|
1519
|
+
chat/non-chat use cases.
|
1520
|
+
*/
|
1521
|
+
inputFormat: 'messages' | 'prompt';
|
1522
|
+
/**
|
1523
|
+
A language mode prompt is a standardized prompt type.
|
1524
|
+
|
1525
|
+
Note: This is **not** the user-facing prompt. The AI SDK methods will map the
|
1526
|
+
user-facing prompt types such as chat or instruction prompts to this format.
|
1527
|
+
That approach allows us to evolve the user facing prompts without breaking
|
1528
|
+
the language model interface.
|
1529
|
+
*/
|
1530
|
+
prompt: LanguageModelV2Prompt;
|
1531
|
+
/**
|
1532
|
+
Maximum number of tokens to generate.
|
1533
|
+
*/
|
1534
|
+
maxTokens?: number;
|
1535
|
+
/**
|
1536
|
+
Temperature setting.
|
1537
|
+
|
1538
|
+
It is recommended to set either `temperature` or `topP`, but not both.
|
1539
|
+
*/
|
1540
|
+
temperature?: number;
|
1541
|
+
/**
|
1542
|
+
Stop sequences.
|
1543
|
+
If set, the model will stop generating text when one of the stop sequences is generated.
|
1544
|
+
Providers may have limits on the number of stop sequences.
|
1545
|
+
*/
|
1546
|
+
stopSequences?: string[];
|
1547
|
+
/**
|
1548
|
+
Nucleus sampling.
|
1549
|
+
|
1550
|
+
It is recommended to set either `temperature` or `topP`, but not both.
|
1551
|
+
*/
|
1552
|
+
topP?: number;
|
1553
|
+
/**
|
1554
|
+
Only sample from the top K options for each subsequent token.
|
1555
|
+
|
1556
|
+
Used to remove "long tail" low probability responses.
|
1557
|
+
Recommended for advanced use cases only. You usually only need to use temperature.
|
1558
|
+
*/
|
1559
|
+
topK?: number;
|
1560
|
+
/**
|
1561
|
+
Presence penalty setting. It affects the likelihood of the model to
|
1562
|
+
repeat information that is already in the prompt.
|
1563
|
+
*/
|
1564
|
+
presencePenalty?: number;
|
1565
|
+
/**
|
1566
|
+
Frequency penalty setting. It affects the likelihood of the model
|
1567
|
+
to repeatedly use the same words or phrases.
|
1568
|
+
*/
|
1569
|
+
frequencyPenalty?: number;
|
1570
|
+
/**
|
1571
|
+
Response format. The output can either be text or JSON. Default is text.
|
1572
|
+
|
1573
|
+
If JSON is selected, a schema can optionally be provided to guide the LLM.
|
1574
|
+
*/
|
1575
|
+
responseFormat?: {
|
1576
|
+
type: 'text';
|
1577
|
+
} | {
|
1578
|
+
type: 'json';
|
1579
|
+
/**
|
1580
|
+
* JSON schema that the generated output should conform to.
|
1581
|
+
*/
|
1582
|
+
schema?: JSONSchema7;
|
1583
|
+
/**
|
1584
|
+
* Name of output that should be generated. Used by some providers for additional LLM guidance.
|
1585
|
+
*/
|
1586
|
+
name?: string;
|
1587
|
+
/**
|
1588
|
+
* Description of the output that should be generated. Used by some providers for additional LLM guidance.
|
1589
|
+
*/
|
1590
|
+
description?: string;
|
1591
|
+
};
|
1592
|
+
/**
|
1593
|
+
The seed (integer) to use for random sampling. If set and supported
|
1594
|
+
by the model, calls will generate deterministic results.
|
1595
|
+
*/
|
1596
|
+
seed?: number;
|
1597
|
+
/**
|
1598
|
+
The tools that are available for the model.
|
1599
|
+
*/
|
1600
|
+
tools?: Array<LanguageModelV2FunctionTool | LanguageModelV2ProviderDefinedTool>;
|
1601
|
+
/**
|
1602
|
+
Specifies how the tool should be selected. Defaults to 'auto'.
|
1603
|
+
*/
|
1604
|
+
toolChoice?: LanguageModelV2ToolChoice;
|
1605
|
+
/**
|
1606
|
+
Abort signal for cancelling the operation.
|
1607
|
+
*/
|
1608
|
+
abortSignal?: AbortSignal;
|
1609
|
+
/**
|
1610
|
+
Additional HTTP headers to be sent with the request.
|
1611
|
+
Only applicable for HTTP-based providers.
|
1612
|
+
*/
|
1613
|
+
headers?: Record<string, string | undefined>;
|
1614
|
+
/**
|
1615
|
+
* Additional provider-specific options. They are passed through
|
1616
|
+
* to the provider from the AI SDK and enable provider-specific
|
1617
|
+
* functionality that can be fully encapsulated in the provider.
|
1618
|
+
*/
|
1619
|
+
providerOptions?: LanguageModelV2ProviderOptions;
|
1620
|
+
};
|
1621
|
+
|
1622
|
+
/**
|
1623
|
+
Warning from the model provider for this call. The call will proceed, but e.g.
|
1624
|
+
some settings might not be supported, which can lead to suboptimal results.
|
1625
|
+
*/
|
1626
|
+
type LanguageModelV2CallWarning = {
|
1627
|
+
type: 'unsupported-setting';
|
1628
|
+
setting: Omit<keyof LanguageModelV2CallOptions, 'prompt'>;
|
1629
|
+
details?: string;
|
1630
|
+
} | {
|
1631
|
+
type: 'unsupported-tool';
|
1632
|
+
tool: LanguageModelV2FunctionTool | LanguageModelV2ProviderDefinedTool;
|
1633
|
+
details?: string;
|
1634
|
+
} | {
|
1635
|
+
type: 'other';
|
1636
|
+
message: string;
|
1637
|
+
};
|
1638
|
+
|
1639
|
+
/**
|
1640
|
+
Reason why a language model finished generating a response.
|
1641
|
+
|
1642
|
+
Can be one of the following:
|
1643
|
+
- `stop`: model generated stop sequence
|
1644
|
+
- `length`: model generated maximum number of tokens
|
1645
|
+
- `content-filter`: content filter violation stopped the model
|
1646
|
+
- `tool-calls`: model triggered tool calls
|
1647
|
+
- `error`: model stopped because of an error
|
1648
|
+
- `other`: model stopped for other reasons
|
1649
|
+
- `unknown`: the model has not transmitted a finish reason
|
1650
|
+
*/
|
1651
|
+
type LanguageModelV2FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
|
1652
|
+
|
1653
|
+
type LanguageModelV2FunctionToolCall = {
|
1654
|
+
toolCallType: 'function';
|
1655
|
+
toolCallId: string;
|
1656
|
+
toolName: string;
|
1657
|
+
/**
|
1658
|
+
Stringified JSON object with the tool call arguments. Must match the
|
1659
|
+
parameters schema of the tool.
|
1660
|
+
*/
|
1661
|
+
args: string;
|
1662
|
+
};
|
1663
|
+
|
1664
|
+
/**
|
1665
|
+
Log probabilities for each token and its top log probabilities.
|
1666
|
+
*/
|
1667
|
+
type LanguageModelV2LogProbs = Array<{
|
1668
|
+
token: string;
|
1669
|
+
logprob: number;
|
1670
|
+
topLogprobs: Array<{
|
1671
|
+
token: string;
|
1672
|
+
logprob: number;
|
1673
|
+
}>;
|
1674
|
+
}>;
|
1675
|
+
|
1676
|
+
/**
|
1677
|
+
* Additional provider-specific metadata.
|
1678
|
+
* Metadata are additional outputs from the provider.
|
1679
|
+
* They are passed through to the provider from the AI SDK
|
1680
|
+
* and enable provider-specific functionality
|
1681
|
+
* that can be fully encapsulated in the provider.
|
1682
|
+
*
|
1683
|
+
* This enables us to quickly ship provider-specific functionality
|
1684
|
+
* without affecting the core AI SDK.
|
1685
|
+
*
|
1686
|
+
* The outer record is keyed by the provider name, and the inner
|
1687
|
+
* record is keyed by the provider-specific metadata key.
|
1688
|
+
*
|
1689
|
+
* ```ts
|
1690
|
+
* {
|
1691
|
+
* "anthropic": {
|
1692
|
+
* "cacheControl": { "type": "ephemeral" }
|
1693
|
+
* }
|
1694
|
+
* }
|
1695
|
+
* ```
|
1696
|
+
*/
|
1697
|
+
type LanguageModelV2ProviderMetadata = Record<string, Record<string, JSONValue>>;
|
1698
|
+
|
1699
|
+
/**
|
1700
|
+
* A source that has been used as input to generate the response.
|
1701
|
+
*/
|
1702
|
+
type LanguageModelV2Source = {
|
1703
|
+
/**
|
1704
|
+
* A URL source. This is return by web search RAG models.
|
1705
|
+
*/
|
1706
|
+
sourceType: 'url';
|
1707
|
+
/**
|
1708
|
+
* The ID of the source.
|
1709
|
+
*/
|
1710
|
+
id: string;
|
1711
|
+
/**
|
1712
|
+
* The URL of the source.
|
1713
|
+
*/
|
1714
|
+
url: string;
|
1715
|
+
/**
|
1716
|
+
* The title of the source.
|
1717
|
+
*/
|
1718
|
+
title?: string;
|
1719
|
+
/**
|
1720
|
+
* Additional provider metadata for the source.
|
1721
|
+
*/
|
1722
|
+
providerMetadata?: LanguageModelV2ProviderMetadata;
|
1723
|
+
};
|
1724
|
+
|
1725
|
+
/**
|
1726
|
+
Specification for a language model that implements the language model interface version 2.
|
1727
|
+
*/
|
1728
|
+
type LanguageModelV2 = {
|
1729
|
+
/**
|
1730
|
+
The language model must specify which language model interface
|
1731
|
+
version it implements. This will allow us to evolve the language
|
1732
|
+
model interface and retain backwards compatibility. The different
|
1733
|
+
implementation versions can be handled as a discriminated union
|
1734
|
+
on our side.
|
1735
|
+
*/
|
1736
|
+
readonly specificationVersion: 'v2';
|
1737
|
+
/**
|
1738
|
+
Name of the provider for logging purposes.
|
1739
|
+
*/
|
1740
|
+
readonly provider: string;
|
1741
|
+
/**
|
1742
|
+
Provider-specific model ID for logging purposes.
|
1743
|
+
*/
|
1744
|
+
readonly modelId: string;
|
1745
|
+
/**
|
1746
|
+
Default object generation mode that should be used with this model when
|
1747
|
+
no mode is specified. Should be the mode with the best results for this
|
1748
|
+
model. `undefined` can be returned if object generation is not supported.
|
1749
|
+
|
1750
|
+
This is needed to generate the best objects possible w/o requiring the
|
1751
|
+
user to explicitly specify the object generation mode.
|
1752
|
+
*/
|
1753
|
+
readonly defaultObjectGenerationMode: LanguageModelV2ObjectGenerationMode;
|
1754
|
+
/**
|
1755
|
+
Flag whether this model supports image URLs. Default is `true`.
|
1756
|
+
|
1757
|
+
When the flag is set to `false`, the AI SDK will download the image and
|
1758
|
+
pass the image data to the model.
|
1759
|
+
*/
|
1760
|
+
readonly supportsImageUrls?: boolean;
|
1761
|
+
/**
|
1762
|
+
Flag whether this model supports grammar-guided generation,
|
1763
|
+
i.e. follows JSON schemas for object generation
|
1764
|
+
when the response format is set to 'json' or
|
1765
|
+
when the `object-json` mode is used.
|
1766
|
+
|
1767
|
+
This means that the model guarantees that the generated JSON
|
1768
|
+
will be a valid JSON object AND that the object will match the
|
1769
|
+
JSON schema.
|
1770
|
+
|
1771
|
+
Please note that `generateObject` and `streamObject` will work
|
1772
|
+
regardless of this flag, but might send different prompts and
|
1773
|
+
use further optimizations if this flag is set to `true`.
|
1774
|
+
|
1775
|
+
Defaults to `false`.
|
1776
|
+
*/
|
1777
|
+
readonly supportsStructuredOutputs?: boolean;
|
1778
|
+
/**
|
1779
|
+
Checks if the model supports the given URL for file parts natively.
|
1780
|
+
If the model does not support the URL,
|
1781
|
+
the AI SDK will download the file and pass the file data to the model.
|
1782
|
+
|
1783
|
+
When undefined, the AI SDK will download the file.
|
1784
|
+
*/
|
1785
|
+
supportsUrl?(url: URL): boolean;
|
1786
|
+
/**
|
1787
|
+
Generates a language model output (non-streaming).
|
1788
|
+
|
1789
|
+
Naming: "do" prefix to prevent accidental direct usage of the method
|
1790
|
+
by the user.
|
1791
|
+
*/
|
1792
|
+
doGenerate(options: LanguageModelV2CallOptions): PromiseLike<{
|
1793
|
+
/**
|
1794
|
+
Text that the model has generated.
|
1795
|
+
Can be undefined if the model did not generate any text.
|
1796
|
+
*/
|
1797
|
+
text?: string;
|
1798
|
+
/**
|
1799
|
+
Reasoning that the model has generated.
|
1800
|
+
Can be undefined if the model does not support reasoning.
|
1801
|
+
*/
|
1802
|
+
reasoning?: string | Array<{
|
1803
|
+
type: 'text';
|
1804
|
+
text: string;
|
1805
|
+
/**
|
1806
|
+
An optional signature for verifying that the reasoning originated from the model.
|
1807
|
+
*/
|
1808
|
+
signature?: string;
|
1809
|
+
} | {
|
1810
|
+
type: 'redacted';
|
1811
|
+
data: string;
|
1812
|
+
}>;
|
1813
|
+
/**
|
1814
|
+
Generated files as base64 encoded strings or binary data.
|
1815
|
+
The files should be returned without any unnecessary conversion.
|
1816
|
+
*/
|
1817
|
+
files?: Array<{
|
1818
|
+
/**
|
1819
|
+
Generated file data as base64 encoded strings or binary data.
|
1820
|
+
The file data should be returned without any unnecessary conversion.
|
1821
|
+
If the API returns base64 encoded strings, the file data should be returned
|
1822
|
+
as base64 encoded strings. If the API returns binary data, the file data should
|
1823
|
+
be returned as binary data.
|
1824
|
+
*/
|
1825
|
+
data: string | Uint8Array;
|
1826
|
+
/**
|
1827
|
+
The IANA media type of the file.
|
1828
|
+
|
1829
|
+
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
1830
|
+
*/
|
1831
|
+
mediaType: string;
|
1832
|
+
}>;
|
1833
|
+
/**
|
1834
|
+
Tool calls that the model has generated.
|
1835
|
+
Can be undefined if the model did not generate any tool calls.
|
1836
|
+
*/
|
1837
|
+
toolCalls?: Array<LanguageModelV2FunctionToolCall>;
|
1838
|
+
/**
|
1839
|
+
Finish reason.
|
1840
|
+
*/
|
1841
|
+
finishReason: LanguageModelV2FinishReason;
|
1842
|
+
/**
|
1843
|
+
Usage information.
|
1844
|
+
*/
|
1845
|
+
usage: {
|
1846
|
+
promptTokens: number;
|
1847
|
+
completionTokens: number;
|
1848
|
+
};
|
1849
|
+
/**
|
1850
|
+
Raw prompt and setting information for observability provider integration.
|
1851
|
+
*/
|
1852
|
+
rawCall: {
|
1853
|
+
/**
|
1854
|
+
Raw prompt after expansion and conversion to the format that the
|
1855
|
+
provider uses to send the information to their API.
|
1856
|
+
*/
|
1857
|
+
rawPrompt: unknown;
|
1858
|
+
/**
|
1859
|
+
Raw settings that are used for the API call. Includes provider-specific
|
1860
|
+
settings.
|
1861
|
+
*/
|
1862
|
+
rawSettings: Record<string, unknown>;
|
1863
|
+
};
|
1864
|
+
/**
|
1865
|
+
Optional response information for telemetry and debugging purposes.
|
1866
|
+
*/
|
1867
|
+
rawResponse?: {
|
1868
|
+
/**
|
1869
|
+
Response headers.
|
1870
|
+
*/
|
1871
|
+
headers?: Record<string, string>;
|
1872
|
+
/**
|
1873
|
+
Response body.
|
1874
|
+
*/
|
1875
|
+
body?: unknown;
|
1876
|
+
};
|
1877
|
+
/**
|
1878
|
+
Optional request information for telemetry and debugging purposes.
|
1879
|
+
*/
|
1880
|
+
request?: {
|
1881
|
+
/**
|
1882
|
+
Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
|
1883
|
+
Non-HTTP(s) providers should not set this.
|
1884
|
+
*/
|
1885
|
+
body?: string;
|
1886
|
+
};
|
1887
|
+
/**
|
1888
|
+
Optional response information for telemetry and debugging purposes.
|
1889
|
+
*/
|
1890
|
+
response?: {
|
1891
|
+
/**
|
1892
|
+
ID for the generated response, if the provider sends one.
|
1893
|
+
*/
|
1894
|
+
id?: string;
|
1895
|
+
/**
|
1896
|
+
Timestamp for the start of the generated response, if the provider sends one.
|
1897
|
+
*/
|
1898
|
+
timestamp?: Date;
|
1899
|
+
/**
|
1900
|
+
The ID of the response model that was used to generate the response, if the provider sends one.
|
1901
|
+
*/
|
1902
|
+
modelId?: string;
|
1903
|
+
};
|
1904
|
+
warnings?: LanguageModelV2CallWarning[];
|
1905
|
+
/**
|
1906
|
+
Additional provider-specific metadata. They are passed through
|
1907
|
+
from the provider to the AI SDK and enable provider-specific
|
1908
|
+
results that can be fully encapsulated in the provider.
|
1909
|
+
*/
|
1910
|
+
providerMetadata?: LanguageModelV2ProviderMetadata;
|
1911
|
+
/**
|
1912
|
+
Sources that have been used as input to generate the response.
|
1913
|
+
*/
|
1914
|
+
sources?: LanguageModelV2Source[];
|
1915
|
+
/**
|
1916
|
+
Logprobs for the completion.
|
1917
|
+
`undefined` if the mode does not support logprobs or if was not enabled
|
1918
|
+
|
1919
|
+
@deprecated will be changed into a provider-specific extension in v2
|
1920
|
+
*/
|
1921
|
+
logprobs?: LanguageModelV2LogProbs;
|
1922
|
+
}>;
|
1923
|
+
/**
|
1924
|
+
Generates a language model output (streaming).
|
1925
|
+
|
1926
|
+
Naming: "do" prefix to prevent accidental direct usage of the method
|
1927
|
+
by the user.
|
1928
|
+
*
|
1929
|
+
@return A stream of higher-level language model output parts.
|
1930
|
+
*/
|
1931
|
+
doStream(options: LanguageModelV2CallOptions): PromiseLike<{
|
1932
|
+
stream: ReadableStream<LanguageModelV2StreamPart>;
|
1933
|
+
/**
|
1934
|
+
Raw prompt and setting information for observability provider integration.
|
1935
|
+
*/
|
1936
|
+
rawCall: {
|
1937
|
+
/**
|
1938
|
+
Raw prompt after expansion and conversion to the format that the
|
1939
|
+
provider uses to send the information to their API.
|
1940
|
+
*/
|
1941
|
+
rawPrompt: unknown;
|
1942
|
+
/**
|
1943
|
+
Raw settings that are used for the API call. Includes provider-specific
|
1944
|
+
settings.
|
1945
|
+
*/
|
1946
|
+
rawSettings: Record<string, unknown>;
|
1947
|
+
};
|
1948
|
+
/**
|
1949
|
+
Optional raw response data.
|
1950
|
+
*/
|
1951
|
+
rawResponse?: {
|
1952
|
+
/**
|
1953
|
+
Response headers.
|
1954
|
+
*/
|
1955
|
+
headers?: Record<string, string>;
|
1956
|
+
};
|
1957
|
+
/**
|
1958
|
+
Optional request information for telemetry and debugging purposes.
|
1959
|
+
*/
|
1960
|
+
request?: {
|
1961
|
+
/**
|
1962
|
+
Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
|
1963
|
+
Non-HTTP(s) providers should not set this.
|
1964
|
+
*/
|
1965
|
+
body?: string;
|
1966
|
+
};
|
1967
|
+
/**
|
1968
|
+
Warnings for the call, e.g. unsupported settings.
|
1969
|
+
*/
|
1970
|
+
warnings?: Array<LanguageModelV2CallWarning>;
|
1971
|
+
}>;
|
1972
|
+
};
|
1973
|
+
type LanguageModelV2StreamPart = {
|
1974
|
+
type: 'text-delta';
|
1975
|
+
textDelta: string;
|
1976
|
+
} | {
|
1977
|
+
type: 'reasoning';
|
1978
|
+
textDelta: string;
|
1979
|
+
} | {
|
1980
|
+
type: 'reasoning-signature';
|
1981
|
+
signature: string;
|
1982
|
+
} | {
|
1983
|
+
type: 'redacted-reasoning';
|
1984
|
+
data: string;
|
1985
|
+
} | {
|
1986
|
+
type: 'source';
|
1987
|
+
source: LanguageModelV2Source;
|
1988
|
+
} | {
|
1989
|
+
type: 'file';
|
1990
|
+
/**
|
1991
|
+
The IANA media type of the file.
|
1992
|
+
|
1993
|
+
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
1994
|
+
*/
|
1995
|
+
mediaType: string;
|
1996
|
+
/**
|
1997
|
+
Generated file data as base64 encoded strings or binary data.
|
1998
|
+
The file data should be returned without any unnecessary conversion.
|
1999
|
+
If the API returns base64 encoded strings, the file data should be returned
|
2000
|
+
as base64 encoded strings. If the API returns binary data, the file data should
|
2001
|
+
be returned as binary data.
|
2002
|
+
*/
|
2003
|
+
data: string | Uint8Array;
|
2004
|
+
} | ({
|
2005
|
+
type: 'tool-call';
|
2006
|
+
} & LanguageModelV2FunctionToolCall) | {
|
2007
|
+
type: 'tool-call-delta';
|
2008
|
+
toolCallType: 'function';
|
2009
|
+
toolCallId: string;
|
2010
|
+
toolName: string;
|
2011
|
+
argsTextDelta: string;
|
2012
|
+
} | {
|
2013
|
+
type: 'response-metadata';
|
2014
|
+
id?: string;
|
2015
|
+
timestamp?: Date;
|
2016
|
+
modelId?: string;
|
2017
|
+
} | {
|
2018
|
+
type: 'finish';
|
2019
|
+
finishReason: LanguageModelV2FinishReason;
|
2020
|
+
providerMetadata?: LanguageModelV2ProviderMetadata;
|
2021
|
+
usage: {
|
2022
|
+
promptTokens: number;
|
2023
|
+
completionTokens: number;
|
2024
|
+
};
|
2025
|
+
logprobs?: LanguageModelV2LogProbs;
|
2026
|
+
} | {
|
2027
|
+
type: 'error';
|
2028
|
+
error: unknown;
|
2029
|
+
};
|
2030
|
+
/**
|
2031
|
+
The object generation modes available for use with a model. `undefined`
|
2032
|
+
represents no support for object generation.
|
2033
|
+
*/
|
2034
|
+
type LanguageModelV2ObjectGenerationMode = 'json' | 'tool' | undefined;
|
2035
|
+
|
2036
|
+
/**
|
2037
|
+
* Experimental middleware for LanguageModelV2.
|
2038
|
+
* This type defines the structure for middleware that can be used to modify
|
2039
|
+
* the behavior of LanguageModelV2 operations.
|
2040
|
+
*/
|
2041
|
+
type LanguageModelV2Middleware = {
|
2042
|
+
/**
|
2043
|
+
* Middleware specification version. Use `v2` for the current version.
|
2044
|
+
*/
|
2045
|
+
middlewareVersion?: 'v2' | undefined;
|
2046
|
+
/**
|
2047
|
+
* Transforms the parameters before they are passed to the language model.
|
2048
|
+
* @param options - Object containing the type of operation and the parameters.
|
2049
|
+
* @param options.type - The type of operation ('generate' or 'stream').
|
2050
|
+
* @param options.params - The original parameters for the language model call.
|
2051
|
+
* @returns A promise that resolves to the transformed parameters.
|
2052
|
+
*/
|
2053
|
+
transformParams?: (options: {
|
2054
|
+
type: 'generate' | 'stream';
|
2055
|
+
params: LanguageModelV2CallOptions;
|
2056
|
+
}) => PromiseLike<LanguageModelV2CallOptions>;
|
2057
|
+
/**
|
2058
|
+
* Wraps the generate operation of the language model.
|
2059
|
+
* @param options - Object containing the generate function, parameters, and model.
|
2060
|
+
* @param options.doGenerate - The original generate function.
|
2061
|
+
* @param options.doStream - The original stream function.
|
2062
|
+
* @param options.params - The parameters for the generate call. If the
|
2063
|
+
* `transformParams` middleware is used, this will be the transformed parameters.
|
2064
|
+
* @param options.model - The language model instance.
|
2065
|
+
* @returns A promise that resolves to the result of the generate operation.
|
2066
|
+
*/
|
2067
|
+
wrapGenerate?: (options: {
|
2068
|
+
doGenerate: () => ReturnType<LanguageModelV2['doGenerate']>;
|
2069
|
+
doStream: () => ReturnType<LanguageModelV2['doStream']>;
|
2070
|
+
params: LanguageModelV2CallOptions;
|
2071
|
+
model: LanguageModelV2;
|
2072
|
+
}) => Promise<Awaited<ReturnType<LanguageModelV2['doGenerate']>>>;
|
2073
|
+
/**
|
2074
|
+
* Wraps the stream operation of the language model.
|
2075
|
+
*
|
2076
|
+
* @param options - Object containing the stream function, parameters, and model.
|
2077
|
+
* @param options.doGenerate - The original generate function.
|
2078
|
+
* @param options.doStream - The original stream function.
|
2079
|
+
* @param options.params - The parameters for the stream call. If the
|
2080
|
+
* `transformParams` middleware is used, this will be the transformed parameters.
|
2081
|
+
* @param options.model - The language model instance.
|
2082
|
+
* @returns A promise that resolves to the result of the stream operation.
|
2083
|
+
*/
|
2084
|
+
wrapStream?: (options: {
|
2085
|
+
doGenerate: () => ReturnType<LanguageModelV2['doGenerate']>;
|
2086
|
+
doStream: () => ReturnType<LanguageModelV2['doStream']>;
|
2087
|
+
params: LanguageModelV2CallOptions;
|
2088
|
+
model: LanguageModelV2;
|
2089
|
+
}) => PromiseLike<Awaited<ReturnType<LanguageModelV2['doStream']>>>;
|
2090
|
+
};
|
2091
|
+
/**
|
2092
|
+
* @deprecated Use `LanguageModelV2Middleware` instead.
|
2093
|
+
*/
|
2094
|
+
type Experimental_LanguageModelV2Middleware = LanguageModelV2Middleware;
|
2095
|
+
|
2096
|
+
type TranscriptionModelV1ProviderOptions = Record<string, Record<string, JSONValue>>;
|
2097
|
+
type TranscriptionModelV1CallOptions = {
|
2098
|
+
/**
|
2099
|
+
Audio data to transcribe.
|
2100
|
+
Accepts a `Uint8Array` or `string`, where `string` is a base64 encoded audio file.
|
2101
|
+
*/
|
2102
|
+
audio: Uint8Array | string;
|
2103
|
+
/**
|
2104
|
+
The IANA media type of the audio data.
|
2105
|
+
|
2106
|
+
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
2107
|
+
*/
|
2108
|
+
mediaType: string;
|
2109
|
+
/**
|
2110
|
+
Additional provider-specific options that are passed through to the provider
|
2111
|
+
as body parameters.
|
2112
|
+
|
2113
|
+
The outer record is keyed by the provider name, and the inner
|
2114
|
+
record is keyed by the provider-specific metadata key.
|
2115
|
+
```ts
|
2116
|
+
{
|
2117
|
+
"openai": {
|
2118
|
+
"timestampGranularities": ["word"]
|
2119
|
+
}
|
2120
|
+
}
|
2121
|
+
```
|
2122
|
+
*/
|
2123
|
+
providerOptions?: TranscriptionModelV1ProviderOptions;
|
2124
|
+
/**
|
2125
|
+
Abort signal for cancelling the operation.
|
2126
|
+
*/
|
2127
|
+
abortSignal?: AbortSignal;
|
2128
|
+
/**
|
2129
|
+
Additional HTTP headers to be sent with the request.
|
2130
|
+
Only applicable for HTTP-based providers.
|
2131
|
+
*/
|
2132
|
+
headers?: Record<string, string | undefined>;
|
2133
|
+
};
|
2134
|
+
|
2135
|
+
/**
|
2136
|
+
Warning from the model provider for this call. The call will proceed, but e.g.
|
2137
|
+
some settings might not be supported, which can lead to suboptimal results.
|
2138
|
+
*/
|
2139
|
+
type TranscriptionModelV1CallWarning = {
|
2140
|
+
type: 'unsupported-setting';
|
2141
|
+
setting: keyof TranscriptionModelV1CallOptions;
|
2142
|
+
details?: string;
|
2143
|
+
} | {
|
2144
|
+
type: 'other';
|
2145
|
+
message: string;
|
2146
|
+
};
|
2147
|
+
|
2148
|
+
/**
|
2149
|
+
Transcription model specification version 1.
|
2150
|
+
*/
|
2151
|
+
type TranscriptionModelV1 = {
|
2152
|
+
/**
|
2153
|
+
The transcription model must specify which transcription model interface
|
2154
|
+
version it implements. This will allow us to evolve the transcription
|
2155
|
+
model interface and retain backwards compatibility. The different
|
2156
|
+
implementation versions can be handled as a discriminated union
|
2157
|
+
on our side.
|
2158
|
+
*/
|
2159
|
+
readonly specificationVersion: 'v1';
|
2160
|
+
/**
|
2161
|
+
Name of the provider for logging purposes.
|
2162
|
+
*/
|
2163
|
+
readonly provider: string;
|
2164
|
+
/**
|
2165
|
+
Provider-specific model ID for logging purposes.
|
2166
|
+
*/
|
2167
|
+
readonly modelId: string;
|
2168
|
+
/**
|
2169
|
+
Generates a transcript.
|
2170
|
+
*/
|
2171
|
+
doGenerate(options: TranscriptionModelV1CallOptions): PromiseLike<{
|
2172
|
+
/**
|
2173
|
+
* The complete transcribed text from the audio.
|
2174
|
+
*/
|
2175
|
+
text: string;
|
2176
|
+
/**
|
2177
|
+
* Array of transcript segments with timing information.
|
2178
|
+
* Each segment represents a portion of the transcribed text with start and end times.
|
2179
|
+
*/
|
2180
|
+
segments: Array<{
|
2181
|
+
/**
|
2182
|
+
* The text content of this segment.
|
2183
|
+
*/
|
2184
|
+
text: string;
|
2185
|
+
/**
|
2186
|
+
* The start time of this segment in seconds.
|
2187
|
+
*/
|
2188
|
+
startSecond: number;
|
2189
|
+
/**
|
2190
|
+
* The end time of this segment in seconds.
|
2191
|
+
*/
|
2192
|
+
endSecond: number;
|
2193
|
+
}>;
|
2194
|
+
/**
|
2195
|
+
* The detected language of the audio content, as an ISO-639-1 code (e.g., 'en' for English).
|
2196
|
+
* May be undefined if the language couldn't be detected.
|
2197
|
+
*/
|
2198
|
+
language: string | undefined;
|
2199
|
+
/**
|
2200
|
+
* The total duration of the audio file in seconds.
|
2201
|
+
* May be undefined if the duration couldn't be determined.
|
2202
|
+
*/
|
2203
|
+
durationInSeconds: number | undefined;
|
2204
|
+
/**
|
2205
|
+
Warnings for the call, e.g. unsupported settings.
|
2206
|
+
*/
|
2207
|
+
warnings: Array<TranscriptionModelV1CallWarning>;
|
2208
|
+
/**
|
2209
|
+
Optional request information for telemetry and debugging purposes.
|
2210
|
+
*/
|
2211
|
+
request?: {
|
2212
|
+
/**
|
2213
|
+
Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
|
2214
|
+
Non-HTTP(s) providers should not set this.
|
2215
|
+
*/
|
2216
|
+
body?: string;
|
2217
|
+
};
|
2218
|
+
/**
|
2219
|
+
Response information for telemetry and debugging purposes.
|
2220
|
+
*/
|
2221
|
+
response: {
|
2222
|
+
/**
|
2223
|
+
Timestamp for the start of the generated response.
|
2224
|
+
*/
|
2225
|
+
timestamp: Date;
|
2226
|
+
/**
|
2227
|
+
The ID of the response model that was used to generate the response.
|
2228
|
+
*/
|
2229
|
+
modelId: string;
|
2230
|
+
/**
|
2231
|
+
Response headers.
|
2232
|
+
*/
|
2233
|
+
headers: Record<string, string> | undefined;
|
2234
|
+
/**
|
2235
|
+
Response body.
|
2236
|
+
*/
|
2237
|
+
body?: unknown;
|
2238
|
+
};
|
2239
|
+
/**
|
2240
|
+
Additional provider-specific metadata. They are passed through
|
2241
|
+
from the provider to the AI SDK and enable provider-specific
|
2242
|
+
results that can be fully encapsulated in the provider.
|
2243
|
+
*/
|
2244
|
+
providerMetadata?: Record<string, Record<string, JSONValue>>;
|
2245
|
+
}>;
|
2246
|
+
};
|
2247
|
+
|
1245
2248
|
/**
|
1246
2249
|
* Provider for language, text embedding, and image generation models.
|
1247
2250
|
*/
|
@@ -1277,6 +2280,52 @@ interface ProviderV1 {
|
|
1277
2280
|
@returns {ImageModel} The image model associated with the id
|
1278
2281
|
*/
|
1279
2282
|
readonly imageModel?: (modelId: string) => ImageModelV1;
|
2283
|
+
/**
|
2284
|
+
Returns the transcription model with the given id.
|
2285
|
+
The model id is then passed to the provider function to get the model.
|
2286
|
+
|
2287
|
+
@param {string} modelId - The id of the model to return.
|
2288
|
+
|
2289
|
+
@returns {TranscriptionModel} The transcription model associated with the id
|
2290
|
+
*/
|
2291
|
+
readonly transcriptionModel?: (modelId: string) => TranscriptionModelV1;
|
2292
|
+
}
|
2293
|
+
|
2294
|
+
/**
|
2295
|
+
* Provider for language, text embedding, and image generation models.
|
2296
|
+
*/
|
2297
|
+
interface ProviderV2 {
|
2298
|
+
/**
|
2299
|
+
Returns the language model with the given id.
|
2300
|
+
The model id is then passed to the provider function to get the model.
|
2301
|
+
|
2302
|
+
@param {string} modelId - The id of the model to return.
|
2303
|
+
|
2304
|
+
@returns {LanguageModel} The language model associated with the id
|
2305
|
+
|
2306
|
+
@throws {NoSuchModelError} If no such model exists.
|
2307
|
+
*/
|
2308
|
+
languageModel(modelId: string): LanguageModelV2;
|
2309
|
+
/**
|
2310
|
+
Returns the text embedding model with the given id.
|
2311
|
+
The model id is then passed to the provider function to get the model.
|
2312
|
+
|
2313
|
+
@param {string} modelId - The id of the model to return.
|
2314
|
+
|
2315
|
+
@returns {LanguageModel} The language model associated with the id
|
2316
|
+
|
2317
|
+
@throws {NoSuchModelError} If no such model exists.
|
2318
|
+
*/
|
2319
|
+
textEmbeddingModel(modelId: string): EmbeddingModelV1<string>;
|
2320
|
+
/**
|
2321
|
+
Returns the image model with the given id.
|
2322
|
+
The model id is then passed to the provider function to get the model.
|
2323
|
+
|
2324
|
+
@param {string} modelId - The id of the model to return.
|
2325
|
+
|
2326
|
+
@returns {ImageModel} The image model associated with the id
|
2327
|
+
*/
|
2328
|
+
readonly imageModel: (modelId: string) => ImageModelV1;
|
1280
2329
|
}
|
1281
2330
|
|
1282
|
-
export { AISDKError, APICallError, type EmbeddingModelV1, type EmbeddingModelV1Embedding, EmptyResponseBodyError, type ImageModelV1, type ImageModelV1CallOptions, type ImageModelV1CallWarning, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV1, type LanguageModelV1CallOptions, type LanguageModelV1CallWarning, type LanguageModelV1FilePart, type LanguageModelV1FinishReason, type LanguageModelV1FunctionTool, type LanguageModelV1FunctionToolCall, type LanguageModelV1ImagePart, type LanguageModelV1LogProbs, type LanguageModelV1Message, type LanguageModelV1ObjectGenerationMode, type LanguageModelV1Prompt, type LanguageModelV1ProviderDefinedTool, type LanguageModelV1ProviderMetadata, type LanguageModelV1ReasoningPart, type LanguageModelV1RedactedReasoningPart, type LanguageModelV1Source, type LanguageModelV1StreamPart, type LanguageModelV1TextPart, type LanguageModelV1ToolCallPart, type LanguageModelV1ToolChoice, type LanguageModelV1ToolResultPart, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, type ProviderV1, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };
|
2331
|
+
export { AISDKError, APICallError, type EmbeddingModelV1, type EmbeddingModelV1Embedding, EmptyResponseBodyError, type Experimental_LanguageModelV2Middleware, type ImageModelV1, type ImageModelV1CallOptions, type ImageModelV1CallWarning, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV1, type LanguageModelV1CallOptions, type LanguageModelV1CallWarning, type LanguageModelV1FilePart, type LanguageModelV1FinishReason, type LanguageModelV1FunctionTool, type LanguageModelV1FunctionToolCall, type LanguageModelV1ImagePart, type LanguageModelV1LogProbs, type LanguageModelV1Message, type LanguageModelV1ObjectGenerationMode, type LanguageModelV1Prompt, type LanguageModelV1ProviderDefinedTool, type LanguageModelV1ProviderMetadata, type LanguageModelV1ReasoningPart, type LanguageModelV1RedactedReasoningPart, type LanguageModelV1Source, type LanguageModelV1StreamPart, type LanguageModelV1TextPart, type LanguageModelV1ToolCallPart, type LanguageModelV1ToolChoice, type LanguageModelV1ToolResultPart, type LanguageModelV2, type LanguageModelV2CallOptions, type LanguageModelV2CallWarning, type LanguageModelV2FilePart, type LanguageModelV2FinishReason, type LanguageModelV2FunctionTool, type LanguageModelV2FunctionToolCall, type LanguageModelV2LogProbs, type LanguageModelV2Message, type LanguageModelV2Middleware, type LanguageModelV2ObjectGenerationMode, type LanguageModelV2Prompt, type LanguageModelV2ProviderDefinedTool, type LanguageModelV2ProviderMetadata, type LanguageModelV2ProviderOptions, type LanguageModelV2ReasoningPart, type LanguageModelV2RedactedReasoningPart, type LanguageModelV2Source, type LanguageModelV2StreamPart, type LanguageModelV2TextPart, type LanguageModelV2ToolCallPart, type LanguageModelV2ToolChoice, type LanguageModelV2ToolResultPart, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, type ProviderV1, type ProviderV2, TooManyEmbeddingValuesForCallError, type TranscriptionModelV1, type TranscriptionModelV1CallOptions, type TranscriptionModelV1CallWarning, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };
|