@kernl-sdk/protocol 0.1.1
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/.turbo/turbo-build.log +4 -0
- package/CHANGELOG.md +7 -0
- package/LICENSE +201 -0
- package/README.md +1 -0
- package/dist/codec.d.ts +22 -0
- package/dist/codec.d.ts.map +1 -0
- package/dist/codec.js +1 -0
- package/dist/constants.d.ts +11 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +13 -0
- package/dist/embedding-model/embedding-model.d.ts +57 -0
- package/dist/embedding-model/embedding-model.d.ts.map +1 -0
- package/dist/embedding-model/embedding-model.js +6 -0
- package/dist/embedding-model/index.d.ts +3 -0
- package/dist/embedding-model/index.d.ts.map +1 -0
- package/dist/embedding-model/index.js +2 -0
- package/dist/embedding-model/model.d.ts +65 -0
- package/dist/embedding-model/model.d.ts.map +1 -0
- package/dist/embedding-model/model.js +1 -0
- package/dist/embedding-model/request.d.ts +27 -0
- package/dist/embedding-model/request.d.ts.map +1 -0
- package/dist/embedding-model/request.js +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/json.d.ts +10 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +1 -0
- package/dist/language-model/content.d.ts +141 -0
- package/dist/language-model/content.d.ts.map +1 -0
- package/dist/language-model/content.js +1 -0
- package/dist/language-model/index.d.ts +6 -0
- package/dist/language-model/index.d.ts.map +1 -0
- package/dist/language-model/index.js +5 -0
- package/dist/language-model/item.d.ts +183 -0
- package/dist/language-model/item.d.ts.map +1 -0
- package/dist/language-model/item.js +1 -0
- package/dist/language-model/language-model.d.ts +114 -0
- package/dist/language-model/language-model.d.ts.map +1 -0
- package/dist/language-model/language-model.js +1 -0
- package/dist/language-model/model.d.ts +110 -0
- package/dist/language-model/model.d.ts.map +1 -0
- package/dist/language-model/model.js +1 -0
- package/dist/language-model/request.d.ts +175 -0
- package/dist/language-model/request.d.ts.map +1 -0
- package/dist/language-model/request.js +1 -0
- package/dist/language-model/settings.d.ts +99 -0
- package/dist/language-model/settings.d.ts.map +1 -0
- package/dist/language-model/settings.js +1 -0
- package/dist/language-model/stream.d.ts +195 -0
- package/dist/language-model/stream.d.ts.map +1 -0
- package/dist/language-model/stream.js +1 -0
- package/dist/language-model/tool.d.ts +48 -0
- package/dist/language-model/tool.d.ts.map +1 -0
- package/dist/language-model/tool.js +1 -0
- package/dist/provider/index.d.ts +2 -0
- package/dist/provider/index.d.ts.map +1 -0
- package/dist/provider/index.js +1 -0
- package/dist/provider/metadata.d.ts +21 -0
- package/dist/provider/metadata.d.ts.map +1 -0
- package/dist/provider/metadata.js +1 -0
- package/dist/provider/provider.d.ts +42 -0
- package/dist/provider/provider.d.ts.map +1 -0
- package/dist/provider/provider.js +1 -0
- package/package.json +41 -0
- package/src/codec.ts +22 -0
- package/src/constants.ts +15 -0
- package/src/embedding-model/index.ts +2 -0
- package/src/embedding-model/model.ts +76 -0
- package/src/embedding-model/request.ts +31 -0
- package/src/index.ts +20 -0
- package/src/json.ts +17 -0
- package/src/language-model/index.ts +5 -0
- package/src/language-model/item.ts +251 -0
- package/src/language-model/model.ts +161 -0
- package/src/language-model/request.ts +210 -0
- package/src/language-model/stream.ts +251 -0
- package/src/language-model/tool.ts +56 -0
- package/src/provider/index.ts +1 -0
- package/src/provider/provider.ts +79 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/language-model/content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,MAAM,oBAAoB,GAC5B,iBAAiB,GACjB,sBAAsB,GACtB,iBAAiB,GACjB,mBAAmB,GACnB,qBAAqB,GACrB,uBAAuB,CAAC;AAE5B;;GAEG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AEf;;OAEG;IACH,MAAM,EAAE,2BAA2B,CAAC;IAEpC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,gBAAgB,CAAC,EAAE,sBAAsB,CAAC;CAC3C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,aAAa,CAAC;IAEpB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,EAAE,2BAA2B,CAAC;IAEpC;;OAEG;IACH,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IAE/B;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB;;OAEG;IACH,gBAAgB,CAAC,EAAE,sBAAsB,CAAC;CAC3C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/language-model/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { SharedProviderMetadata } from "../provider";
|
|
2
|
+
import { JSONValue } from "../json";
|
|
3
|
+
import { IN_PROGRESS, COMPLETED, FAILED, INTERRUPTIBLE, UNINTERRUPTIBLE } from "../constants";
|
|
4
|
+
export type LanguageModelItem = Message | Reasoning | ToolCall | ToolResult | Unknown;
|
|
5
|
+
/**
|
|
6
|
+
* A subset of LanguageModelItem that excludes items that wouldn't
|
|
7
|
+
* make sense for a model to generate (e.g. system/user messages, tool results).
|
|
8
|
+
*/
|
|
9
|
+
export type LanguageModelResponseItem = AssistantMessage | Reasoning | ToolCall | Unknown;
|
|
10
|
+
export interface SharedBase {
|
|
11
|
+
/**
|
|
12
|
+
* Optional provider-specific metadata for the text part.
|
|
13
|
+
*/
|
|
14
|
+
providerMetadata?: SharedProviderMetadata;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Shared base for language model items.
|
|
18
|
+
*/
|
|
19
|
+
export interface LanguageModelItemBase extends SharedBase {
|
|
20
|
+
/**
|
|
21
|
+
* A unique identifier for the item. Optional by default.
|
|
22
|
+
*/
|
|
23
|
+
id?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Defines base properties common to all message or artifact parts.
|
|
27
|
+
*/
|
|
28
|
+
export interface PartBase extends SharedBase {
|
|
29
|
+
/** Optional metadata associated with this part. */
|
|
30
|
+
metadata?: Record<string, unknown>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Text that the model has generated.
|
|
34
|
+
*/
|
|
35
|
+
export interface TextPart extends PartBase {
|
|
36
|
+
readonly kind: "text";
|
|
37
|
+
/**
|
|
38
|
+
* The text content.
|
|
39
|
+
*/
|
|
40
|
+
text: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A file that has been generated by the model.
|
|
44
|
+
*
|
|
45
|
+
* May be base64 encoded strings or binary data.
|
|
46
|
+
*/
|
|
47
|
+
export interface FilePart extends PartBase {
|
|
48
|
+
readonly kind: "file";
|
|
49
|
+
/**
|
|
50
|
+
* The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
|
|
51
|
+
*
|
|
52
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
53
|
+
*/
|
|
54
|
+
mimeType: string;
|
|
55
|
+
/**
|
|
56
|
+
* Generated file data as base64 encoded strings or binary data.
|
|
57
|
+
*/
|
|
58
|
+
data: string | Uint8Array;
|
|
59
|
+
/**
|
|
60
|
+
* Optional filename for the file
|
|
61
|
+
*/
|
|
62
|
+
filename?: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Represents a structured data segment (e.g., JSON) within a message or artifact.
|
|
66
|
+
*/
|
|
67
|
+
export interface DataPart extends PartBase {
|
|
68
|
+
readonly kind: "data";
|
|
69
|
+
/**
|
|
70
|
+
* The structured data content.
|
|
71
|
+
*/
|
|
72
|
+
data: Record<string, unknown>;
|
|
73
|
+
}
|
|
74
|
+
export type MessagePart = TextPart | FilePart | DataPart;
|
|
75
|
+
/**
|
|
76
|
+
* Reasoning that the model has generated.
|
|
77
|
+
*/
|
|
78
|
+
export interface Reasoning extends LanguageModelItemBase {
|
|
79
|
+
readonly kind: "reasoning";
|
|
80
|
+
/**
|
|
81
|
+
* The reasoning content
|
|
82
|
+
*/
|
|
83
|
+
text: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* This is a catch all for events that are not part of the protocol.
|
|
87
|
+
*
|
|
88
|
+
* For example, a model might return an event that is not part of the protocol using this type.
|
|
89
|
+
*
|
|
90
|
+
* In that case everything returned from the model should be passed in the `providerMetadata` field.
|
|
91
|
+
*
|
|
92
|
+
* This enables new features to be added to be added by a model provider without breaking the protocol.
|
|
93
|
+
*/
|
|
94
|
+
export interface Unknown extends LanguageModelItemBase {
|
|
95
|
+
readonly kind: "unknown";
|
|
96
|
+
}
|
|
97
|
+
export interface MessageBase extends SharedBase {
|
|
98
|
+
readonly kind: "message";
|
|
99
|
+
/**
|
|
100
|
+
* The unique identifier for the message.
|
|
101
|
+
*/
|
|
102
|
+
id: string;
|
|
103
|
+
/**
|
|
104
|
+
* The content parts of the message.
|
|
105
|
+
*/
|
|
106
|
+
content: MessagePart[];
|
|
107
|
+
/**
|
|
108
|
+
* Optional additional metadata for the message
|
|
109
|
+
*/
|
|
110
|
+
metadata?: Record<string, unknown>;
|
|
111
|
+
}
|
|
112
|
+
export interface SystemMessage extends MessageBase {
|
|
113
|
+
/**
|
|
114
|
+
* Representing a system message to the user
|
|
115
|
+
*/
|
|
116
|
+
readonly role: "system";
|
|
117
|
+
}
|
|
118
|
+
export interface AssistantMessage extends MessageBase {
|
|
119
|
+
/**
|
|
120
|
+
* Representing a message from the assistant
|
|
121
|
+
*/
|
|
122
|
+
readonly role: "assistant";
|
|
123
|
+
}
|
|
124
|
+
export interface UserMessage extends MessageBase {
|
|
125
|
+
/**
|
|
126
|
+
* Representing a message from the user
|
|
127
|
+
*/
|
|
128
|
+
readonly role: "user";
|
|
129
|
+
}
|
|
130
|
+
export type Message = SystemMessage | AssistantMessage | UserMessage;
|
|
131
|
+
/**
|
|
132
|
+
* Tool calls that the model has generated.
|
|
133
|
+
*/
|
|
134
|
+
export interface ToolCall extends LanguageModelItemBase {
|
|
135
|
+
readonly kind: "tool-call";
|
|
136
|
+
/**
|
|
137
|
+
* The identifier of the tool call. It must be unique across all tool calls.
|
|
138
|
+
*/
|
|
139
|
+
callId: string;
|
|
140
|
+
/**
|
|
141
|
+
* The id of the tool that should be called.
|
|
142
|
+
*/
|
|
143
|
+
toolId: string;
|
|
144
|
+
/**
|
|
145
|
+
* The state of the tool call.
|
|
146
|
+
*/
|
|
147
|
+
state: ToolCallState;
|
|
148
|
+
/**
|
|
149
|
+
* The stringified JSON object with the arguments of the tool call.
|
|
150
|
+
*/
|
|
151
|
+
arguments: string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Result of a tool call that has been executed by the provider.
|
|
155
|
+
*/
|
|
156
|
+
export interface ToolResult extends LanguageModelItemBase {
|
|
157
|
+
readonly kind: "tool-result";
|
|
158
|
+
/**
|
|
159
|
+
* The ID of the tool call that this result is associated with.
|
|
160
|
+
*/
|
|
161
|
+
callId: string;
|
|
162
|
+
/**
|
|
163
|
+
* Name of the tool that generated this result.
|
|
164
|
+
*/
|
|
165
|
+
toolId: string;
|
|
166
|
+
/**
|
|
167
|
+
* The state of the tool call.
|
|
168
|
+
*/
|
|
169
|
+
state: ToolCallState;
|
|
170
|
+
/**
|
|
171
|
+
* Result of the tool call. This is a JSON-serializable object.
|
|
172
|
+
*/
|
|
173
|
+
result: NonNullable<JSONValue>;
|
|
174
|
+
/**
|
|
175
|
+
* Error message if the tool call failed
|
|
176
|
+
*/
|
|
177
|
+
error: string | null;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* State of a tool call execution.
|
|
181
|
+
*/
|
|
182
|
+
export type ToolCallState = typeof IN_PROGRESS | typeof COMPLETED | typeof FAILED | typeof INTERRUPTIBLE | typeof UNINTERRUPTIBLE;
|
|
183
|
+
//# sourceMappingURL=item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../src/language-model/item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EACL,WAAW,EACX,SAAS,EACT,MAAM,EACN,aAAa,EACb,eAAe,EAChB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,iBAAiB,GACzB,OAAO,GACP,SAAS,GACT,QAAQ,GACR,UAAU,GACV,OAAO,CAAC;AAEZ;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GACjC,gBAAgB,GAChB,SAAS,GACT,QAAQ,GACR,OAAO,CAAC;AAEZ,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,sBAAsB,CAAC;CAC3C;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,UAAU;IACvD;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAMD;;GAEG;AACH,MAAM,WAAW,QAAS,SAAQ,UAAU;IAC1C,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,QAAS,SAAQ,QAAQ;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CAC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Y,SAAQ,WAAW;IAC9C;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,OAAO,GAAG,aAAa,GAAG,gBAAgB,GAAG,WAAW,CAAC;AAMrE;;GAEG;AACH,MAAM,WAAW,QAAS,SAAQ,qBAAqB;IACrD,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAE3B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,EAAE,aAAa,CAAC;IAErB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,qBAAqB;IACvD,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAE7B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,EAAE,aAAa,CAAC;IAErB;;OAEG;IACH,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IAE/B;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,OAAO,WAAW,GAClB,OAAO,SAAS,GAChB,OAAO,MAAM,GACb,OAAO,aAAa,GACpB,OAAO,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Language Model Protocol
|
|
3
|
+
*
|
|
4
|
+
* Defines the standard interface for language model providers in Kernl.
|
|
5
|
+
*/
|
|
6
|
+
export type LanguageModel = {
|
|
7
|
+
/**
|
|
8
|
+
* The language model must specify which language model interface version it implements.
|
|
9
|
+
*/
|
|
10
|
+
readonly spec: "1.0";
|
|
11
|
+
/**
|
|
12
|
+
* Provider ID.
|
|
13
|
+
*/
|
|
14
|
+
readonly provider: string;
|
|
15
|
+
/**
|
|
16
|
+
* Provider-specific model ID.
|
|
17
|
+
*/
|
|
18
|
+
readonly modelId: string;
|
|
19
|
+
/**
|
|
20
|
+
* Supported URL patterns by media type for the provider.
|
|
21
|
+
*
|
|
22
|
+
* The keys are media type patterns or full media types (e.g. `*\/*` for everything, `audio/*`, `video/*`, or `application/pdf`).
|
|
23
|
+
* and the values are arrays of regular expressions that match the URL paths.
|
|
24
|
+
*
|
|
25
|
+
* The matching should be against lower-case URLs.
|
|
26
|
+
*
|
|
27
|
+
* Matched URLs are supported natively by the model and are not downloaded.
|
|
28
|
+
*
|
|
29
|
+
* @returns A map of supported URL patterns by media type (as a promise or a plain object).
|
|
30
|
+
*/
|
|
31
|
+
supportedUrls: PromiseLike<Record<string, RegExp[]>> | Record<string, RegExp[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Generates a language model output (non-streaming).
|
|
34
|
+
*
|
|
35
|
+
* Naming: "do" prefix to prevent accidental direct usage of the method
|
|
36
|
+
* by the user.
|
|
37
|
+
*/
|
|
38
|
+
doGenerate(options: LanguageModelV3CallOptions): PromiseLike<{
|
|
39
|
+
/**
|
|
40
|
+
* Ordered content that the model has generated.
|
|
41
|
+
*/
|
|
42
|
+
content: Array<LanguageModelV3Content>;
|
|
43
|
+
/**
|
|
44
|
+
* Finish reason.
|
|
45
|
+
*/
|
|
46
|
+
finishReason: LanguageModelV3FinishReason;
|
|
47
|
+
/**
|
|
48
|
+
* Usage information.
|
|
49
|
+
*/
|
|
50
|
+
usage: LanguageModelV3Usage;
|
|
51
|
+
/**
|
|
52
|
+
* Additional provider-specific metadata. They are passed through
|
|
53
|
+
* from the provider to the AI SDK and enable provider-specific
|
|
54
|
+
* results that can be fully encapsulated in the provider.
|
|
55
|
+
*/
|
|
56
|
+
providerMetadata?: SharedV3ProviderMetadata;
|
|
57
|
+
/**
|
|
58
|
+
* Optional request information for telemetry and debugging purposes.
|
|
59
|
+
*/
|
|
60
|
+
request?: {
|
|
61
|
+
/**
|
|
62
|
+
* Request HTTP body that was sent to the provider API.
|
|
63
|
+
*/
|
|
64
|
+
body?: unknown;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Optional response information for telemetry and debugging purposes.
|
|
68
|
+
*/
|
|
69
|
+
response?: LanguageModelV3ResponseMetadata & {
|
|
70
|
+
/**
|
|
71
|
+
* Response headers.
|
|
72
|
+
*/
|
|
73
|
+
headers?: SharedV3Headers;
|
|
74
|
+
/**
|
|
75
|
+
* Response HTTP body.
|
|
76
|
+
*/
|
|
77
|
+
body?: unknown;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Warnings for the call, e.g. unsupported settings.
|
|
81
|
+
*/
|
|
82
|
+
warnings: Array<LanguageModelV3CallWarning>;
|
|
83
|
+
}>;
|
|
84
|
+
/**
|
|
85
|
+
* Generates a language model output (streaming).
|
|
86
|
+
*
|
|
87
|
+
* Naming: "do" prefix to prevent accidental direct usage of the method
|
|
88
|
+
* by the user.
|
|
89
|
+
*
|
|
90
|
+
* @return A stream of higher-level language model output parts.
|
|
91
|
+
*/
|
|
92
|
+
doStream(options: LanguageModelV3CallOptions): PromiseLike<{
|
|
93
|
+
stream: ReadableStream<LanguageModelV3StreamPart>;
|
|
94
|
+
/**
|
|
95
|
+
* Optional request information for telemetry and debugging purposes.
|
|
96
|
+
*/
|
|
97
|
+
request?: {
|
|
98
|
+
/**
|
|
99
|
+
* Request HTTP body that was sent to the provider API.
|
|
100
|
+
*/
|
|
101
|
+
body?: unknown;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Optional response data.
|
|
105
|
+
*/
|
|
106
|
+
response?: {
|
|
107
|
+
/**
|
|
108
|
+
* Response headers.
|
|
109
|
+
*/
|
|
110
|
+
headers?: SharedV3Headers;
|
|
111
|
+
};
|
|
112
|
+
}>;
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=language-model.d.ts.map
|
|
@@ -0,0 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,OAAO,CAAC,EAAE;YACR;;eAEG;YACH,IAAI,CAAC,EAAE,OAAO,CAAC;SAChB,CAAC;QAEF;;WAEG;QACH,QAAQ,CAAC,EAAE;YACT;;eAEG;YACH,OAAO,CAAC,EAAE,eAAe,CAAC;SAC3B,CAAC;KACH,CAAC,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { SharedProviderMetadata } from "../provider";
|
|
2
|
+
import { LanguageModelResponseItem } from "./item";
|
|
3
|
+
import { LanguageModelRequest } from "./request";
|
|
4
|
+
import { LanguageModelStreamEvent } from "./stream";
|
|
5
|
+
import { LanguageModelFunctionTool, LanguageModelProviderTool } from "./tool";
|
|
6
|
+
/**
|
|
7
|
+
* Defines the standard interface for language model providers in kernl.
|
|
8
|
+
*/
|
|
9
|
+
export interface LanguageModel {
|
|
10
|
+
/**
|
|
11
|
+
* The language model must specify which language model interface version it implements.
|
|
12
|
+
*/
|
|
13
|
+
readonly spec: "1.0";
|
|
14
|
+
/**
|
|
15
|
+
* Provider ID.
|
|
16
|
+
*/
|
|
17
|
+
readonly provider: string;
|
|
18
|
+
/**
|
|
19
|
+
* Provider-specific model ID.
|
|
20
|
+
*/
|
|
21
|
+
readonly modelId: string;
|
|
22
|
+
/**
|
|
23
|
+
* Get a response from the model.
|
|
24
|
+
*
|
|
25
|
+
* @param request - The request to get a response for.
|
|
26
|
+
*/
|
|
27
|
+
generate(request: LanguageModelRequest): Promise<LanguageModelResponse>;
|
|
28
|
+
/**
|
|
29
|
+
* Get a streamed response from the model.
|
|
30
|
+
*
|
|
31
|
+
* @param request - The request to get a response for.
|
|
32
|
+
*/
|
|
33
|
+
stream(request: LanguageModelRequest): AsyncIterable<LanguageModelStreamEvent>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The base response interface for a language model.
|
|
37
|
+
*/
|
|
38
|
+
export interface LanguageModelResponse {
|
|
39
|
+
/**
|
|
40
|
+
* The ordered list of content items generated by the model.
|
|
41
|
+
*/
|
|
42
|
+
content: LanguageModelResponseItem[];
|
|
43
|
+
/**
|
|
44
|
+
* Finish reason.
|
|
45
|
+
*/
|
|
46
|
+
finishReason: LanguageModelFinishReason;
|
|
47
|
+
/**
|
|
48
|
+
* The usage information for response.
|
|
49
|
+
*/
|
|
50
|
+
usage: LanguageModelUsage;
|
|
51
|
+
/**
|
|
52
|
+
* Warnings for the call, e.g. unsupported settings.
|
|
53
|
+
*/
|
|
54
|
+
warnings: LanguageModelWarning[];
|
|
55
|
+
/**
|
|
56
|
+
* Raw response data from the underlying model provider.
|
|
57
|
+
*/
|
|
58
|
+
providerMetadata?: SharedProviderMetadata;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Reason why a language model finished generating a response.
|
|
62
|
+
*/
|
|
63
|
+
export type LanguageModelFinishReason = "stop" | "length" | "content-filter" | "tool-calls" | "error" | "other" | "unknown";
|
|
64
|
+
/**
|
|
65
|
+
* Usage information for a language model call.
|
|
66
|
+
*
|
|
67
|
+
* If your API return additional usage information, you can add it to the
|
|
68
|
+
* provider metadata under your provider's key.
|
|
69
|
+
*/
|
|
70
|
+
export interface LanguageModelUsage {
|
|
71
|
+
/**
|
|
72
|
+
* The number of input (prompt) tokens used.
|
|
73
|
+
*/
|
|
74
|
+
inputTokens: number | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* The number of output (completion) tokens used.
|
|
77
|
+
*/
|
|
78
|
+
outputTokens: number | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* The total number of tokens as reported by the provider.
|
|
81
|
+
* This number might be different from the sum of `inputTokens` and `outputTokens`
|
|
82
|
+
* and e.g. include reasoning tokens or other overhead.
|
|
83
|
+
*/
|
|
84
|
+
totalTokens: number | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* The number of reasoning tokens used.
|
|
87
|
+
*/
|
|
88
|
+
reasoningTokens?: number | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* The number of cached input tokens.
|
|
91
|
+
*/
|
|
92
|
+
cachedInputTokens?: number | undefined;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Warning from the model provider for this call. The call will proceed, but e.g.
|
|
96
|
+
* some settings might not be supported, which can lead to suboptimal results.
|
|
97
|
+
*/
|
|
98
|
+
export type LanguageModelWarning = {
|
|
99
|
+
type: "unsupported-setting";
|
|
100
|
+
setting: Omit<keyof LanguageModelRequest, "input">;
|
|
101
|
+
details?: string;
|
|
102
|
+
} | {
|
|
103
|
+
type: "unsupported-tool";
|
|
104
|
+
tool: LanguageModelFunctionTool | LanguageModelProviderTool;
|
|
105
|
+
details?: string;
|
|
106
|
+
} | {
|
|
107
|
+
type: "other";
|
|
108
|
+
message: string;
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/language-model/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,QAAQ,CAAC;AAE9E;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAExE;;;;OAIG;IACH,MAAM,CAC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0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import type { JSONSchema7 } from "json-schema";
|
|
2
|
+
import { SharedProviderOptions } from "../provider";
|
|
3
|
+
import { LanguageModelItem } from "./item";
|
|
4
|
+
import { LanguageModelFunctionTool, LanguageModelProviderTool } from "./tool";
|
|
5
|
+
export type LanguageModelTool = LanguageModelFunctionTool | LanguageModelProviderTool;
|
|
6
|
+
/**
|
|
7
|
+
* A request to a large language model.
|
|
8
|
+
*/
|
|
9
|
+
export interface LanguageModelRequest {
|
|
10
|
+
/**
|
|
11
|
+
* The input to the model.
|
|
12
|
+
*/
|
|
13
|
+
input: LanguageModelItem[];
|
|
14
|
+
/**
|
|
15
|
+
* The model settings to use for the request.
|
|
16
|
+
*/
|
|
17
|
+
settings: LanguageModelRequestSettings;
|
|
18
|
+
/**
|
|
19
|
+
* Response format. The output can either be text or JSON. Default is text.
|
|
20
|
+
*
|
|
21
|
+
* If JSON is selected, a schema can optionally be provided to guide the LLM.
|
|
22
|
+
*/
|
|
23
|
+
responseType?: LanguageModelResponseType;
|
|
24
|
+
/**
|
|
25
|
+
* The tools that are available for the model.
|
|
26
|
+
*/
|
|
27
|
+
tools?: LanguageModelTool[];
|
|
28
|
+
/**
|
|
29
|
+
Include raw chunks in the stream. Only applicable for streaming calls.
|
|
30
|
+
*/
|
|
31
|
+
includeRawChunks?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Abort signal for cancelling the operation.
|
|
34
|
+
*/
|
|
35
|
+
abort?: AbortSignal;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Response format specification for language model output.
|
|
39
|
+
*
|
|
40
|
+
* The output can either be text or JSON. Default is text.
|
|
41
|
+
* If JSON is selected, a schema can optionally be provided to guide the LLM.
|
|
42
|
+
*/
|
|
43
|
+
export type LanguageModelResponseType = LanguageModelResponseText | LanguageModelResponseJSON;
|
|
44
|
+
/**
|
|
45
|
+
* Text response format.
|
|
46
|
+
*/
|
|
47
|
+
export interface LanguageModelResponseText {
|
|
48
|
+
readonly kind: "text";
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* JSON response format.
|
|
52
|
+
*/
|
|
53
|
+
export interface LanguageModelResponseJSON {
|
|
54
|
+
readonly kind: "json";
|
|
55
|
+
/**
|
|
56
|
+
* JSON schema that the generated output should conform to.
|
|
57
|
+
*/
|
|
58
|
+
schema?: JSONSchema7;
|
|
59
|
+
/**
|
|
60
|
+
* Name of output that should be generated. Used by some providers for additional LLM guidance.
|
|
61
|
+
*/
|
|
62
|
+
name?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Description of the output that should be generated. Used by some providers for additional LLM guidance.
|
|
65
|
+
*/
|
|
66
|
+
description?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Settings to use when calling an LLM.
|
|
70
|
+
*
|
|
71
|
+
* This class holds optional model configuration parameters (e.g. temperature,
|
|
72
|
+
* topP, penalties, truncation, etc.).
|
|
73
|
+
*
|
|
74
|
+
* Not all models/providers support all of these parameters, so please check the API documentation
|
|
75
|
+
* for the specific model and provider you are using.
|
|
76
|
+
*/
|
|
77
|
+
export interface LanguageModelRequestSettings {
|
|
78
|
+
/**
|
|
79
|
+
* The temperature to use when calling the model.
|
|
80
|
+
*/
|
|
81
|
+
temperature?: number;
|
|
82
|
+
/**
|
|
83
|
+
* The topP to use when calling the model.
|
|
84
|
+
*/
|
|
85
|
+
topP?: number;
|
|
86
|
+
/**
|
|
87
|
+
* The frequency penalty to use when calling the model.
|
|
88
|
+
*/
|
|
89
|
+
frequencyPenalty?: number;
|
|
90
|
+
/**
|
|
91
|
+
* The presence penalty to use when calling the model.
|
|
92
|
+
*/
|
|
93
|
+
presencePenalty?: number;
|
|
94
|
+
/**
|
|
95
|
+
* The tool choice to use when calling the model.
|
|
96
|
+
*/
|
|
97
|
+
toolChoice?: LanguageModelToolChoice;
|
|
98
|
+
/**
|
|
99
|
+
* Whether to use parallel tool calls when calling the model.
|
|
100
|
+
* Defaults to false if not provided.
|
|
101
|
+
*/
|
|
102
|
+
parallelToolCalls?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* The truncation strategy to use when calling the model.
|
|
105
|
+
*/
|
|
106
|
+
truncation?: "auto" | "disabled";
|
|
107
|
+
/**
|
|
108
|
+
* The maximum number of output tokens to generate.
|
|
109
|
+
*/
|
|
110
|
+
maxTokens?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Whether to store the generated model response for later retrieval.
|
|
113
|
+
* Defaults to true if not provided.
|
|
114
|
+
*/
|
|
115
|
+
store?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* The reasoning settings to use when calling the model.
|
|
118
|
+
*/
|
|
119
|
+
reasoning?: ModelSettingsReasoning;
|
|
120
|
+
/**
|
|
121
|
+
* The text settings to use when calling the model.
|
|
122
|
+
*/
|
|
123
|
+
text?: ModelSettingsText;
|
|
124
|
+
/**
|
|
125
|
+
* Additional provider specific metadata to be passed directly to the model
|
|
126
|
+
* request.
|
|
127
|
+
*/
|
|
128
|
+
providerOptions?: SharedProviderOptions;
|
|
129
|
+
}
|
|
130
|
+
export type LanguageModelToolChoice = {
|
|
131
|
+
kind: "auto";
|
|
132
|
+
} | {
|
|
133
|
+
kind: "none";
|
|
134
|
+
} | {
|
|
135
|
+
kind: "required";
|
|
136
|
+
} | {
|
|
137
|
+
kind: "tool";
|
|
138
|
+
toolId: string;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning).
|
|
142
|
+
*
|
|
143
|
+
* Supported for providers:
|
|
144
|
+
*
|
|
145
|
+
* - OpenAI
|
|
146
|
+
* - ... ?
|
|
147
|
+
*/
|
|
148
|
+
export type ModelSettingsReasoningEffort = "minimal" | "low" | "medium" | "high" | null;
|
|
149
|
+
/**
|
|
150
|
+
* Configuration options for model reasoning
|
|
151
|
+
*/
|
|
152
|
+
export type ModelSettingsReasoning = {
|
|
153
|
+
/**
|
|
154
|
+
* Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning).
|
|
155
|
+
*/
|
|
156
|
+
effort?: ModelSettingsReasoningEffort | null;
|
|
157
|
+
/**
|
|
158
|
+
* A summary of the reasoning performed by the model.
|
|
159
|
+
* This can be useful for debugging and understanding the model's reasoning process.
|
|
160
|
+
* One of `auto`, `concise`, or `detailed`.
|
|
161
|
+
*/
|
|
162
|
+
summary?: "auto" | "concise" | "detailed" | null;
|
|
163
|
+
};
|
|
164
|
+
export interface ModelSettingsText {
|
|
165
|
+
/**
|
|
166
|
+
* Constrains the verbosity of the model's response.
|
|
167
|
+
*
|
|
168
|
+
* Supported for providers:
|
|
169
|
+
*
|
|
170
|
+
* - OpenAI
|
|
171
|
+
* - ... ?
|
|
172
|
+
*/
|
|
173
|
+
verbosity?: "low" | "medium" | "high" | null;
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/language-model/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,QAAQ,CAAC;AAE9E,MAAM,MAAM,iBAAiB,GACzB,yBAAyB,GACzB,yBAAyB,CAAC;AAE9B;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAE3B;;OAEG;IACH,QAAQ,EAAE,4BAA4B,CAAC;IAEvC;;;;OAIG;IACH,YAAY,CAAC,EAAE,yBAAyB,CAAC;IAEzC;;OAEG;IACH,KAAK,CAAC,EAAE,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