@isdk/ai-tool 0.0.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.
Files changed (87) hide show
  1. package/README.cn.md +261 -0
  2. package/README.md +3 -0
  3. package/dist/chunk-EZFPVSGF.mjs +22 -0
  4. package/dist/chunk-PKECBABP.mjs +5085 -0
  5. package/dist/funcs.d.mts +6 -0
  6. package/dist/funcs.d.ts +6 -0
  7. package/dist/funcs.js +5016 -0
  8. package/dist/funcs.mjs +37 -0
  9. package/dist/index-D4KjfAKl.d.mts +606 -0
  10. package/dist/index-D4KjfAKl.d.ts +606 -0
  11. package/dist/index.d.mts +1097 -0
  12. package/dist/index.d.ts +1097 -0
  13. package/dist/index.js +5239 -0
  14. package/dist/index.mjs +399 -0
  15. package/dist/test/util.d.mts +7 -0
  16. package/dist/test/util.d.ts +7 -0
  17. package/dist/test/util.js +98 -0
  18. package/dist/test/util.mjs +61 -0
  19. package/docs/.nojekyll +1 -0
  20. package/docs/README.md +5 -0
  21. package/docs/classes/AbortError.md +359 -0
  22. package/docs/classes/AlreadyExistsError.md +339 -0
  23. package/docs/classes/BaseError.md +346 -0
  24. package/docs/classes/ClientTools.md +2705 -0
  25. package/docs/classes/CommonError.md +368 -0
  26. package/docs/classes/ConfigFile.md +346 -0
  27. package/docs/classes/EventClient.md +3183 -0
  28. package/docs/classes/EventServer.md +3138 -0
  29. package/docs/classes/EventToolFunc.md +2498 -0
  30. package/docs/classes/FStringPromptTemplate.md +1236 -0
  31. package/docs/classes/FewShotPromptTemplate.md +1286 -0
  32. package/docs/classes/GolangPromptTemplate.md +1236 -0
  33. package/docs/classes/HFEnvironment.md +212 -0
  34. package/docs/classes/HFInterpreter.md +386 -0
  35. package/docs/classes/HFTemplate.md +79 -0
  36. package/docs/classes/HfPromptTemplate.md +1236 -0
  37. package/docs/classes/NotFoundError.md +339 -0
  38. package/docs/classes/NotImplementationError.md +339 -0
  39. package/docs/classes/PromptExampleSelector.md +207 -0
  40. package/docs/classes/PromptTemplate.md +1163 -0
  41. package/docs/classes/ReadableStreamError.md +359 -0
  42. package/docs/classes/ResClientTools.md +2859 -0
  43. package/docs/classes/ResServerTools.md +2783 -0
  44. package/docs/classes/SSEChannel.md +289 -0
  45. package/docs/classes/ServerTools.md +2633 -0
  46. package/docs/classes/ToolFunc.md +2124 -0
  47. package/docs/enums/ErrorCode.md +217 -0
  48. package/docs/enums/XXHashAlgorithm.md +30 -0
  49. package/docs/interfaces/AIChatAssistantMessageParam.md +84 -0
  50. package/docs/interfaces/AIChatContentPartImage.md +36 -0
  51. package/docs/interfaces/AIChatContentPartText.md +30 -0
  52. package/docs/interfaces/AIChatMessageParamBase.md +35 -0
  53. package/docs/interfaces/AIChatMessageToolCall.md +48 -0
  54. package/docs/interfaces/AIChatSystemMessageParam.md +51 -0
  55. package/docs/interfaces/AIChatToolMessageParam.md +62 -0
  56. package/docs/interfaces/AIChatUserMessageParam.md +95 -0
  57. package/docs/interfaces/AIResult.md +65 -0
  58. package/docs/interfaces/AIStreamCallbacksAndOptions.md +158 -0
  59. package/docs/interfaces/AIStreamParser.md +33 -0
  60. package/docs/interfaces/AIStreamParserOptions.md +23 -0
  61. package/docs/interfaces/BaseFunc.md +145 -0
  62. package/docs/interfaces/BaseFuncItem.md +99 -0
  63. package/docs/interfaces/ClientFuncItem.md +181 -0
  64. package/docs/interfaces/DotenvExpandOptions.md +51 -0
  65. package/docs/interfaces/DotenvExpandOutput.md +30 -0
  66. package/docs/interfaces/DotenvParseInput.md +7 -0
  67. package/docs/interfaces/DotenvParseOutput.md +7 -0
  68. package/docs/interfaces/DotenvPopulateInput.md +7 -0
  69. package/docs/interfaces/EventClientFuncParams.md +66 -0
  70. package/docs/interfaces/EventServerFuncParams.md +79 -0
  71. package/docs/interfaces/FewShotPromptTemplateOptions.md +179 -0
  72. package/docs/interfaces/FuncItem.md +130 -0
  73. package/docs/interfaces/FuncParam.md +67 -0
  74. package/docs/interfaces/FuncParams.md +7 -0
  75. package/docs/interfaces/Funcs.md +7 -0
  76. package/docs/interfaces/IOptions.md +30 -0
  77. package/docs/interfaces/JsonFilter.md +7 -0
  78. package/docs/interfaces/PromptExampleSelectorOptions.md +39 -0
  79. package/docs/interfaces/PromptTemplateOptions.md +84 -0
  80. package/docs/interfaces/RemoteFuncItem.md +167 -0
  81. package/docs/interfaces/ResClientFuncParams.md +34 -0
  82. package/docs/interfaces/ResServerFuncParams.md +79 -0
  83. package/docs/interfaces/SanitizeFilenameOptions.md +30 -0
  84. package/docs/interfaces/ServerFuncItem.md +192 -0
  85. package/docs/interfaces/ServerFuncParams.md +44 -0
  86. package/docs/modules.md +2707 -0
  87. package/package.json +112 -0
