weave-typescript 0.41.0 → 0.42.4
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/weaveapi/{inference/v1/inference.pb.d.ts → gateway/v1/gateway.pb.d.ts} +108 -99
- package/dist/weaveapi/{inference/v1/inference.pb.js → gateway/v1/gateway.pb.js} +493 -402
- package/dist/weaveapi/{inference → gateway}/v1/service.pb.d.ts +15 -15
- package/dist/weaveapi/{inference → gateway}/v1/service.pb.js +63 -63
- package/package.json +2 -2
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
2
|
import { ProviderKind } from "../../provider/v1/provider.pb";
|
|
3
|
-
export declare const protobufPackage = "weaveapi.
|
|
4
|
-
/**
|
|
5
|
-
export declare enum
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
export declare const protobufPackage = "weaveapi.gateway.v1";
|
|
4
|
+
/** ModelOperation identifies one model gateway capability. */
|
|
5
|
+
export declare enum ModelOperation {
|
|
6
|
+
MODEL_OPERATION_UNSPECIFIED = 0,
|
|
7
|
+
MODEL_OPERATION_CHAT_COMPLETION = 1,
|
|
8
|
+
MODEL_OPERATION_STREAM_CHAT_COMPLETION = 2,
|
|
9
|
+
MODEL_OPERATION_STRUCTURED_OUTPUT = 3,
|
|
10
|
+
MODEL_OPERATION_TOOL_CALLING = 4,
|
|
11
|
+
MODEL_OPERATION_EMBEDDINGS = 5,
|
|
12
|
+
MODEL_OPERATION_IMAGE_GENERATION = 6,
|
|
13
|
+
MODEL_OPERATION_MCP_CALL = 7,
|
|
14
14
|
UNRECOGNIZED = -1
|
|
15
15
|
}
|
|
16
|
-
export declare function
|
|
17
|
-
export declare function
|
|
18
|
-
/**
|
|
19
|
-
export declare enum
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
export declare function modelOperationFromJSON(object: any): ModelOperation;
|
|
17
|
+
export declare function modelOperationToJSON(object: ModelOperation): string;
|
|
18
|
+
/** MessageRole identifies one participant role in a model gateway message. */
|
|
19
|
+
export declare enum MessageRole {
|
|
20
|
+
MESSAGE_ROLE_UNSPECIFIED = 0,
|
|
21
|
+
MESSAGE_ROLE_SYSTEM = 1,
|
|
22
|
+
MESSAGE_ROLE_USER = 2,
|
|
23
|
+
MESSAGE_ROLE_ASSISTANT = 3,
|
|
24
|
+
MESSAGE_ROLE_TOOL = 4,
|
|
25
|
+
MESSAGE_ROLE_DEVELOPER = 5,
|
|
26
26
|
UNRECOGNIZED = -1
|
|
27
27
|
}
|
|
28
|
-
export declare function
|
|
29
|
-
export declare function
|
|
30
|
-
/**
|
|
31
|
-
export declare enum
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
export declare function messageRoleFromJSON(object: any): MessageRole;
|
|
29
|
+
export declare function messageRoleToJSON(object: MessageRole): string;
|
|
30
|
+
/** FinishReason describes why one model call ended. */
|
|
31
|
+
export declare enum FinishReason {
|
|
32
|
+
FINISH_REASON_UNSPECIFIED = 0,
|
|
33
|
+
FINISH_REASON_STOP = 1,
|
|
34
|
+
FINISH_REASON_LENGTH = 2,
|
|
35
|
+
FINISH_REASON_TOOL_CALLS = 3,
|
|
36
|
+
FINISH_REASON_CONTENT_FILTER = 4,
|
|
37
|
+
FINISH_REASON_ERROR = 5,
|
|
38
38
|
UNRECOGNIZED = -1
|
|
39
39
|
}
|
|
40
|
-
export declare function
|
|
41
|
-
export declare function
|
|
40
|
+
export declare function finishReasonFromJSON(object: any): FinishReason;
|
|
41
|
+
export declare function finishReasonToJSON(object: FinishReason): string;
|
|
42
42
|
/** ToolChoiceMode controls how tool use should be resolved. */
|
|
43
43
|
export declare enum ToolChoiceMode {
|
|
44
44
|
TOOL_CHOICE_MODE_UNSPECIFIED = 0,
|
|
@@ -59,23 +59,23 @@ export declare enum ImageDeliveryMode {
|
|
|
59
59
|
}
|
|
60
60
|
export declare function imageDeliveryModeFromJSON(object: any): ImageDeliveryMode;
|
|
61
61
|
export declare function imageDeliveryModeToJSON(object: ImageDeliveryMode): string;
|
|
62
|
-
/**
|
|
63
|
-
export declare enum
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
/** TokenKind classifies one token bucket for usage accounting. */
|
|
63
|
+
export declare enum TokenKind {
|
|
64
|
+
TOKEN_KIND_UNSPECIFIED = 0,
|
|
65
|
+
TOKEN_KIND_INPUT = 1,
|
|
66
|
+
TOKEN_KIND_INPUT_CACHE_WRITE = 2,
|
|
67
|
+
TOKEN_KIND_INPUT_CACHE_READ = 3,
|
|
68
|
+
TOKEN_KIND_INPUT_AUDIO = 4,
|
|
69
|
+
TOKEN_KIND_INPUT_IMAGE = 5,
|
|
70
|
+
TOKEN_KIND_OUTPUT = 6,
|
|
71
|
+
TOKEN_KIND_OUTPUT_REASONING = 7,
|
|
72
|
+
TOKEN_KIND_OUTPUT_AUDIO = 8,
|
|
73
73
|
UNRECOGNIZED = -1
|
|
74
74
|
}
|
|
75
|
-
export declare function
|
|
76
|
-
export declare function
|
|
77
|
-
/**
|
|
78
|
-
export interface
|
|
75
|
+
export declare function tokenKindFromJSON(object: any): TokenKind;
|
|
76
|
+
export declare function tokenKindToJSON(object: TokenKind): string;
|
|
77
|
+
/** RequestContext contains caller-supplied routing hints. */
|
|
78
|
+
export interface RequestContext {
|
|
79
79
|
organizationId: string;
|
|
80
80
|
approvedModelId: string;
|
|
81
81
|
idempotencyKey: string;
|
|
@@ -83,36 +83,36 @@ export interface InferenceRequestContext {
|
|
|
83
83
|
[key: string]: any;
|
|
84
84
|
} | undefined;
|
|
85
85
|
}
|
|
86
|
-
/**
|
|
87
|
-
export interface
|
|
86
|
+
/** ResolvedModelRoute describes the execution route chosen by Weave. */
|
|
87
|
+
export interface ResolvedModelRoute {
|
|
88
88
|
organizationId: string;
|
|
89
89
|
approvedModelId: string;
|
|
90
90
|
providerConfigurationId: string;
|
|
91
91
|
providerKind: ProviderKind;
|
|
92
92
|
resolvedModel: string;
|
|
93
|
-
|
|
93
|
+
operation: ModelOperation;
|
|
94
94
|
requestId: string;
|
|
95
95
|
upstreamRequestId: string;
|
|
96
96
|
requestedAt: Date | undefined;
|
|
97
97
|
}
|
|
98
|
-
/**
|
|
99
|
-
export interface
|
|
100
|
-
kind:
|
|
98
|
+
/** TokenUsageBreakdown is one normalized token meter bucket. */
|
|
99
|
+
export interface TokenUsageBreakdown {
|
|
100
|
+
kind: TokenKind;
|
|
101
101
|
tokenCount: number;
|
|
102
102
|
providerMetricName: string;
|
|
103
103
|
}
|
|
104
|
-
/**
|
|
105
|
-
export interface
|
|
104
|
+
/** Usage summarizes token accounting. */
|
|
105
|
+
export interface Usage {
|
|
106
106
|
inputTokens: number;
|
|
107
107
|
outputTokens: number;
|
|
108
108
|
totalTokens: number;
|
|
109
|
-
tokenBreakdown:
|
|
109
|
+
tokenBreakdown: TokenUsageBreakdown[];
|
|
110
110
|
providerUsageRaw: {
|
|
111
111
|
[key: string]: any;
|
|
112
112
|
} | undefined;
|
|
113
113
|
}
|
|
114
|
-
/**
|
|
115
|
-
export interface
|
|
114
|
+
/** GenerationConfig captures common generation controls. */
|
|
115
|
+
export interface GenerationConfig {
|
|
116
116
|
temperature: number;
|
|
117
117
|
maxOutputTokens: number;
|
|
118
118
|
stopSequences: string[];
|
|
@@ -146,9 +146,17 @@ export interface ToolDefinition {
|
|
|
146
146
|
export interface ToolCall {
|
|
147
147
|
id: string;
|
|
148
148
|
name: string;
|
|
149
|
-
arguments
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
/** Complete JSON object containing tool arguments. */
|
|
150
|
+
argumentsJson: string;
|
|
151
|
+
}
|
|
152
|
+
/** ToolCallDelta is one streaming tool-call update. */
|
|
153
|
+
export interface ToolCallDelta {
|
|
154
|
+
id: string;
|
|
155
|
+
name: string;
|
|
156
|
+
/** Raw streamed argument fragment. This may not be valid JSON on its own. */
|
|
157
|
+
argumentsDelta: string;
|
|
158
|
+
/** Complete JSON object containing tool arguments when the provider emits one. */
|
|
159
|
+
argumentsJson: string;
|
|
152
160
|
}
|
|
153
161
|
/** ToolResult is one tool result returned to the model. */
|
|
154
162
|
export interface ToolResult {
|
|
@@ -159,8 +167,8 @@ export interface ToolResult {
|
|
|
159
167
|
} | undefined;
|
|
160
168
|
isError: boolean;
|
|
161
169
|
}
|
|
162
|
-
/**
|
|
163
|
-
export interface
|
|
170
|
+
/** ContentPart is one model gateway content fragment. */
|
|
171
|
+
export interface ContentPart {
|
|
164
172
|
text?: string | undefined;
|
|
165
173
|
imageUrl?: string | undefined;
|
|
166
174
|
binaryData?: Uint8Array | undefined;
|
|
@@ -171,10 +179,10 @@ export interface InferenceContentPart {
|
|
|
171
179
|
toolResult?: ToolResult | undefined;
|
|
172
180
|
mimeType: string;
|
|
173
181
|
}
|
|
174
|
-
/** ChatMessage is one
|
|
182
|
+
/** ChatMessage is one model gateway input or output message. */
|
|
175
183
|
export interface ChatMessage {
|
|
176
|
-
role:
|
|
177
|
-
content:
|
|
184
|
+
role: MessageRole;
|
|
185
|
+
content: ContentPart[];
|
|
178
186
|
participantName: string;
|
|
179
187
|
toolCallId: string;
|
|
180
188
|
}
|
|
@@ -199,65 +207,65 @@ export interface GeneratedImage {
|
|
|
199
207
|
revisedPrompt: string;
|
|
200
208
|
}
|
|
201
209
|
export interface CreateChatCompletionRequest {
|
|
202
|
-
context:
|
|
210
|
+
context: RequestContext | undefined;
|
|
203
211
|
model: string;
|
|
204
212
|
messages: ChatMessage[];
|
|
205
213
|
systemInstruction: string;
|
|
206
214
|
tools: ToolDefinition[];
|
|
207
215
|
toolChoiceMode: ToolChoiceMode;
|
|
208
|
-
generationConfig:
|
|
216
|
+
generationConfig: GenerationConfig | undefined;
|
|
209
217
|
responseSchema: StructuredOutputSchema | undefined;
|
|
210
218
|
}
|
|
211
219
|
export interface CreateChatCompletionResponse {
|
|
212
|
-
context:
|
|
220
|
+
context: ResolvedModelRoute | undefined;
|
|
213
221
|
message: ChatMessage | undefined;
|
|
214
222
|
toolCalls: ToolCall[];
|
|
215
|
-
finishReason:
|
|
216
|
-
usage:
|
|
223
|
+
finishReason: FinishReason;
|
|
224
|
+
usage: Usage | undefined;
|
|
217
225
|
structuredOutput: {
|
|
218
226
|
[key: string]: any;
|
|
219
227
|
} | undefined;
|
|
220
228
|
}
|
|
221
229
|
export interface StreamChatCompletionRequest {
|
|
222
|
-
context:
|
|
230
|
+
context: RequestContext | undefined;
|
|
223
231
|
model: string;
|
|
224
232
|
messages: ChatMessage[];
|
|
225
233
|
systemInstruction: string;
|
|
226
234
|
tools: ToolDefinition[];
|
|
227
235
|
toolChoiceMode: ToolChoiceMode;
|
|
228
|
-
generationConfig:
|
|
236
|
+
generationConfig: GenerationConfig | undefined;
|
|
229
237
|
responseSchema: StructuredOutputSchema | undefined;
|
|
230
238
|
}
|
|
231
239
|
export interface StreamChatCompletionResponse {
|
|
232
|
-
context:
|
|
240
|
+
context: ResolvedModelRoute | undefined;
|
|
233
241
|
deltaText: string;
|
|
234
242
|
deltaMessage: ChatMessage | undefined;
|
|
235
|
-
toolCallDelta:
|
|
236
|
-
finishReason:
|
|
237
|
-
usage:
|
|
243
|
+
toolCallDelta: ToolCallDelta | undefined;
|
|
244
|
+
finishReason: FinishReason;
|
|
245
|
+
usage: Usage | undefined;
|
|
238
246
|
done: boolean;
|
|
239
247
|
structuredOutput: {
|
|
240
248
|
[key: string]: any;
|
|
241
249
|
} | undefined;
|
|
242
250
|
}
|
|
243
251
|
export interface CallToolsRequest {
|
|
244
|
-
context:
|
|
252
|
+
context: RequestContext | undefined;
|
|
245
253
|
model: string;
|
|
246
254
|
messages: ChatMessage[];
|
|
247
255
|
systemInstruction: string;
|
|
248
256
|
tools: ToolDefinition[];
|
|
249
257
|
toolChoiceMode: ToolChoiceMode;
|
|
250
|
-
generationConfig:
|
|
258
|
+
generationConfig: GenerationConfig | undefined;
|
|
251
259
|
}
|
|
252
260
|
export interface CallToolsResponse {
|
|
253
|
-
context:
|
|
261
|
+
context: ResolvedModelRoute | undefined;
|
|
254
262
|
message: ChatMessage | undefined;
|
|
255
263
|
toolCalls: ToolCall[];
|
|
256
|
-
finishReason:
|
|
257
|
-
usage:
|
|
264
|
+
finishReason: FinishReason;
|
|
265
|
+
usage: Usage | undefined;
|
|
258
266
|
}
|
|
259
267
|
export interface CreateEmbeddingsRequest {
|
|
260
|
-
context:
|
|
268
|
+
context: RequestContext | undefined;
|
|
261
269
|
model: string;
|
|
262
270
|
inputs: EmbeddingInput[];
|
|
263
271
|
dimensions: number;
|
|
@@ -267,12 +275,12 @@ export interface CreateEmbeddingsRequest {
|
|
|
267
275
|
} | undefined;
|
|
268
276
|
}
|
|
269
277
|
export interface CreateEmbeddingsResponse {
|
|
270
|
-
context:
|
|
278
|
+
context: ResolvedModelRoute | undefined;
|
|
271
279
|
embeddings: EmbeddingVector[];
|
|
272
|
-
usage:
|
|
280
|
+
usage: Usage | undefined;
|
|
273
281
|
}
|
|
274
282
|
export interface GenerateImagesRequest {
|
|
275
|
-
context:
|
|
283
|
+
context: RequestContext | undefined;
|
|
276
284
|
model: string;
|
|
277
285
|
prompt: string;
|
|
278
286
|
negativePrompt: string;
|
|
@@ -286,11 +294,11 @@ export interface GenerateImagesRequest {
|
|
|
286
294
|
} | undefined;
|
|
287
295
|
}
|
|
288
296
|
export interface GenerateImagesResponse {
|
|
289
|
-
context:
|
|
297
|
+
context: ResolvedModelRoute | undefined;
|
|
290
298
|
images: GeneratedImage[];
|
|
291
299
|
}
|
|
292
300
|
export interface CallMCPRequest {
|
|
293
|
-
context:
|
|
301
|
+
context: RequestContext | undefined;
|
|
294
302
|
model: string;
|
|
295
303
|
serverName: string;
|
|
296
304
|
toolName: string;
|
|
@@ -302,7 +310,7 @@ export interface CallMCPRequest {
|
|
|
302
310
|
} | undefined;
|
|
303
311
|
}
|
|
304
312
|
export interface CallMCPResponse {
|
|
305
|
-
context:
|
|
313
|
+
context: ResolvedModelRoute | undefined;
|
|
306
314
|
result: {
|
|
307
315
|
[key: string]: any;
|
|
308
316
|
} | undefined;
|
|
@@ -372,7 +380,7 @@ export interface OpenAICompatibilityServiceCreateChatCompletionResponse {
|
|
|
372
380
|
object: string;
|
|
373
381
|
model: string;
|
|
374
382
|
choices: OpenAIChatChoice[];
|
|
375
|
-
usage:
|
|
383
|
+
usage: Usage | undefined;
|
|
376
384
|
}
|
|
377
385
|
export interface OpenAIChatDeltaChoice {
|
|
378
386
|
index: number;
|
|
@@ -399,7 +407,7 @@ export interface OpenAICompatibilityServiceStreamChatCompletionResponse {
|
|
|
399
407
|
object: string;
|
|
400
408
|
model: string;
|
|
401
409
|
choices: OpenAIChatDeltaChoice[];
|
|
402
|
-
usage:
|
|
410
|
+
usage: Usage | undefined;
|
|
403
411
|
done: boolean;
|
|
404
412
|
}
|
|
405
413
|
export interface OpenAICompatibilityServiceCreateEmbeddingRequest {
|
|
@@ -418,7 +426,7 @@ export interface OpenAICompatibilityServiceCreateEmbeddingResponse {
|
|
|
418
426
|
object: string;
|
|
419
427
|
data: OpenAIEmbeddingData[];
|
|
420
428
|
model: string;
|
|
421
|
-
usage:
|
|
429
|
+
usage: Usage | undefined;
|
|
422
430
|
}
|
|
423
431
|
export interface OpenAICompatibilityServiceGenerateImageRequest {
|
|
424
432
|
model: string;
|
|
@@ -515,16 +523,17 @@ export interface AnthropicCompatibilityServiceStreamMessagesResponse {
|
|
|
515
523
|
usage: AnthropicUsage | undefined;
|
|
516
524
|
done: boolean;
|
|
517
525
|
}
|
|
518
|
-
export declare const
|
|
519
|
-
export declare const
|
|
520
|
-
export declare const
|
|
521
|
-
export declare const
|
|
522
|
-
export declare const
|
|
526
|
+
export declare const RequestContext: MessageFns<RequestContext>;
|
|
527
|
+
export declare const ResolvedModelRoute: MessageFns<ResolvedModelRoute>;
|
|
528
|
+
export declare const TokenUsageBreakdown: MessageFns<TokenUsageBreakdown>;
|
|
529
|
+
export declare const Usage: MessageFns<Usage>;
|
|
530
|
+
export declare const GenerationConfig: MessageFns<GenerationConfig>;
|
|
523
531
|
export declare const StructuredOutputSchema: MessageFns<StructuredOutputSchema>;
|
|
524
532
|
export declare const ToolDefinition: MessageFns<ToolDefinition>;
|
|
525
533
|
export declare const ToolCall: MessageFns<ToolCall>;
|
|
534
|
+
export declare const ToolCallDelta: MessageFns<ToolCallDelta>;
|
|
526
535
|
export declare const ToolResult: MessageFns<ToolResult>;
|
|
527
|
-
export declare const
|
|
536
|
+
export declare const ContentPart: MessageFns<ContentPart>;
|
|
528
537
|
export declare const ChatMessage: MessageFns<ChatMessage>;
|
|
529
538
|
export declare const EmbeddingInput: MessageFns<EmbeddingInput>;
|
|
530
539
|
export declare const EmbeddingVector: MessageFns<EmbeddingVector>;
|