ai 2.0.1 → 2.1.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/dist/ai-stream.mjs +4 -2
- package/dist/anthropic-stream.mjs +6 -4
- package/dist/chunk-2JQWCLY2.mjs +70 -0
- package/dist/chunk-7KLTYB74.mjs +70 -0
- package/dist/{chunk-TJMME6CL.mjs → chunk-BJMBMGA3.mjs} +12 -2
- package/dist/{chunk-PEYAHBDF.mjs → chunk-KKQRUR3E.mjs} +12 -4
- package/dist/{chunk-NK2CVBLI.mjs → chunk-RBP6ONSV.mjs} +19 -12
- package/dist/{chunk-JGDC3BXD.mjs → chunk-TWW2ODJW.mjs} +13 -3
- package/dist/{chunk-GT4HKF2X.mjs → chunk-U2OQ6HW6.mjs} +13 -5
- package/dist/{chunk-265FSSO4.mjs → chunk-UJV6VDVU.mjs} +9 -3
- package/dist/huggingface-stream.mjs +6 -4
- package/dist/index.mjs +11 -7
- package/dist/index.test.js +562 -6
- package/dist/index.test.mjs +283 -7
- package/dist/langchain-stream.mjs +6 -4
- package/dist/openai-stream.mjs +6 -4
- package/dist/streaming-text-response.mjs +4 -2
- package/package.json +18 -6
- package/vue/dist/chunk-FT26CHLO.mjs +137 -0
- package/vue/dist/chunk-OYI6GFBM.mjs +178 -0
- package/{dist/chunk-2L3ZO4UM.mjs → vue/dist/chunk-WXH4YPZV.mjs} +14 -5
- package/vue/dist/index.d.ts +4 -0
- package/vue/dist/index.js +384 -0
- package/vue/dist/index.mjs +11 -0
- package/vue/dist/types-f862f74a.d.ts +123 -0
- package/vue/dist/use-chat.d.ts +39 -0
- package/vue/dist/use-chat.js +252 -0
- package/vue/dist/use-chat.mjs +7 -0
- package/vue/dist/use-completion.d.ts +38 -0
- package/vue/dist/use-completion.js +212 -0
- package/vue/dist/use-completion.mjs +7 -0
package/dist/ai-stream.mjs
CHANGED
@@ -2,9 +2,11 @@ import {
|
|
2
2
|
AIStream,
|
3
3
|
createCallbacksTransformer,
|
4
4
|
createEventStreamTransformer,
|
5
|
+
init_ai_stream,
|
5
6
|
trimStartOfStreamHelper
|
6
|
-
} from "./chunk-
|
7
|
-
import "./chunk-
|
7
|
+
} from "./chunk-UJV6VDVU.mjs";
|
8
|
+
import "./chunk-2JQWCLY2.mjs";
|
9
|
+
init_ai_stream();
|
8
10
|
export {
|
9
11
|
AIStream,
|
10
12
|
createCallbacksTransformer,
|
@@ -1,8 +1,10 @@
|
|
1
1
|
import {
|
2
|
-
AnthropicStream
|
3
|
-
|
4
|
-
|
5
|
-
import "./chunk-
|
2
|
+
AnthropicStream,
|
3
|
+
init_anthropic_stream
|
4
|
+
} from "./chunk-TWW2ODJW.mjs";
|
5
|
+
import "./chunk-UJV6VDVU.mjs";
|
6
|
+
import "./chunk-2JQWCLY2.mjs";
|
7
|
+
init_anthropic_stream();
|
6
8
|
export {
|
7
9
|
AnthropicStream
|
8
10
|
};
|
@@ -0,0 +1,70 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __defProps = Object.defineProperties;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
10
|
+
var __spreadValues = (a, b) => {
|
11
|
+
for (var prop in b || (b = {}))
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
14
|
+
if (__getOwnPropSymbols)
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
16
|
+
if (__propIsEnum.call(b, prop))
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
18
|
+
}
|
19
|
+
return a;
|
20
|
+
};
|
21
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
22
|
+
var __esm = (fn, res) => function __init() {
|
23
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
24
|
+
};
|
25
|
+
var __commonJS = (cb, mod) => function __require() {
|
26
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
27
|
+
};
|
28
|
+
var __export = (target, all) => {
|
29
|
+
for (var name in all)
|
30
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
31
|
+
};
|
32
|
+
var __copyProps = (to, from, except, desc) => {
|
33
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
34
|
+
for (let key of __getOwnPropNames(from))
|
35
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
36
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
37
|
+
}
|
38
|
+
return to;
|
39
|
+
};
|
40
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
41
|
+
var __async = (__this, __arguments, generator) => {
|
42
|
+
return new Promise((resolve, reject) => {
|
43
|
+
var fulfilled = (value) => {
|
44
|
+
try {
|
45
|
+
step(generator.next(value));
|
46
|
+
} catch (e) {
|
47
|
+
reject(e);
|
48
|
+
}
|
49
|
+
};
|
50
|
+
var rejected = (value) => {
|
51
|
+
try {
|
52
|
+
step(generator.throw(value));
|
53
|
+
} catch (e) {
|
54
|
+
reject(e);
|
55
|
+
}
|
56
|
+
};
|
57
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
58
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
59
|
+
});
|
60
|
+
};
|
61
|
+
|
62
|
+
export {
|
63
|
+
__spreadValues,
|
64
|
+
__spreadProps,
|
65
|
+
__esm,
|
66
|
+
__commonJS,
|
67
|
+
__export,
|
68
|
+
__toCommonJS,
|
69
|
+
__async
|
70
|
+
};
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import {
|
2
|
+
AnthropicStream,
|
3
|
+
init_anthropic_stream
|
4
|
+
} from "./chunk-TWW2ODJW.mjs";
|
5
|
+
import {
|
6
|
+
HuggingFaceStream,
|
7
|
+
init_huggingface_stream
|
8
|
+
} from "./chunk-KKQRUR3E.mjs";
|
9
|
+
import {
|
10
|
+
LangChainStream,
|
11
|
+
init_langchain_stream
|
12
|
+
} from "./chunk-U2OQ6HW6.mjs";
|
13
|
+
import {
|
14
|
+
OpenAIStream,
|
15
|
+
init_openai_stream
|
16
|
+
} from "./chunk-BJMBMGA3.mjs";
|
17
|
+
import {
|
18
|
+
AIStream,
|
19
|
+
createCallbacksTransformer,
|
20
|
+
createEventStreamTransformer,
|
21
|
+
init_ai_stream,
|
22
|
+
trimStartOfStreamHelper
|
23
|
+
} from "./chunk-UJV6VDVU.mjs";
|
24
|
+
import {
|
25
|
+
StreamingTextResponse,
|
26
|
+
init_streaming_text_response,
|
27
|
+
streamToResponse
|
28
|
+
} from "./chunk-RBP6ONSV.mjs";
|
29
|
+
import {
|
30
|
+
__esm,
|
31
|
+
__export
|
32
|
+
} from "./chunk-2JQWCLY2.mjs";
|
33
|
+
|
34
|
+
// shared/types.ts
|
35
|
+
var init_types = __esm({
|
36
|
+
"shared/types.ts"() {
|
37
|
+
"use strict";
|
38
|
+
}
|
39
|
+
});
|
40
|
+
|
41
|
+
// streams/index.ts
|
42
|
+
var streams_exports = {};
|
43
|
+
__export(streams_exports, {
|
44
|
+
AIStream: () => AIStream,
|
45
|
+
AnthropicStream: () => AnthropicStream,
|
46
|
+
HuggingFaceStream: () => HuggingFaceStream,
|
47
|
+
LangChainStream: () => LangChainStream,
|
48
|
+
OpenAIStream: () => OpenAIStream,
|
49
|
+
StreamingTextResponse: () => StreamingTextResponse,
|
50
|
+
createCallbacksTransformer: () => createCallbacksTransformer,
|
51
|
+
createEventStreamTransformer: () => createEventStreamTransformer,
|
52
|
+
streamToResponse: () => streamToResponse,
|
53
|
+
trimStartOfStreamHelper: () => trimStartOfStreamHelper
|
54
|
+
});
|
55
|
+
var init_streams = __esm({
|
56
|
+
"streams/index.ts"() {
|
57
|
+
init_ai_stream();
|
58
|
+
init_openai_stream();
|
59
|
+
init_streaming_text_response();
|
60
|
+
init_huggingface_stream();
|
61
|
+
init_anthropic_stream();
|
62
|
+
init_langchain_stream();
|
63
|
+
init_types();
|
64
|
+
}
|
65
|
+
});
|
66
|
+
|
67
|
+
export {
|
68
|
+
streams_exports,
|
69
|
+
init_streams
|
70
|
+
};
|
@@ -1,7 +1,11 @@
|
|
1
1
|
import {
|
2
2
|
AIStream,
|
3
|
+
init_ai_stream,
|
3
4
|
trimStartOfStreamHelper
|
4
|
-
} from "./chunk-
|
5
|
+
} from "./chunk-UJV6VDVU.mjs";
|
6
|
+
import {
|
7
|
+
__esm
|
8
|
+
} from "./chunk-2JQWCLY2.mjs";
|
5
9
|
|
6
10
|
// streams/openai-stream.ts
|
7
11
|
function parseOpenAIStream() {
|
@@ -18,7 +22,13 @@ function parseOpenAIStream() {
|
|
18
22
|
function OpenAIStream(res, cb) {
|
19
23
|
return AIStream(res, parseOpenAIStream(), cb);
|
20
24
|
}
|
25
|
+
var init_openai_stream = __esm({
|
26
|
+
"streams/openai-stream.ts"() {
|
27
|
+
init_ai_stream();
|
28
|
+
}
|
29
|
+
});
|
21
30
|
|
22
31
|
export {
|
23
|
-
OpenAIStream
|
32
|
+
OpenAIStream,
|
33
|
+
init_openai_stream
|
24
34
|
};
|
@@ -1,10 +1,12 @@
|
|
1
1
|
import {
|
2
2
|
createCallbacksTransformer,
|
3
|
+
init_ai_stream,
|
3
4
|
trimStartOfStreamHelper
|
4
|
-
} from "./chunk-
|
5
|
+
} from "./chunk-UJV6VDVU.mjs";
|
5
6
|
import {
|
6
|
-
__async
|
7
|
-
|
7
|
+
__async,
|
8
|
+
__esm
|
9
|
+
} from "./chunk-2JQWCLY2.mjs";
|
8
10
|
|
9
11
|
// streams/huggingface-stream.ts
|
10
12
|
function createParser(res) {
|
@@ -37,7 +39,13 @@ function createParser(res) {
|
|
37
39
|
function HuggingFaceStream(res, callbacks) {
|
38
40
|
return createParser(res).pipeThrough(createCallbacksTransformer(callbacks));
|
39
41
|
}
|
42
|
+
var init_huggingface_stream = __esm({
|
43
|
+
"streams/huggingface-stream.ts"() {
|
44
|
+
init_ai_stream();
|
45
|
+
}
|
46
|
+
});
|
40
47
|
|
41
48
|
export {
|
42
|
-
HuggingFaceStream
|
49
|
+
HuggingFaceStream,
|
50
|
+
init_huggingface_stream
|
43
51
|
};
|
@@ -1,19 +1,10 @@
|
|
1
1
|
import {
|
2
|
+
__esm,
|
2
3
|
__spreadProps,
|
3
4
|
__spreadValues
|
4
|
-
} from "./chunk-
|
5
|
+
} from "./chunk-2JQWCLY2.mjs";
|
5
6
|
|
6
7
|
// streams/streaming-text-response.ts
|
7
|
-
var StreamingTextResponse = class extends Response {
|
8
|
-
constructor(res, init) {
|
9
|
-
super(res, __spreadProps(__spreadValues({}, init), {
|
10
|
-
status: 200,
|
11
|
-
headers: __spreadValues({
|
12
|
-
"Content-Type": "text/plain; charset=utf-8"
|
13
|
-
}, init == null ? void 0 : init.headers)
|
14
|
-
}));
|
15
|
-
}
|
16
|
-
};
|
17
8
|
function streamToResponse(res, response, init) {
|
18
9
|
response.writeHead((init == null ? void 0 : init.status) || 200, __spreadValues({
|
19
10
|
"Content-Type": "text/plain; charset=utf-8"
|
@@ -31,8 +22,24 @@ function streamToResponse(res, response, init) {
|
|
31
22
|
}
|
32
23
|
read();
|
33
24
|
}
|
25
|
+
var StreamingTextResponse;
|
26
|
+
var init_streaming_text_response = __esm({
|
27
|
+
"streams/streaming-text-response.ts"() {
|
28
|
+
StreamingTextResponse = class extends Response {
|
29
|
+
constructor(res, init) {
|
30
|
+
super(res, __spreadProps(__spreadValues({}, init), {
|
31
|
+
status: 200,
|
32
|
+
headers: __spreadValues({
|
33
|
+
"Content-Type": "text/plain; charset=utf-8"
|
34
|
+
}, init == null ? void 0 : init.headers)
|
35
|
+
}));
|
36
|
+
}
|
37
|
+
};
|
38
|
+
}
|
39
|
+
});
|
34
40
|
|
35
41
|
export {
|
36
42
|
StreamingTextResponse,
|
37
|
-
streamToResponse
|
43
|
+
streamToResponse,
|
44
|
+
init_streaming_text_response
|
38
45
|
};
|
@@ -1,6 +1,10 @@
|
|
1
1
|
import {
|
2
|
-
AIStream
|
3
|
-
|
2
|
+
AIStream,
|
3
|
+
init_ai_stream
|
4
|
+
} from "./chunk-UJV6VDVU.mjs";
|
5
|
+
import {
|
6
|
+
__esm
|
7
|
+
} from "./chunk-2JQWCLY2.mjs";
|
4
8
|
|
5
9
|
// streams/anthropic-stream.ts
|
6
10
|
function parseAnthropicStream() {
|
@@ -16,7 +20,13 @@ function parseAnthropicStream() {
|
|
16
20
|
function AnthropicStream(res, cb) {
|
17
21
|
return AIStream(res, parseAnthropicStream(), cb);
|
18
22
|
}
|
23
|
+
var init_anthropic_stream = __esm({
|
24
|
+
"streams/anthropic-stream.ts"() {
|
25
|
+
init_ai_stream();
|
26
|
+
}
|
27
|
+
});
|
19
28
|
|
20
29
|
export {
|
21
|
-
AnthropicStream
|
30
|
+
AnthropicStream,
|
31
|
+
init_anthropic_stream
|
22
32
|
};
|
@@ -1,9 +1,11 @@
|
|
1
1
|
import {
|
2
|
-
createCallbacksTransformer
|
3
|
-
|
2
|
+
createCallbacksTransformer,
|
3
|
+
init_ai_stream
|
4
|
+
} from "./chunk-UJV6VDVU.mjs";
|
4
5
|
import {
|
5
|
-
__async
|
6
|
-
|
6
|
+
__async,
|
7
|
+
__esm
|
8
|
+
} from "./chunk-2JQWCLY2.mjs";
|
7
9
|
|
8
10
|
// streams/langchain-stream.ts
|
9
11
|
function LangChainStream(callbacks) {
|
@@ -27,7 +29,13 @@ function LangChainStream(callbacks) {
|
|
27
29
|
}
|
28
30
|
};
|
29
31
|
}
|
32
|
+
var init_langchain_stream = __esm({
|
33
|
+
"streams/langchain-stream.ts"() {
|
34
|
+
init_ai_stream();
|
35
|
+
}
|
36
|
+
});
|
30
37
|
|
31
38
|
export {
|
32
|
-
LangChainStream
|
39
|
+
LangChainStream,
|
40
|
+
init_langchain_stream
|
33
41
|
};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import {
|
2
|
-
__async
|
3
|
-
|
2
|
+
__async,
|
3
|
+
__esm
|
4
|
+
} from "./chunk-2JQWCLY2.mjs";
|
4
5
|
|
5
6
|
// streams/ai-stream.ts
|
6
7
|
import {
|
@@ -82,10 +83,15 @@ function AIStream(res, customParser, callbacks) {
|
|
82
83
|
});
|
83
84
|
return stream.pipeThrough(createEventStreamTransformer(customParser)).pipeThrough(createCallbacksTransformer(callbacks));
|
84
85
|
}
|
86
|
+
var init_ai_stream = __esm({
|
87
|
+
"streams/ai-stream.ts"() {
|
88
|
+
}
|
89
|
+
});
|
85
90
|
|
86
91
|
export {
|
87
92
|
createEventStreamTransformer,
|
88
93
|
createCallbacksTransformer,
|
89
94
|
trimStartOfStreamHelper,
|
90
|
-
AIStream
|
95
|
+
AIStream,
|
96
|
+
init_ai_stream
|
91
97
|
};
|
@@ -1,8 +1,10 @@
|
|
1
1
|
import {
|
2
|
-
HuggingFaceStream
|
3
|
-
|
4
|
-
|
5
|
-
import "./chunk-
|
2
|
+
HuggingFaceStream,
|
3
|
+
init_huggingface_stream
|
4
|
+
} from "./chunk-KKQRUR3E.mjs";
|
5
|
+
import "./chunk-UJV6VDVU.mjs";
|
6
|
+
import "./chunk-2JQWCLY2.mjs";
|
7
|
+
init_huggingface_stream();
|
6
8
|
export {
|
7
9
|
HuggingFaceStream
|
8
10
|
};
|
package/dist/index.mjs
CHANGED
@@ -1,26 +1,30 @@
|
|
1
|
+
import {
|
2
|
+
init_streams
|
3
|
+
} from "./chunk-7KLTYB74.mjs";
|
1
4
|
import {
|
2
5
|
AnthropicStream
|
3
|
-
} from "./chunk-
|
6
|
+
} from "./chunk-TWW2ODJW.mjs";
|
4
7
|
import {
|
5
8
|
HuggingFaceStream
|
6
|
-
} from "./chunk-
|
9
|
+
} from "./chunk-KKQRUR3E.mjs";
|
7
10
|
import {
|
8
11
|
LangChainStream
|
9
|
-
} from "./chunk-
|
12
|
+
} from "./chunk-U2OQ6HW6.mjs";
|
10
13
|
import {
|
11
14
|
OpenAIStream
|
12
|
-
} from "./chunk-
|
15
|
+
} from "./chunk-BJMBMGA3.mjs";
|
13
16
|
import {
|
14
17
|
AIStream,
|
15
18
|
createCallbacksTransformer,
|
16
19
|
createEventStreamTransformer,
|
17
20
|
trimStartOfStreamHelper
|
18
|
-
} from "./chunk-
|
21
|
+
} from "./chunk-UJV6VDVU.mjs";
|
19
22
|
import {
|
20
23
|
StreamingTextResponse,
|
21
24
|
streamToResponse
|
22
|
-
} from "./chunk-
|
23
|
-
import "./chunk-
|
25
|
+
} from "./chunk-RBP6ONSV.mjs";
|
26
|
+
import "./chunk-2JQWCLY2.mjs";
|
27
|
+
init_streams();
|
24
28
|
export {
|
25
29
|
AIStream,
|
26
30
|
AnthropicStream,
|