@assistant-ui/react 0.4.4 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
package/dist/edge.d.mts CHANGED
@@ -1,8 +1,113 @@
1
- import { LanguageModelV1 } from '@ai-sdk/provider';
1
+ import { LanguageModelV1, LanguageModelV1ToolChoice, LanguageModelV1FinishReason, LanguageModelV1LogProbs, LanguageModelV1CallWarning } from '@ai-sdk/provider';
2
+ import { z } from 'zod';
3
+ import { JSONSchema7 } from 'json-schema';
2
4
 
3
- declare const createEdgeRuntimeAPI: ({ model }: {
4
- model: LanguageModelV1;
5
- }) => {
5
+ type TextContentPart = {
6
+ type: "text";
7
+ text: string;
8
+ };
9
+ type ImageContentPart = {
10
+ type: "image";
11
+ image: string;
12
+ };
13
+ type CoreToolCallContentPart<TArgs extends Record<string | number, unknown> = Record<string | number, unknown>, TResult = unknown> = {
14
+ type: "tool-call";
15
+ toolCallId: string;
16
+ toolName: string;
17
+ args: TArgs;
18
+ result?: TResult | undefined;
19
+ isError?: boolean | undefined;
20
+ };
21
+ /** Core Message Types (without UI content parts) */
22
+ type CoreUserContentPart = TextContentPart | ImageContentPart;
23
+ type CoreAssistantContentPart = TextContentPart | CoreToolCallContentPart;
24
+ type CoreSystemMessage = {
25
+ role: "system";
26
+ content: [TextContentPart];
27
+ };
28
+ type CoreUserMessage = {
29
+ role: "user";
30
+ content: CoreUserContentPart[];
31
+ };
32
+ type CoreAssistantMessage = {
33
+ role: "assistant";
34
+ content: CoreAssistantContentPart[];
35
+ };
36
+ type CoreMessage = CoreSystemMessage | CoreUserMessage | CoreAssistantMessage;
37
+
38
+ declare const LanguageModelV1CallSettingsSchema: z.ZodObject<{
39
+ maxTokens: z.ZodOptional<z.ZodNumber>;
40
+ temperature: z.ZodOptional<z.ZodNumber>;
41
+ topP: z.ZodOptional<z.ZodNumber>;
42
+ presencePenalty: z.ZodOptional<z.ZodNumber>;
43
+ frequencyPenalty: z.ZodOptional<z.ZodNumber>;
44
+ seed: z.ZodOptional<z.ZodNumber>;
45
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>;
46
+ }, "strip", z.ZodTypeAny, {
47
+ maxTokens?: number | undefined;
48
+ temperature?: number | undefined;
49
+ topP?: number | undefined;
50
+ presencePenalty?: number | undefined;
51
+ frequencyPenalty?: number | undefined;
52
+ seed?: number | undefined;
53
+ headers?: Record<string, string | undefined> | undefined;
54
+ }, {
55
+ maxTokens?: number | undefined;
56
+ temperature?: number | undefined;
57
+ topP?: number | undefined;
58
+ presencePenalty?: number | undefined;
59
+ frequencyPenalty?: number | undefined;
60
+ seed?: number | undefined;
61
+ headers?: Record<string, string | undefined> | undefined;
62
+ }>;
63
+ type LanguageModelV1CallSettings = z.infer<typeof LanguageModelV1CallSettingsSchema>;
64
+ declare const LanguageModelConfigSchema: z.ZodObject<{
65
+ apiKey: z.ZodOptional<z.ZodString>;
66
+ baseUrl: z.ZodOptional<z.ZodString>;
67
+ modelName: z.ZodOptional<z.ZodString>;
68
+ }, "strip", z.ZodTypeAny, {
69
+ apiKey?: string | undefined;
70
+ baseUrl?: string | undefined;
71
+ modelName?: string | undefined;
72
+ }, {
73
+ apiKey?: string | undefined;
74
+ baseUrl?: string | undefined;
75
+ modelName?: string | undefined;
76
+ }>;
77
+ type LanguageModelConfig = z.infer<typeof LanguageModelConfigSchema>;
78
+ type ToolExecuteFunction<TArgs, TResult> = (args: TArgs) => TResult | Promise<TResult>;
79
+ type Tool<TArgs extends Record<string | number, unknown> = Record<string | number, unknown>, TResult = unknown> = {
80
+ description?: string | undefined;
81
+ parameters: z.ZodSchema<TArgs> | JSONSchema7;
82
+ execute?: ToolExecuteFunction<TArgs, TResult>;
83
+ };
84
+
85
+ type FinishResult = {
86
+ finishReason: LanguageModelV1FinishReason;
87
+ usage: {
88
+ promptTokens: number;
89
+ completionTokens: number;
90
+ };
91
+ logProbs?: LanguageModelV1LogProbs | undefined;
92
+ messages: CoreMessage[];
93
+ rawCall: {
94
+ rawPrompt: unknown;
95
+ rawSettings: Record<string, unknown>;
96
+ };
97
+ warnings?: LanguageModelV1CallWarning[] | undefined;
98
+ rawResponse?: {
99
+ headers?: Record<string, string>;
100
+ } | undefined;
101
+ };
102
+ type LanguageModelCreator = (config: LanguageModelConfig) => Promise<LanguageModelV1> | LanguageModelV1;
103
+ type CreateEdgeRuntimeAPIOptions = LanguageModelV1CallSettings & {
104
+ model: LanguageModelV1 | LanguageModelCreator;
105
+ system?: string;
106
+ tools?: Record<string, Tool<any, any>>;
107
+ toolChoice?: LanguageModelV1ToolChoice;
108
+ onFinish?: (result: FinishResult) => void;
109
+ };
110
+ declare const createEdgeRuntimeAPI: ({ model: modelOrCreator, system: serverSystem, tools: serverTools, toolChoice, onFinish, ...unsafeSettings }: CreateEdgeRuntimeAPIOptions) => {
6
111
  POST: (request: Request) => Promise<Response>;
7
112
  };
8
113
 
package/dist/edge.d.ts CHANGED
@@ -1,8 +1,113 @@
1
- import { LanguageModelV1 } from '@ai-sdk/provider';
1
+ import { LanguageModelV1, LanguageModelV1ToolChoice, LanguageModelV1FinishReason, LanguageModelV1LogProbs, LanguageModelV1CallWarning } from '@ai-sdk/provider';
2
+ import { z } from 'zod';
3
+ import { JSONSchema7 } from 'json-schema';
2
4
 
3
- declare const createEdgeRuntimeAPI: ({ model }: {
4
- model: LanguageModelV1;
5
- }) => {
5
+ type TextContentPart = {
6
+ type: "text";
7
+ text: string;
8
+ };
9
+ type ImageContentPart = {
10
+ type: "image";
11
+ image: string;
12
+ };
13
+ type CoreToolCallContentPart<TArgs extends Record<string | number, unknown> = Record<string | number, unknown>, TResult = unknown> = {
14
+ type: "tool-call";
15
+ toolCallId: string;
16
+ toolName: string;
17
+ args: TArgs;
18
+ result?: TResult | undefined;
19
+ isError?: boolean | undefined;
20
+ };
21
+ /** Core Message Types (without UI content parts) */
22
+ type CoreUserContentPart = TextContentPart | ImageContentPart;
23
+ type CoreAssistantContentPart = TextContentPart | CoreToolCallContentPart;
24
+ type CoreSystemMessage = {
25
+ role: "system";
26
+ content: [TextContentPart];
27
+ };
28
+ type CoreUserMessage = {
29
+ role: "user";
30
+ content: CoreUserContentPart[];
31
+ };
32
+ type CoreAssistantMessage = {
33
+ role: "assistant";
34
+ content: CoreAssistantContentPart[];
35
+ };
36
+ type CoreMessage = CoreSystemMessage | CoreUserMessage | CoreAssistantMessage;
37
+
38
+ declare const LanguageModelV1CallSettingsSchema: z.ZodObject<{
39
+ maxTokens: z.ZodOptional<z.ZodNumber>;
40
+ temperature: z.ZodOptional<z.ZodNumber>;
41
+ topP: z.ZodOptional<z.ZodNumber>;
42
+ presencePenalty: z.ZodOptional<z.ZodNumber>;
43
+ frequencyPenalty: z.ZodOptional<z.ZodNumber>;
44
+ seed: z.ZodOptional<z.ZodNumber>;
45
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>;
46
+ }, "strip", z.ZodTypeAny, {
47
+ maxTokens?: number | undefined;
48
+ temperature?: number | undefined;
49
+ topP?: number | undefined;
50
+ presencePenalty?: number | undefined;
51
+ frequencyPenalty?: number | undefined;
52
+ seed?: number | undefined;
53
+ headers?: Record<string, string | undefined> | undefined;
54
+ }, {
55
+ maxTokens?: number | undefined;
56
+ temperature?: number | undefined;
57
+ topP?: number | undefined;
58
+ presencePenalty?: number | undefined;
59
+ frequencyPenalty?: number | undefined;
60
+ seed?: number | undefined;
61
+ headers?: Record<string, string | undefined> | undefined;
62
+ }>;
63
+ type LanguageModelV1CallSettings = z.infer<typeof LanguageModelV1CallSettingsSchema>;
64
+ declare const LanguageModelConfigSchema: z.ZodObject<{
65
+ apiKey: z.ZodOptional<z.ZodString>;
66
+ baseUrl: z.ZodOptional<z.ZodString>;
67
+ modelName: z.ZodOptional<z.ZodString>;
68
+ }, "strip", z.ZodTypeAny, {
69
+ apiKey?: string | undefined;
70
+ baseUrl?: string | undefined;
71
+ modelName?: string | undefined;
72
+ }, {
73
+ apiKey?: string | undefined;
74
+ baseUrl?: string | undefined;
75
+ modelName?: string | undefined;
76
+ }>;
77
+ type LanguageModelConfig = z.infer<typeof LanguageModelConfigSchema>;
78
+ type ToolExecuteFunction<TArgs, TResult> = (args: TArgs) => TResult | Promise<TResult>;
79
+ type Tool<TArgs extends Record<string | number, unknown> = Record<string | number, unknown>, TResult = unknown> = {
80
+ description?: string | undefined;
81
+ parameters: z.ZodSchema<TArgs> | JSONSchema7;
82
+ execute?: ToolExecuteFunction<TArgs, TResult>;
83
+ };
84
+
85
+ type FinishResult = {
86
+ finishReason: LanguageModelV1FinishReason;
87
+ usage: {
88
+ promptTokens: number;
89
+ completionTokens: number;
90
+ };
91
+ logProbs?: LanguageModelV1LogProbs | undefined;
92
+ messages: CoreMessage[];
93
+ rawCall: {
94
+ rawPrompt: unknown;
95
+ rawSettings: Record<string, unknown>;
96
+ };
97
+ warnings?: LanguageModelV1CallWarning[] | undefined;
98
+ rawResponse?: {
99
+ headers?: Record<string, string>;
100
+ } | undefined;
101
+ };
102
+ type LanguageModelCreator = (config: LanguageModelConfig) => Promise<LanguageModelV1> | LanguageModelV1;
103
+ type CreateEdgeRuntimeAPIOptions = LanguageModelV1CallSettings & {
104
+ model: LanguageModelV1 | LanguageModelCreator;
105
+ system?: string;
106
+ tools?: Record<string, Tool<any, any>>;
107
+ toolChoice?: LanguageModelV1ToolChoice;
108
+ onFinish?: (result: FinishResult) => void;
109
+ };
110
+ declare const createEdgeRuntimeAPI: ({ model: modelOrCreator, system: serverSystem, tools: serverTools, toolChoice, onFinish, ...unsafeSettings }: CreateEdgeRuntimeAPIOptions) => {
6
111
  POST: (request: Request) => Promise<Response>;
7
112
  };
8
113