@codehz/ai 0.8.2 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/dist/index.d.mts +191 -28
- package/dist/index.mjs +265 -49
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -97,7 +97,11 @@ type AIRequest = {
|
|
|
97
97
|
temperature?: number; // provider/model-defined generation parameter
|
|
98
98
|
maxOutputTokens?: number; // 最大输出 token
|
|
99
99
|
reasoningLevel?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max"; // 可移植思考力度
|
|
100
|
-
include?: {
|
|
100
|
+
include?: {
|
|
101
|
+
usage?: "off" | "best_effort" | "required";
|
|
102
|
+
billing?: "off" | "best_effort" | "required";
|
|
103
|
+
providerMetadata?: "off" | "best_effort";
|
|
104
|
+
};
|
|
101
105
|
};
|
|
102
106
|
```
|
|
103
107
|
|
|
@@ -530,7 +534,9 @@ const r2 = await collectStream(client.stream({ input, tools }));
|
|
|
530
534
|
|
|
531
535
|
## 辅助信息采集
|
|
532
536
|
|
|
533
|
-
usage / billing / providerMetadata 由 adapter 在流结束时经 `response.auxiliary` 与 `AIResponse` 字段交付。`AuxiliaryCollector` 是 provider 内部实现细节,`0.5.0` 起不再从根入口导出。`lookup` / `postprocessBilling` 为 experimental 扩展点,库内 HTTP adapter 默认未接线。
|
|
537
|
+
`usage` / `billing` / `providerMetadata` 由 adapter 在流结束时经 `response.auxiliary` 与 `AIResponse` 字段交付。`AuxiliaryCollector` 是 provider 内部实现细节,`0.5.0` 起不再从根入口导出。`lookup` / `postprocessBilling` 为 experimental 扩展点,库内 HTTP adapter 默认未接线。
|
|
538
|
+
|
|
539
|
+
`usage` 与 `billing` 的 `include` 支持三种模式:`off` 表示不采集;`best_effort`(默认)表示尽可能采集,缺失时静默;`required` 表示缺失时发出 `USAGE_MISSING` 或 `BILLING_MISSING` warning。估算 billing 仍会发出 `BILLING_ESTIMATED` warning。
|
|
534
540
|
|
|
535
541
|
## 开发命令
|
|
536
542
|
|