ai 2.2.15 → 2.2.17
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/index.d.ts +25 -4
- package/package.json +1 -1
- package/prompts/dist/index.d.ts +2 -2
- package/react/dist/index.d.ts +2 -2
- package/solid/dist/index.d.ts +2 -2
- package/solid/dist/index.js +10 -4
- package/solid/dist/index.mjs +10 -4
- package/svelte/dist/index.d.ts +2 -2
- package/vue/dist/index.d.ts +2 -2
- package/vue/dist/index.js +10 -4
- package/vue/dist/index.mjs +10 -4
package/dist/index.d.ts
CHANGED
@@ -38,7 +38,7 @@ interface Function {
|
|
38
38
|
/**
|
39
39
|
* Shared types between the API and UI packages.
|
40
40
|
*/
|
41
|
-
|
41
|
+
interface Message {
|
42
42
|
id: string;
|
43
43
|
createdAt?: Date;
|
44
44
|
content: string;
|
@@ -54,7 +54,7 @@ type Message = {
|
|
54
54
|
* not be set.
|
55
55
|
*/
|
56
56
|
function_call?: string | FunctionCall;
|
57
|
-
}
|
57
|
+
}
|
58
58
|
type CreateMessage = Omit<Message, 'id'> & {
|
59
59
|
id?: Message['id'];
|
60
60
|
};
|
@@ -284,6 +284,10 @@ interface Completion {
|
|
284
284
|
* The object type, which is always "text_completion"
|
285
285
|
*/
|
286
286
|
object: string;
|
287
|
+
/**
|
288
|
+
* Usage statistics for the completion request.
|
289
|
+
*/
|
290
|
+
usage?: CompletionUsage;
|
287
291
|
}
|
288
292
|
interface CompletionChoice {
|
289
293
|
/**
|
@@ -291,11 +295,28 @@ interface CompletionChoice {
|
|
291
295
|
* hit a natural stop point or a provided stop sequence, or `length` if the maximum
|
292
296
|
* number of tokens specified in the request was reached.
|
293
297
|
*/
|
294
|
-
finish_reason: 'stop' | 'length';
|
298
|
+
finish_reason: 'stop' | 'length' | 'content_filter';
|
295
299
|
index: number;
|
296
300
|
logprobs: any | null;
|
297
301
|
text: string;
|
298
302
|
}
|
303
|
+
interface CompletionUsage {
|
304
|
+
/**
|
305
|
+
* Usage statistics for the completion request.
|
306
|
+
*/
|
307
|
+
/**
|
308
|
+
* Number of tokens in the generated completion.
|
309
|
+
*/
|
310
|
+
completion_tokens: number;
|
311
|
+
/**
|
312
|
+
* Number of tokens in the prompt.
|
313
|
+
*/
|
314
|
+
prompt_tokens: number;
|
315
|
+
/**
|
316
|
+
* Total number of tokens used in the request (prompt + completion).
|
317
|
+
*/
|
318
|
+
total_tokens: number;
|
319
|
+
}
|
299
320
|
type AsyncIterableOpenAIStreamReturnTypes = AsyncIterable<ChatCompletionChunk> | AsyncIterable<Completion>;
|
300
321
|
declare function OpenAIStream(res: Response | AsyncIterableOpenAIStreamReturnTypes, callbacks?: OpenAIStreamCallbacks): ReadableStream;
|
301
322
|
|
@@ -571,4 +592,4 @@ declare const getStreamStringTypeAndValue: (line: string) => {
|
|
571
592
|
*/
|
572
593
|
declare const COMPLEX_HEADER = "X-Experimental-Stream-Data";
|
573
594
|
|
574
|
-
export { AIStream, AIStreamCallbacksAndOptions, AIStreamParser, AnthropicStream, COMPLEX_HEADER, ChatRequest, ChatRequestOptions, CohereStream, CreateMessage, FunctionCall, FunctionCallHandler, FunctionCallPayload, HuggingFaceStream, JSONValue, LangChainStream, Message, OpenAIStream, OpenAIStreamCallbacks, ReplicateStream, RequestOptions, StreamString, StreamStringPrefixes, StreamingTextResponse, UseChatOptions, UseCompletionOptions, createCallbacksTransformer, createChunkDecoder, createEventStreamTransformer, createStreamDataTransformer, experimental_StreamData, getStreamString, getStreamStringTypeAndValue, isStreamStringEqualToType, nanoid, readableFromAsyncIterable, streamToResponse, trimStartOfStreamHelper };
|
595
|
+
export { AIStream, AIStreamCallbacksAndOptions, AIStreamParser, AnthropicStream, COMPLEX_HEADER, ChatRequest, ChatRequestOptions, CohereStream, CompletionUsage, CreateMessage, FunctionCall, FunctionCallHandler, FunctionCallPayload, HuggingFaceStream, JSONValue, LangChainStream, Message, OpenAIStream, OpenAIStreamCallbacks, ReplicateStream, RequestOptions, StreamString, StreamStringPrefixes, StreamingTextResponse, UseChatOptions, UseCompletionOptions, createCallbacksTransformer, createChunkDecoder, createEventStreamTransformer, createStreamDataTransformer, experimental_StreamData, getStreamString, getStreamStringTypeAndValue, isStreamStringEqualToType, nanoid, readableFromAsyncIterable, streamToResponse, trimStartOfStreamHelper };
|
package/package.json
CHANGED
package/prompts/dist/index.d.ts
CHANGED
@@ -14,7 +14,7 @@ interface FunctionCall {
|
|
14
14
|
/**
|
15
15
|
* Shared types between the API and UI packages.
|
16
16
|
*/
|
17
|
-
|
17
|
+
interface Message {
|
18
18
|
id: string;
|
19
19
|
createdAt?: Date;
|
20
20
|
content: string;
|
@@ -30,7 +30,7 @@ type Message = {
|
|
30
30
|
* not be set.
|
31
31
|
*/
|
32
32
|
function_call?: string | FunctionCall;
|
33
|
-
}
|
33
|
+
}
|
34
34
|
|
35
35
|
/**
|
36
36
|
* A prompt constructor for the HuggingFace StarChat Beta model.
|
package/react/dist/index.d.ts
CHANGED
@@ -36,7 +36,7 @@ interface Function {
|
|
36
36
|
/**
|
37
37
|
* Shared types between the API and UI packages.
|
38
38
|
*/
|
39
|
-
|
39
|
+
interface Message {
|
40
40
|
id: string;
|
41
41
|
createdAt?: Date;
|
42
42
|
content: string;
|
@@ -52,7 +52,7 @@ type Message = {
|
|
52
52
|
* not be set.
|
53
53
|
*/
|
54
54
|
function_call?: string | FunctionCall;
|
55
|
-
}
|
55
|
+
}
|
56
56
|
type CreateMessage = Omit<Message, 'id'> & {
|
57
57
|
id?: Message['id'];
|
58
58
|
};
|
package/solid/dist/index.d.ts
CHANGED
@@ -38,7 +38,7 @@ interface Function {
|
|
38
38
|
/**
|
39
39
|
* Shared types between the API and UI packages.
|
40
40
|
*/
|
41
|
-
|
41
|
+
interface Message {
|
42
42
|
id: string;
|
43
43
|
createdAt?: Date;
|
44
44
|
content: string;
|
@@ -54,7 +54,7 @@ type Message = {
|
|
54
54
|
* not be set.
|
55
55
|
*/
|
56
56
|
function_call?: string | FunctionCall;
|
57
|
-
}
|
57
|
+
}
|
58
58
|
type CreateMessage = Omit<Message, 'id'> & {
|
59
59
|
id?: Message['id'];
|
60
60
|
};
|
package/solid/dist/index.js
CHANGED
@@ -125,10 +125,16 @@ function useChat({
|
|
125
125
|
const res = await fetch(api, {
|
126
126
|
method: "POST",
|
127
127
|
body: JSON.stringify({
|
128
|
-
messages: sendExtraMessageFields ? messagesSnapshot : messagesSnapshot.map(
|
129
|
-
role,
|
130
|
-
|
131
|
-
|
128
|
+
messages: sendExtraMessageFields ? messagesSnapshot : messagesSnapshot.map(
|
129
|
+
({ role, content, name, function_call }) => ({
|
130
|
+
role,
|
131
|
+
content,
|
132
|
+
...name !== void 0 && { name },
|
133
|
+
...function_call !== void 0 && {
|
134
|
+
function_call
|
135
|
+
}
|
136
|
+
})
|
137
|
+
),
|
132
138
|
...body,
|
133
139
|
...options == null ? void 0 : options.body
|
134
140
|
}),
|
package/solid/dist/index.mjs
CHANGED
@@ -98,10 +98,16 @@ function useChat({
|
|
98
98
|
const res = await fetch(api, {
|
99
99
|
method: "POST",
|
100
100
|
body: JSON.stringify({
|
101
|
-
messages: sendExtraMessageFields ? messagesSnapshot : messagesSnapshot.map(
|
102
|
-
role,
|
103
|
-
|
104
|
-
|
101
|
+
messages: sendExtraMessageFields ? messagesSnapshot : messagesSnapshot.map(
|
102
|
+
({ role, content, name, function_call }) => ({
|
103
|
+
role,
|
104
|
+
content,
|
105
|
+
...name !== void 0 && { name },
|
106
|
+
...function_call !== void 0 && {
|
107
|
+
function_call
|
108
|
+
}
|
109
|
+
})
|
110
|
+
),
|
105
111
|
...body,
|
106
112
|
...options == null ? void 0 : options.body
|
107
113
|
}),
|
package/svelte/dist/index.d.ts
CHANGED
@@ -38,7 +38,7 @@ interface Function {
|
|
38
38
|
/**
|
39
39
|
* Shared types between the API and UI packages.
|
40
40
|
*/
|
41
|
-
|
41
|
+
interface Message {
|
42
42
|
id: string;
|
43
43
|
createdAt?: Date;
|
44
44
|
content: string;
|
@@ -54,7 +54,7 @@ type Message = {
|
|
54
54
|
* not be set.
|
55
55
|
*/
|
56
56
|
function_call?: string | FunctionCall;
|
57
|
-
}
|
57
|
+
}
|
58
58
|
type CreateMessage = Omit<Message, 'id'> & {
|
59
59
|
id?: Message['id'];
|
60
60
|
};
|
package/vue/dist/index.d.ts
CHANGED
@@ -38,7 +38,7 @@ interface Function {
|
|
38
38
|
/**
|
39
39
|
* Shared types between the API and UI packages.
|
40
40
|
*/
|
41
|
-
|
41
|
+
interface Message {
|
42
42
|
id: string;
|
43
43
|
createdAt?: Date;
|
44
44
|
content: string;
|
@@ -54,7 +54,7 @@ type Message = {
|
|
54
54
|
* not be set.
|
55
55
|
*/
|
56
56
|
function_call?: string | FunctionCall;
|
57
|
-
}
|
57
|
+
}
|
58
58
|
type CreateMessage = Omit<Message, 'id'> & {
|
59
59
|
id?: Message['id'];
|
60
60
|
};
|
package/vue/dist/index.js
CHANGED
@@ -131,10 +131,16 @@ function useChat({
|
|
131
131
|
const res = await fetch(api, {
|
132
132
|
method: "POST",
|
133
133
|
body: JSON.stringify({
|
134
|
-
messages: sendExtraMessageFields ? messagesSnapshot : messagesSnapshot.map(
|
135
|
-
role,
|
136
|
-
|
137
|
-
|
134
|
+
messages: sendExtraMessageFields ? messagesSnapshot : messagesSnapshot.map(
|
135
|
+
({ role, content, name, function_call }) => ({
|
136
|
+
role,
|
137
|
+
content,
|
138
|
+
...name !== void 0 && { name },
|
139
|
+
...function_call !== void 0 && {
|
140
|
+
function_call
|
141
|
+
}
|
142
|
+
})
|
143
|
+
),
|
138
144
|
...(0, import_vue.unref)(body),
|
139
145
|
// Use unref to unwrap the ref value
|
140
146
|
...options == null ? void 0 : options.body
|
package/vue/dist/index.mjs
CHANGED
@@ -94,10 +94,16 @@ function useChat({
|
|
94
94
|
const res = await fetch(api, {
|
95
95
|
method: "POST",
|
96
96
|
body: JSON.stringify({
|
97
|
-
messages: sendExtraMessageFields ? messagesSnapshot : messagesSnapshot.map(
|
98
|
-
role,
|
99
|
-
|
100
|
-
|
97
|
+
messages: sendExtraMessageFields ? messagesSnapshot : messagesSnapshot.map(
|
98
|
+
({ role, content, name, function_call }) => ({
|
99
|
+
role,
|
100
|
+
content,
|
101
|
+
...name !== void 0 && { name },
|
102
|
+
...function_call !== void 0 && {
|
103
|
+
function_call
|
104
|
+
}
|
105
|
+
})
|
106
|
+
),
|
101
107
|
...unref(body),
|
102
108
|
// Use unref to unwrap the ref value
|
103
109
|
...options == null ? void 0 : options.body
|