@@ -0,0 +1,359 @@
1
+ [@isdk/ai-tool](../README.md) / [Exports](../modules.md) / ReadableStreamError
2
+
3
+ # Class: ReadableStreamError
4
+
5
+ BaseError class that extends the Error class.
6
+
7
+ **`Example`**
8
+
9
+ ```ts
10
+ // Create a custom error
11
+ class CustomError extends BaseError {
12
+ static code = 'customError';
13
+ constructor(message: string) {
14
+ super(message);
15
+ }
16
+ }
17
+
18
+ // Throw the custom error
19
+ throw new CustomError('This is a custom error');
20
+ ```
21
+
22
+ **`Description`**
23
+
24
+ This class is used to create custom errors that extend the built-in Error class. It provides a way to define custom error codes and additional data associated with the error.
25
+
26
+ **`Method`**
27
+
28
+ toJSON - Returns a JSON representation of the error.
29
+
30
+ **`Method`**
31
+
32
+ fromJSON - Creates a new BaseError instance from a JSON representation.
33
+
34
+ ## Hierarchy
35
+
36
+ - [`BaseError`](BaseError.md)
37
+
38
+ ↳ **`ReadableStreamError`**
39
+
40
+ ## Table of contents
41
+
42
+ ### Constructors
43
+
44
+ - [constructor](ReadableStreamError.md#constructor)
45
+
46
+ ### Properties
47
+
48
+ - [caller](ReadableStreamError.md#caller)
49
+ - [cause](ReadableStreamError.md#cause)
50
+ - [code](ReadableStreamError.md#code)
51
+ - [data](ReadableStreamError.md#data)
52
+ - [message](ReadableStreamError.md#message)
53
+ - [name](ReadableStreamError.md#name)
54
+ - [stack](ReadableStreamError.md#stack)
55
+ - [code](ReadableStreamError.md#code-1)
56
+ - [prepareStackTrace](ReadableStreamError.md#preparestacktrace)
57
+ - [stackTraceLimit](ReadableStreamError.md#stacktracelimit)
58
+
59
+ ### Methods
60
+
61
+ - [fromJSON](ReadableStreamError.md#fromjson)
62
+ - [toJSON](ReadableStreamError.md#tojson)
63
+ - [captureStackTrace](ReadableStreamError.md#capturestacktrace)
64
+ - [createErrorClass](ReadableStreamError.md#createerrorclass)
65
+
66
+ ## Constructors
67
+
68
+ ### constructor
69
+
70
+ • **new ReadableStreamError**(`msg`, `code?`): [`ReadableStreamError`](ReadableStreamError.md)
71
+
72
+ #### Parameters
73
+
74
+ | Name | Type | Default value |
75
+ | :------ | :------ | :------ |
76
+ | `msg` | `string` | `undefined` |
77
+ | `code` | `number` | `RStreamErrCode` |
78
+
79
+ #### Returns
80
+
81
+ [`ReadableStreamError`](ReadableStreamError.md)
82
+
83
+ #### Overrides
84
+
85
+ [BaseError](BaseError.md).[constructor](BaseError.md#constructor)
86
+
87
+ #### Defined in
88
+
89
+ [packages/ai-tool/src/utils/stream/error-readable-stream.ts:7](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/stream/error-readable-stream.ts#L7)
90
+
91
+ ## Properties
92
+
93
+ ### caller
94
+
95
+ • **caller**: `string`
96
+
97
+ The name of the function that threw the error.
98
+
99
+ #### Inherited from
100
+
101
+ [BaseError](BaseError.md).[caller](BaseError.md#caller)
102
+
103
+ #### Defined in
104
+
105
+ [packages/ai-tool/src/utils/base-error.ts:64](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L64)
106
+
107
+ ___
108
+
109
+ ### cause
110
+
111
+ • `Optional` **cause**: `unknown`
112
+
113
+ #### Inherited from
114
+
115
+ [BaseError](BaseError.md).[cause](BaseError.md#cause)
116
+
117
+ #### Defined in
118
+
119
+ node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es2022.error.d.ts:24
120
+
121
+ ___
122
+
123
+ ### code
124
+
125
+ • **code**: [`ErrorCodeType`](../modules.md#errorcodetype)
126
+
127
+ #### Inherited from
128
+
129
+ [BaseError](BaseError.md).[code](BaseError.md#code)
130
+
131
+ #### Defined in
132
+
133
+ [packages/ai-tool/src/utils/base-error.ts:65](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L65)
134
+
135
+ ___
136
+
137
+ ### data
138
+
139
+ • `Optional` **data**: `any`
140
+
141
+ Additional data associated with the error.
142
+
143
+ #### Inherited from
144
+
145
+ [BaseError](BaseError.md).[data](BaseError.md#data)
146
+
147
+ #### Defined in
148
+
149
+ [packages/ai-tool/src/utils/base-error.ts:66](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L66)
150
+
151
+ ___
152
+
153
+ ### message
154
+
155
+ • **message**: `string`
156
+
157
+ #### Inherited from
158
+
159
+ [BaseError](BaseError.md).[message](BaseError.md#message)
160
+
161
+ #### Defined in
162
+
163
+ node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es5.d.ts:1077
164
+
165
+ ___
166
+
167
+ ### name
168
+
169
+ • **name**: `string`
170
+
171
+ #### Inherited from
172
+
173
+ [BaseError](BaseError.md).[name](BaseError.md#name)
174
+
175
+ #### Defined in
176
+
177
+ node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es5.d.ts:1076
178
+
179
+ ___
180
+
181
+ ### stack
182
+
183
+ • `Optional` **stack**: `string`
184
+
185
+ #### Inherited from
186
+
187
+ [BaseError](BaseError.md).[stack](BaseError.md#stack)
188
+
189
+ #### Defined in
190
+
191
+ node_modules/.pnpm/typescript@5.4.5/node_modules/typescript/lib/lib.es5.d.ts:1078
192
+
193
+ ___
194
+
195
+ ### code
196
+
197
+ ▪ `Static` **code**: [`ErrorCodeType`](../modules.md#errorcodetype)
198
+
199
+ The error code associated with the error.
200
+
201
+ #### Inherited from
202
+
203
+ [BaseError](BaseError.md).[code](BaseError.md#code-1)
204
+
205
+ #### Defined in
206
+
207
+ [packages/ai-tool/src/utils/base-error.ts:63](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L63)
208
+
209
+ ___
210
+
211
+ ### prepareStackTrace
212
+
213
+ ▪ `Static` `Optional` **prepareStackTrace**: (`err`: `Error`, `stackTraces`: `CallSite`[]) => `any`
214
+
215
+ Optional override for formatting stack traces
216
+
217
+ **`See`**
218
+
219
+ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
220
+
221
+ #### Type declaration
222
+
223
+ ▸ (`err`, `stackTraces`): `any`
224
+
225
+ ##### Parameters
226
+
227
+ | Name | Type |
228
+ | :------ | :------ |
229
+ | `err` | `Error` |
230
+ | `stackTraces` | `CallSite`[] |
231
+
232
+ ##### Returns
233
+
234
+ `any`
235
+
236
+ #### Inherited from
237
+
238
+ [BaseError](BaseError.md).[prepareStackTrace](BaseError.md#preparestacktrace)
239
+
240
+ #### Defined in
241
+
242
+ node_modules/.pnpm/@types+node@20.12.7/node_modules/@types/node/globals.d.ts:28
243
+
244
+ ___
245
+
246
+ ### stackTraceLimit
247
+
248
+ ▪ `Static` **stackTraceLimit**: `number`
249
+
250
+ #### Inherited from
251
+
252
+ [BaseError](BaseError.md).[stackTraceLimit](BaseError.md#stacktracelimit)
253
+
254
+ #### Defined in
255
+
256
+ node_modules/.pnpm/@types+node@20.12.7/node_modules/@types/node/globals.d.ts:30
257
+
258
+ ## Methods
259
+
260
+ ### fromJSON
261
+
262
+ ▸ **fromJSON**(`json`): [`BaseError`](BaseError.md)
263
+
264
+ Creates a new BaseError instance from a JSON representation.
265
+
266
+ #### Parameters
267
+
268
+ | Name | Type | Description |
269
+ | :------ | :------ | :------ |
270
+ | `json` | `any` | A JSON representation of the error. |
271
+
272
+ #### Returns
273
+
274
+ [`BaseError`](BaseError.md)
275
+
276
+ A new BaseError instance.
277
+
278
+ #### Inherited from
279
+
280
+ [BaseError](BaseError.md).[fromJSON](BaseError.md#fromjson)
281
+
282
+ #### Defined in
283
+
284
+ [packages/ai-tool/src/utils/base-error.ts:129](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L129)
285
+
286
+ ___
287
+
288
+ ### toJSON
289
+
290
+ ▸ **toJSON**(): `any`
291
+
292
+ Returns a JSON representation of the error.
293
+
294
+ #### Returns
295
+
296
+ `any`
297
+
298
+ A JSON representation of the error.
299
+
300
+ #### Inherited from
301
+
302
+ [BaseError](BaseError.md).[toJSON](BaseError.md#tojson)
303
+
304
+ #### Defined in
305
+
306
+ [packages/ai-tool/src/utils/base-error.ts:109](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L109)
307
+
308
+ ___
309
+
310
+ ### captureStackTrace
311
+
312
+ ▸ **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`
313
+
314
+ Create .stack property on a target object
315
+
316
+ #### Parameters
317
+
318
+ | Name | Type |
319
+ | :------ | :------ |
320
+ | `targetObject` | `object` |
321
+ | `constructorOpt?` | `Function` |
322
+
323
+ #### Returns
324
+
325
+ `void`
326
+
327
+ #### Inherited from
328
+
329
+ [BaseError](BaseError.md).[captureStackTrace](BaseError.md#capturestacktrace)
330
+
331
+ #### Defined in
332
+
333
+ node_modules/.pnpm/@types+node@20.12.7/node_modules/@types/node/globals.d.ts:21
334
+
335
+ ___
336
+
337
+ ### createErrorClass
338
+
339
+ ▸ **createErrorClass**(`aType`, `aErrorCode?`, `ParentErrorClass?`): typeof [`BaseError`](BaseError.md)
340
+
341
+ #### Parameters
342
+
343
+ | Name | Type | Default value |
344
+ | :------ | :------ | :------ |
345
+ | `aType` | `string` | `undefined` |
346
+ | `aErrorCode?` | `string` \| `number` \| typeof `AbstractError` | `undefined` |
347
+ | `ParentErrorClass` | typeof [`BaseError`](BaseError.md) | `BaseError` |
348
+
349
+ #### Returns
350
+
351
+ typeof [`BaseError`](BaseError.md)
352
+
353
+ #### Inherited from
354
+
355
+ [BaseError](BaseError.md).[createErrorClass](BaseError.md#createerrorclass)
356
+
357
+ #### Defined in
358
+
359
+ [packages/ai-tool/src/utils/base-error.ts:68](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L68)