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.
@@ -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.inference.v1";
4
- /** InferenceOperationType identifies one canonical execution capability. */
5
- export declare enum InferenceOperationType {
6
- INFERENCE_OPERATION_TYPE_UNSPECIFIED = 0,
7
- INFERENCE_OPERATION_TYPE_CHAT_COMPLETION = 1,
8
- INFERENCE_OPERATION_TYPE_STREAM_CHAT_COMPLETION = 2,
9
- INFERENCE_OPERATION_TYPE_STRUCTURED_OUTPUT = 3,
10
- INFERENCE_OPERATION_TYPE_TOOL_CALLING = 4,
11
- INFERENCE_OPERATION_TYPE_EMBEDDINGS = 5,
12
- INFERENCE_OPERATION_TYPE_IMAGE_GENERATION = 6,
13
- INFERENCE_OPERATION_TYPE_MCP_CALL = 7,
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 inferenceOperationTypeFromJSON(object: any): InferenceOperationType;
17
- export declare function inferenceOperationTypeToJSON(object: InferenceOperationType): string;
18
- /** InferenceMessageRole identifies one participant role in a canonical message. */
19
- export declare enum InferenceMessageRole {
20
- INFERENCE_MESSAGE_ROLE_UNSPECIFIED = 0,
21
- INFERENCE_MESSAGE_ROLE_SYSTEM = 1,
22
- INFERENCE_MESSAGE_ROLE_USER = 2,
23
- INFERENCE_MESSAGE_ROLE_ASSISTANT = 3,
24
- INFERENCE_MESSAGE_ROLE_TOOL = 4,
25
- INFERENCE_MESSAGE_ROLE_DEVELOPER = 5,
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 inferenceMessageRoleFromJSON(object: any): InferenceMessageRole;
29
- export declare function inferenceMessageRoleToJSON(object: InferenceMessageRole): string;
30
- /** InferenceFinishReason describes why one inference operation ended. */
31
- export declare enum InferenceFinishReason {
32
- INFERENCE_FINISH_REASON_UNSPECIFIED = 0,
33
- INFERENCE_FINISH_REASON_STOP = 1,
34
- INFERENCE_FINISH_REASON_LENGTH = 2,
35
- INFERENCE_FINISH_REASON_TOOL_CALLS = 3,
36
- INFERENCE_FINISH_REASON_CONTENT_FILTER = 4,
37
- INFERENCE_FINISH_REASON_ERROR = 5,
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 inferenceFinishReasonFromJSON(object: any): InferenceFinishReason;
41
- export declare function inferenceFinishReasonToJSON(object: InferenceFinishReason): string;
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
- /** InferenceTokenKind classifies one token bucket for usage accounting. */
63
- export declare enum InferenceTokenKind {
64
- INFERENCE_TOKEN_KIND_UNSPECIFIED = 0,
65
- INFERENCE_TOKEN_KIND_INPUT = 1,
66
- INFERENCE_TOKEN_KIND_INPUT_CACHE_WRITE = 2,
67
- INFERENCE_TOKEN_KIND_INPUT_CACHE_READ = 3,
68
- INFERENCE_TOKEN_KIND_INPUT_AUDIO = 4,
69
- INFERENCE_TOKEN_KIND_INPUT_IMAGE = 5,
70
- INFERENCE_TOKEN_KIND_OUTPUT = 6,
71
- INFERENCE_TOKEN_KIND_OUTPUT_REASONING = 7,
72
- INFERENCE_TOKEN_KIND_OUTPUT_AUDIO = 8,
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 inferenceTokenKindFromJSON(object: any): InferenceTokenKind;
76
- export declare function inferenceTokenKindToJSON(object: InferenceTokenKind): string;
77
- /** InferenceRequestContext contains caller-supplied routing hints. */
78
- export interface InferenceRequestContext {
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
- /** ResolvedInferenceContext describes the execution route chosen by Weave. */
87
- export interface ResolvedInferenceContext {
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
- operationType: InferenceOperationType;
93
+ operation: ModelOperation;
94
94
  requestId: string;
95
95
  upstreamRequestId: string;
96
96
  requestedAt: Date | undefined;
97
97
  }
98
- /** InferenceTokenUsageBreakdown is one normalized token meter bucket. */
99
- export interface InferenceTokenUsageBreakdown {
100
- kind: InferenceTokenKind;
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
- /** InferenceUsage summarizes token accounting. */
105
- export interface InferenceUsage {
104
+ /** Usage summarizes token accounting. */
105
+ export interface Usage {
106
106
  inputTokens: number;
107
107
  outputTokens: number;
108
108
  totalTokens: number;
109
- tokenBreakdown: InferenceTokenUsageBreakdown[];
109
+ tokenBreakdown: TokenUsageBreakdown[];
110
110
  providerUsageRaw: {
111
111
  [key: string]: any;
112
112
  } | undefined;
113
113
  }
114
- /** InferenceGenerationConfig captures common generation controls. */
115
- export interface InferenceGenerationConfig {
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
- [key: string]: any;
151
- } | undefined;
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
- /** InferenceContentPart is one canonical content fragment. */
163
- export interface InferenceContentPart {
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 canonical input or output message. */
182
+ /** ChatMessage is one model gateway input or output message. */
175
183
  export interface ChatMessage {
176
- role: InferenceMessageRole;
177
- content: InferenceContentPart[];
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: InferenceRequestContext | undefined;
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: InferenceGenerationConfig | undefined;
216
+ generationConfig: GenerationConfig | undefined;
209
217
  responseSchema: StructuredOutputSchema | undefined;
210
218
  }
211
219
  export interface CreateChatCompletionResponse {
212
- context: ResolvedInferenceContext | undefined;
220
+ context: ResolvedModelRoute | undefined;
213
221
  message: ChatMessage | undefined;
214
222
  toolCalls: ToolCall[];
215
- finishReason: InferenceFinishReason;
216
- usage: InferenceUsage | undefined;
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: InferenceRequestContext | undefined;
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: InferenceGenerationConfig | undefined;
236
+ generationConfig: GenerationConfig | undefined;
229
237
  responseSchema: StructuredOutputSchema | undefined;
230
238
  }
231
239
  export interface StreamChatCompletionResponse {
232
- context: ResolvedInferenceContext | undefined;
240
+ context: ResolvedModelRoute | undefined;
233
241
  deltaText: string;
234
242
  deltaMessage: ChatMessage | undefined;
235
- toolCallDelta: ToolCall | undefined;
236
- finishReason: InferenceFinishReason;
237
- usage: InferenceUsage | undefined;
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: InferenceRequestContext | undefined;
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: InferenceGenerationConfig | undefined;
258
+ generationConfig: GenerationConfig | undefined;
251
259
  }
252
260
  export interface CallToolsResponse {
253
- context: ResolvedInferenceContext | undefined;
261
+ context: ResolvedModelRoute | undefined;
254
262
  message: ChatMessage | undefined;
255
263
  toolCalls: ToolCall[];
256
- finishReason: InferenceFinishReason;
257
- usage: InferenceUsage | undefined;
264
+ finishReason: FinishReason;
265
+ usage: Usage | undefined;
258
266
  }
259
267
  export interface CreateEmbeddingsRequest {
260
- context: InferenceRequestContext | undefined;
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: ResolvedInferenceContext | undefined;
278
+ context: ResolvedModelRoute | undefined;
271
279
  embeddings: EmbeddingVector[];
272
- usage: InferenceUsage | undefined;
280
+ usage: Usage | undefined;
273
281
  }
274
282
  export interface GenerateImagesRequest {
275
- context: InferenceRequestContext | undefined;
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: ResolvedInferenceContext | undefined;
297
+ context: ResolvedModelRoute | undefined;
290
298
  images: GeneratedImage[];
291
299
  }
292
300
  export interface CallMCPRequest {
293
- context: InferenceRequestContext | undefined;
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: ResolvedInferenceContext | undefined;
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: InferenceUsage | undefined;
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: InferenceUsage | undefined;
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: InferenceUsage | undefined;
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 InferenceRequestContext: MessageFns<InferenceRequestContext>;
519
- export declare const ResolvedInferenceContext: MessageFns<ResolvedInferenceContext>;
520
- export declare const InferenceTokenUsageBreakdown: MessageFns<InferenceTokenUsageBreakdown>;
521
- export declare const InferenceUsage: MessageFns<InferenceUsage>;
522
- export declare const InferenceGenerationConfig: MessageFns<InferenceGenerationConfig>;
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 InferenceContentPart: MessageFns<InferenceContentPart>;
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>;