@inkeep/ai-sdk-provider 0.29.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.
@@ -0,0 +1,182 @@
1
+ import { LanguageModelV2, LanguageModelV2CallOptions, LanguageModelV2Content, LanguageModelV2FinishReason, LanguageModelV2CallWarning, LanguageModelV2StreamPart } from '@ai-sdk/provider';
2
+ import { z } from 'zod';
3
+
4
+ interface InkeepChatMessage {
5
+ role: 'system' | 'user' | 'assistant' | 'function' | 'tool';
6
+ content: string | Array<{
7
+ type: string;
8
+ text?: string;
9
+ }>;
10
+ name?: string;
11
+ }
12
+ interface InkeepChatRequest {
13
+ model: string;
14
+ messages: Array<InkeepChatMessage>;
15
+ temperature?: number;
16
+ top_p?: number;
17
+ n?: number;
18
+ stream?: boolean;
19
+ max_tokens?: number;
20
+ presence_penalty?: number;
21
+ frequency_penalty?: number;
22
+ logit_bias?: Record<string, number>;
23
+ user?: string;
24
+ conversationId?: string;
25
+ tools?: Array<string>;
26
+ runConfig?: Record<string, unknown>;
27
+ headers?: Record<string, unknown>;
28
+ }
29
+ interface InkeepChatCompletionChunk {
30
+ id: string;
31
+ object: 'chat.completion.chunk';
32
+ created: number;
33
+ model?: string;
34
+ choices: Array<{
35
+ index: number;
36
+ delta: {
37
+ role?: 'assistant';
38
+ content?: string;
39
+ tool_calls?: Array<{
40
+ index: number;
41
+ id?: string;
42
+ type: 'function';
43
+ function: {
44
+ name?: string;
45
+ arguments?: string;
46
+ };
47
+ }>;
48
+ };
49
+ finish_reason: string | null;
50
+ }>;
51
+ usage?: {
52
+ prompt_tokens?: number;
53
+ completion_tokens?: number;
54
+ total_tokens?: number;
55
+ };
56
+ }
57
+ interface InkeepChatCompletion {
58
+ id: string;
59
+ object: 'chat.completion';
60
+ created: number;
61
+ model?: string;
62
+ choices: Array<{
63
+ index: number;
64
+ message: {
65
+ role: 'assistant';
66
+ content: string;
67
+ tool_calls?: Array<{
68
+ id: string;
69
+ type: 'function';
70
+ function: {
71
+ name: string;
72
+ arguments: string;
73
+ };
74
+ }>;
75
+ };
76
+ finish_reason: string;
77
+ }>;
78
+ usage?: {
79
+ prompt_tokens?: number;
80
+ completion_tokens?: number;
81
+ total_tokens?: number;
82
+ };
83
+ }
84
+ type InkeepFinishReason = 'stop' | 'length' | 'tool_calls' | 'content_filter' | null;
85
+
86
+ interface InkeepChatOptions {
87
+ conversationId?: string;
88
+ runConfig?: Record<string, unknown>;
89
+ headers?: Record<string, unknown>;
90
+ }
91
+
92
+ interface InkeepChatConfig {
93
+ provider: string;
94
+ baseURL: string;
95
+ headers: () => Record<string, string | undefined>;
96
+ fetch?: typeof fetch;
97
+ }
98
+ declare class InkeepChatLanguageModel implements LanguageModelV2 {
99
+ readonly specificationVersion: "v2";
100
+ readonly defaultObjectGenerationMode: undefined;
101
+ readonly supportsImageUrls = false;
102
+ readonly supportedUrls: {};
103
+ readonly modelId: string;
104
+ readonly options: InkeepChatOptions;
105
+ readonly config: InkeepChatConfig;
106
+ get provider(): string;
107
+ constructor(modelId: string, options: InkeepChatOptions, config: InkeepChatConfig);
108
+ private getArgs;
109
+ doGenerate(options: LanguageModelV2CallOptions): Promise<{
110
+ content: LanguageModelV2Content[];
111
+ finishReason: LanguageModelV2FinishReason;
112
+ usage: {
113
+ promptTokens: number;
114
+ completionTokens: number;
115
+ inputTokens: number;
116
+ outputTokens: number;
117
+ totalTokens: number;
118
+ };
119
+ rawCall: {
120
+ rawPrompt: InkeepChatMessage[];
121
+ rawSettings: {
122
+ model: string;
123
+ messages: InkeepChatMessage[];
124
+ conversationId: string | undefined;
125
+ headers: Record<string, unknown> | undefined;
126
+ runConfig: Record<string, unknown> | undefined;
127
+ };
128
+ };
129
+ rawResponse: {
130
+ headers: Record<string, string> | undefined;
131
+ };
132
+ response: {
133
+ id: string;
134
+ modelId: string | undefined;
135
+ timestamp: Date;
136
+ };
137
+ warnings: LanguageModelV2CallWarning[];
138
+ }>;
139
+ doStream(options: LanguageModelV2CallOptions): Promise<{
140
+ stream: ReadableStream<LanguageModelV2StreamPart>;
141
+ rawCall: {
142
+ rawPrompt: InkeepChatMessage[];
143
+ rawSettings: {
144
+ model: string;
145
+ messages: InkeepChatMessage[];
146
+ conversationId: string | undefined;
147
+ headers: Record<string, unknown> | undefined;
148
+ runConfig: Record<string, unknown> | undefined;
149
+ };
150
+ };
151
+ rawResponse: {
152
+ headers: Record<string, string> | undefined;
153
+ };
154
+ warnings: LanguageModelV2CallWarning[];
155
+ }>;
156
+ }
157
+
158
+ declare const inkeepErrorDataSchema: z.ZodObject<{
159
+ error: z.ZodString;
160
+ message: z.ZodOptional<z.ZodString>;
161
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
162
+ field: z.ZodString;
163
+ message: z.ZodString;
164
+ value: z.ZodOptional<z.ZodUnknown>;
165
+ }, z.core.$strip>>>;
166
+ }, z.core.$strip>;
167
+ type InkeepErrorData = z.infer<typeof inkeepErrorDataSchema>;
168
+
169
+ interface InkeepProvider {
170
+ (agentId: string, options?: InkeepChatOptions): InkeepChatLanguageModel;
171
+ languageModel(agentId: string, options?: InkeepChatOptions): InkeepChatLanguageModel;
172
+ }
173
+ interface InkeepProviderSettings {
174
+ baseURL?: string;
175
+ apiKey?: string;
176
+ headers?: Record<string, string>;
177
+ fetch?: typeof fetch;
178
+ }
179
+ declare function createInkeep(options?: InkeepProviderSettings): InkeepProvider;
180
+ declare const inkeep: InkeepProvider;
181
+
182
+ export { type InkeepChatCompletion, type InkeepChatCompletionChunk, InkeepChatLanguageModel, type InkeepChatMessage, type InkeepChatOptions, type InkeepChatRequest, type InkeepErrorData, type InkeepFinishReason, type InkeepProvider, type InkeepProviderSettings, createInkeep, inkeep };
@@ -0,0 +1,182 @@
1
+ import { LanguageModelV2, LanguageModelV2CallOptions, LanguageModelV2Content, LanguageModelV2FinishReason, LanguageModelV2CallWarning, LanguageModelV2StreamPart } from '@ai-sdk/provider';
2
+ import { z } from 'zod';
3
+
4
+ interface InkeepChatMessage {
5
+ role: 'system' | 'user' | 'assistant' | 'function' | 'tool';
6
+ content: string | Array<{
7
+ type: string;
8
+ text?: string;
9
+ }>;
10
+ name?: string;
11
+ }
12
+ interface InkeepChatRequest {
13
+ model: string;
14
+ messages: Array<InkeepChatMessage>;
15
+ temperature?: number;
16
+ top_p?: number;
17
+ n?: number;
18
+ stream?: boolean;
19
+ max_tokens?: number;
20
+ presence_penalty?: number;
21
+ frequency_penalty?: number;
22
+ logit_bias?: Record<string, number>;
23
+ user?: string;
24
+ conversationId?: string;
25
+ tools?: Array<string>;
26
+ runConfig?: Record<string, unknown>;
27
+ headers?: Record<string, unknown>;
28
+ }
29
+ interface InkeepChatCompletionChunk {
30
+ id: string;
31
+ object: 'chat.completion.chunk';
32
+ created: number;
33
+ model?: string;
34
+ choices: Array<{
35
+ index: number;
36
+ delta: {
37
+ role?: 'assistant';
38
+ content?: string;
39
+ tool_calls?: Array<{
40
+ index: number;
41
+ id?: string;
42
+ type: 'function';
43
+ function: {
44
+ name?: string;
45
+ arguments?: string;
46
+ };
47
+ }>;
48
+ };
49
+ finish_reason: string | null;
50
+ }>;
51
+ usage?: {
52
+ prompt_tokens?: number;
53
+ completion_tokens?: number;
54
+ total_tokens?: number;
55
+ };
56
+ }
57
+ interface InkeepChatCompletion {
58
+ id: string;
59
+ object: 'chat.completion';
60
+ created: number;
61
+ model?: string;
62
+ choices: Array<{
63
+ index: number;
64
+ message: {
65
+ role: 'assistant';
66
+ content: string;
67
+ tool_calls?: Array<{
68
+ id: string;
69
+ type: 'function';
70
+ function: {
71
+ name: string;
72
+ arguments: string;
73
+ };
74
+ }>;
75
+ };
76
+ finish_reason: string;
77
+ }>;
78
+ usage?: {
79
+ prompt_tokens?: number;
80
+ completion_tokens?: number;
81
+ total_tokens?: number;
82
+ };
83
+ }
84
+ type InkeepFinishReason = 'stop' | 'length' | 'tool_calls' | 'content_filter' | null;
85
+
86
+ interface InkeepChatOptions {
87
+ conversationId?: string;
88
+ runConfig?: Record<string, unknown>;
89
+ headers?: Record<string, unknown>;
90
+ }
91
+
92
+ interface InkeepChatConfig {
93
+ provider: string;
94
+ baseURL: string;
95
+ headers: () => Record<string, string | undefined>;
96
+ fetch?: typeof fetch;
97
+ }
98
+ declare class InkeepChatLanguageModel implements LanguageModelV2 {
99
+ readonly specificationVersion: "v2";
100
+ readonly defaultObjectGenerationMode: undefined;
101
+ readonly supportsImageUrls = false;
102
+ readonly supportedUrls: {};
103
+ readonly modelId: string;
104
+ readonly options: InkeepChatOptions;
105
+ readonly config: InkeepChatConfig;
106
+ get provider(): string;
107
+ constructor(modelId: string, options: InkeepChatOptions, config: InkeepChatConfig);
108
+ private getArgs;
109
+ doGenerate(options: LanguageModelV2CallOptions): Promise<{
110
+ content: LanguageModelV2Content[];
111
+ finishReason: LanguageModelV2FinishReason;
112
+ usage: {
113
+ promptTokens: number;
114
+ completionTokens: number;
115
+ inputTokens: number;
116
+ outputTokens: number;
117
+ totalTokens: number;
118
+ };
119
+ rawCall: {
120
+ rawPrompt: InkeepChatMessage[];
121
+ rawSettings: {
122
+ model: string;
123
+ messages: InkeepChatMessage[];
124
+ conversationId: string | undefined;
125
+ headers: Record<string, unknown> | undefined;
126
+ runConfig: Record<string, unknown> | undefined;
127
+ };
128
+ };
129
+ rawResponse: {
130
+ headers: Record<string, string> | undefined;
131
+ };
132
+ response: {
133
+ id: string;
134
+ modelId: string | undefined;
135
+ timestamp: Date;
136
+ };
137
+ warnings: LanguageModelV2CallWarning[];
138
+ }>;
139
+ doStream(options: LanguageModelV2CallOptions): Promise<{
140
+ stream: ReadableStream<LanguageModelV2StreamPart>;
141
+ rawCall: {
142
+ rawPrompt: InkeepChatMessage[];
143
+ rawSettings: {
144
+ model: string;
145
+ messages: InkeepChatMessage[];
146
+ conversationId: string | undefined;
147
+ headers: Record<string, unknown> | undefined;
148
+ runConfig: Record<string, unknown> | undefined;
149
+ };
150
+ };
151
+ rawResponse: {
152
+ headers: Record<string, string> | undefined;
153
+ };
154
+ warnings: LanguageModelV2CallWarning[];
155
+ }>;
156
+ }
157
+
158
+ declare const inkeepErrorDataSchema: z.ZodObject<{
159
+ error: z.ZodString;
160
+ message: z.ZodOptional<z.ZodString>;
161
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
162
+ field: z.ZodString;
163
+ message: z.ZodString;
164
+ value: z.ZodOptional<z.ZodUnknown>;
165
+ }, z.core.$strip>>>;
166
+ }, z.core.$strip>;
167
+ type InkeepErrorData = z.infer<typeof inkeepErrorDataSchema>;
168
+
169
+ interface InkeepProvider {
170
+ (agentId: string, options?: InkeepChatOptions): InkeepChatLanguageModel;
171
+ languageModel(agentId: string, options?: InkeepChatOptions): InkeepChatLanguageModel;
172
+ }
173
+ interface InkeepProviderSettings {
174
+ baseURL?: string;
175
+ apiKey?: string;
176
+ headers?: Record<string, string>;
177
+ fetch?: typeof fetch;
178
+ }
179
+ declare function createInkeep(options?: InkeepProviderSettings): InkeepProvider;
180
+ declare const inkeep: InkeepProvider;
181
+
182
+ export { type InkeepChatCompletion, type InkeepChatCompletionChunk, InkeepChatLanguageModel, type InkeepChatMessage, type InkeepChatOptions, type InkeepChatRequest, type InkeepErrorData, type InkeepFinishReason, type InkeepProvider, type InkeepProviderSettings, createInkeep, inkeep };