@quilltap/plugin-types 2.5.1 → 2.5.3
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/common/index.d.mts +78 -78
- package/dist/common/index.d.ts +78 -78
- package/dist/index-B__Tj6zS.d.mts +710 -0
- package/dist/index-B__Tj6zS.d.ts +710 -0
- package/dist/{index-DMY1o4_1.d.mts → index-BopBLWVq.d.mts} +51 -2
- package/dist/{index-BHELsKhd.d.ts → index-BxjmBw1K.d.ts} +51 -2
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/llm/index.d.mts +1 -695
- package/dist/llm/index.d.ts +1 -695
- package/dist/plugins/index.d.mts +2 -2
- package/dist/plugins/index.d.ts +2 -2
- package/dist/providers/index.d.mts +1 -1
- package/dist/providers/index.d.ts +1 -1
- package/package.json +2 -2
package/dist/llm/index.d.mts
CHANGED
|
@@ -1,695 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Common types shared across all provider interfaces
|
|
3
|
-
*
|
|
4
|
-
* These types are used by multiple provider shapes (text, image, embedding, scoring)
|
|
5
|
-
* and are extracted here to avoid duplication.
|
|
6
|
-
*
|
|
7
|
-
* @module @quilltap/plugin-types/providers/common
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* File attachment for multimodal messages
|
|
11
|
-
*/
|
|
12
|
-
interface FileAttachment {
|
|
13
|
-
/** Unique identifier for the attachment */
|
|
14
|
-
id: string;
|
|
15
|
-
/** Path to the file on disk (internal use) */
|
|
16
|
-
filepath?: string;
|
|
17
|
-
/** Original filename */
|
|
18
|
-
filename: string;
|
|
19
|
-
/** MIME type of the file */
|
|
20
|
-
mimeType: string;
|
|
21
|
-
/** File size in bytes */
|
|
22
|
-
size: number;
|
|
23
|
-
/** Base64 encoded data (loaded at send time) */
|
|
24
|
-
data?: string;
|
|
25
|
-
/** URL to fetch the file (alternative to data) */
|
|
26
|
-
url?: string;
|
|
27
|
-
/** Additional metadata */
|
|
28
|
-
metadata?: Record<string, unknown>;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Token usage statistics
|
|
32
|
-
*/
|
|
33
|
-
interface TokenUsage {
|
|
34
|
-
/** Tokens used for the prompt */
|
|
35
|
-
promptTokens: number;
|
|
36
|
-
/** Tokens used for the completion */
|
|
37
|
-
completionTokens: number;
|
|
38
|
-
/** Total tokens used */
|
|
39
|
-
totalTokens: number;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Cache usage statistics (OpenRouter, Anthropic)
|
|
43
|
-
*/
|
|
44
|
-
interface CacheUsage {
|
|
45
|
-
/** Number of cached tokens */
|
|
46
|
-
cachedTokens?: number;
|
|
47
|
-
/** Cache discount amount */
|
|
48
|
-
cacheDiscount?: number;
|
|
49
|
-
/** Tokens used for cache creation */
|
|
50
|
-
cacheCreationInputTokens?: number;
|
|
51
|
-
/** Tokens read from cache */
|
|
52
|
-
cacheReadInputTokens?: number;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Attachment processing results
|
|
56
|
-
*/
|
|
57
|
-
interface AttachmentResults {
|
|
58
|
-
/** IDs of attachments sent successfully */
|
|
59
|
-
sent: string[];
|
|
60
|
-
/** Attachments that failed with error details */
|
|
61
|
-
failed: Array<{
|
|
62
|
-
id: string;
|
|
63
|
-
error: string;
|
|
64
|
-
}>;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Model warning level
|
|
68
|
-
*/
|
|
69
|
-
type ModelWarningLevel = 'info' | 'warning' | 'error';
|
|
70
|
-
/**
|
|
71
|
-
* Model warning information
|
|
72
|
-
*/
|
|
73
|
-
interface ModelWarning {
|
|
74
|
-
/** Warning severity level */
|
|
75
|
-
level: ModelWarningLevel;
|
|
76
|
-
/** Warning message */
|
|
77
|
-
message: string;
|
|
78
|
-
/** Optional link to documentation */
|
|
79
|
-
documentationUrl?: string;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Model metadata with warnings and capabilities
|
|
83
|
-
*/
|
|
84
|
-
interface ModelMetadata {
|
|
85
|
-
/** Model identifier */
|
|
86
|
-
id: string;
|
|
87
|
-
/** Human-readable display name */
|
|
88
|
-
displayName?: string;
|
|
89
|
-
/** Warnings or recommendations */
|
|
90
|
-
warnings?: ModelWarning[];
|
|
91
|
-
/** Whether the model is deprecated */
|
|
92
|
-
deprecated?: boolean;
|
|
93
|
-
/** Whether the model is experimental/preview */
|
|
94
|
-
experimental?: boolean;
|
|
95
|
-
/** Capabilities this model lacks */
|
|
96
|
-
missingCapabilities?: string[];
|
|
97
|
-
/** Maximum output tokens */
|
|
98
|
-
maxOutputTokens?: number;
|
|
99
|
-
/** Context window size */
|
|
100
|
-
contextWindow?: number;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Tool/Function calling types for Quilltap plugin development
|
|
105
|
-
*
|
|
106
|
-
* @module @quilltap/plugin-types/llm/tools
|
|
107
|
-
*/
|
|
108
|
-
/**
|
|
109
|
-
* OpenAI-format tool definition
|
|
110
|
-
* Used as the universal baseline format for tool definitions
|
|
111
|
-
*/
|
|
112
|
-
interface OpenAIToolDefinition {
|
|
113
|
-
/** Tool type - always 'function' for function calling */
|
|
114
|
-
type: 'function';
|
|
115
|
-
function: {
|
|
116
|
-
/** Name of the function */
|
|
117
|
-
name: string;
|
|
118
|
-
/** Description of what the function does */
|
|
119
|
-
description?: string;
|
|
120
|
-
/** Parameters schema in JSON Schema format */
|
|
121
|
-
parameters?: {
|
|
122
|
-
type: 'object';
|
|
123
|
-
properties: Record<string, unknown>;
|
|
124
|
-
required?: string[];
|
|
125
|
-
additionalProperties?: boolean;
|
|
126
|
-
};
|
|
127
|
-
/** Whether to use strict mode for parameters */
|
|
128
|
-
strict?: boolean;
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Universal tool format (alias for OpenAI format)
|
|
133
|
-
* Used as the standard format across all providers
|
|
134
|
-
*/
|
|
135
|
-
interface UniversalTool {
|
|
136
|
-
/** Tool type - always 'function' */
|
|
137
|
-
type: 'function';
|
|
138
|
-
function: {
|
|
139
|
-
/** Name of the tool/function */
|
|
140
|
-
name: string;
|
|
141
|
-
/** Description of what the tool does */
|
|
142
|
-
description: string;
|
|
143
|
-
/** Parameters schema in JSON Schema format */
|
|
144
|
-
parameters: {
|
|
145
|
-
type: 'object';
|
|
146
|
-
properties: Record<string, unknown>;
|
|
147
|
-
required: string[];
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Anthropic-format tool definition
|
|
153
|
-
* Tool use format expected by Anthropic Claude models
|
|
154
|
-
*/
|
|
155
|
-
interface AnthropicToolDefinition {
|
|
156
|
-
/** Name of the tool */
|
|
157
|
-
name: string;
|
|
158
|
-
/** Description of what the tool does */
|
|
159
|
-
description?: string;
|
|
160
|
-
/** Input schema in JSON Schema format */
|
|
161
|
-
input_schema: {
|
|
162
|
-
type: 'object';
|
|
163
|
-
properties: Record<string, unknown>;
|
|
164
|
-
required?: string[];
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Google-format tool definition
|
|
169
|
-
* Function calling format expected by Google Gemini models
|
|
170
|
-
*/
|
|
171
|
-
interface GoogleToolDefinition {
|
|
172
|
-
/** Name of the function */
|
|
173
|
-
name: string;
|
|
174
|
-
/** Description of what the function does */
|
|
175
|
-
description: string;
|
|
176
|
-
/** Parameters schema in JSON Schema format */
|
|
177
|
-
parameters: {
|
|
178
|
-
type: 'object';
|
|
179
|
-
properties: Record<string, unknown>;
|
|
180
|
-
required: string[];
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Tool call from assistant response
|
|
185
|
-
* Represents a tool call made by the model
|
|
186
|
-
*/
|
|
187
|
-
interface ToolCall {
|
|
188
|
-
/** Unique ID for this tool call */
|
|
189
|
-
id: string;
|
|
190
|
-
/** Type of tool call - always 'function' */
|
|
191
|
-
type: 'function';
|
|
192
|
-
function: {
|
|
193
|
-
/** Name of the function to call */
|
|
194
|
-
name: string;
|
|
195
|
-
/** Arguments as a JSON string */
|
|
196
|
-
arguments: string;
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Parsed tool call request
|
|
201
|
-
* Used consistently across all providers after parsing
|
|
202
|
-
*/
|
|
203
|
-
interface ToolCallRequest {
|
|
204
|
-
/** Name of the tool being called */
|
|
205
|
-
name: string;
|
|
206
|
-
/** Parsed arguments object */
|
|
207
|
-
arguments: Record<string, unknown>;
|
|
208
|
-
/** Provider-assigned call ID for correlating results to calls (optional for backward compat) */
|
|
209
|
-
callId?: string;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Tool result to send back to the model
|
|
213
|
-
*/
|
|
214
|
-
interface ToolResult {
|
|
215
|
-
/** ID of the tool call this is responding to */
|
|
216
|
-
toolCallId: string;
|
|
217
|
-
/** Result content */
|
|
218
|
-
content: string;
|
|
219
|
-
/** Whether this result represents an error */
|
|
220
|
-
isError?: boolean;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Options for tool formatting operations
|
|
224
|
-
*/
|
|
225
|
-
interface ToolFormatOptions {
|
|
226
|
-
/** Image provider type for context-aware formatting */
|
|
227
|
-
imageProviderType?: string;
|
|
228
|
-
/** Additional custom options */
|
|
229
|
-
[key: string]: unknown;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Text Provider — Shape 1: Text -> Text
|
|
234
|
-
*
|
|
235
|
-
* Send instructions + data (with optional attachments) to an LLM,
|
|
236
|
-
* receive a text response. This is the fundamental text completion shape,
|
|
237
|
-
* covering both standard and "cheap" model calls.
|
|
238
|
-
*
|
|
239
|
-
* @module @quilltap/plugin-types/providers/text
|
|
240
|
-
*/
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Message in a conversation
|
|
244
|
-
*/
|
|
245
|
-
interface LLMMessage {
|
|
246
|
-
/** Role of the message sender */
|
|
247
|
-
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
248
|
-
/** Message content */
|
|
249
|
-
content: string;
|
|
250
|
-
/** Optional name for multi-character chats */
|
|
251
|
-
name?: string;
|
|
252
|
-
/** File attachments for this message */
|
|
253
|
-
attachments?: FileAttachment[];
|
|
254
|
-
/** Tool call ID (for tool role messages) */
|
|
255
|
-
toolCallId?: string;
|
|
256
|
-
/** Tool calls made by assistant */
|
|
257
|
-
toolCalls?: ToolCall[];
|
|
258
|
-
/** Cache control for prompt caching (Anthropic, Google) */
|
|
259
|
-
cacheControl?: {
|
|
260
|
-
type: 'ephemeral';
|
|
261
|
-
};
|
|
262
|
-
/** Google Gemini thought signature for thinking models */
|
|
263
|
-
thoughtSignature?: string;
|
|
264
|
-
/**
|
|
265
|
-
* Reasoning / chain-of-thought content from thinking-mode providers
|
|
266
|
-
* (e.g. DeepSeek V4 Pro `reasoning_content`). Must be passed back on
|
|
267
|
-
* assistant turns that carry `toolCalls` or DeepSeek's API returns 400.
|
|
268
|
-
* Providers that don't expose a separate reasoning channel ignore this.
|
|
269
|
-
*/
|
|
270
|
-
reasoningContent?: string;
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* JSON Schema definition for structured outputs
|
|
274
|
-
*/
|
|
275
|
-
interface JSONSchemaDefinition {
|
|
276
|
-
/** Name of the schema */
|
|
277
|
-
name: string;
|
|
278
|
-
/** Whether to use strict mode */
|
|
279
|
-
strict?: boolean;
|
|
280
|
-
/** The JSON schema object */
|
|
281
|
-
schema: Record<string, unknown>;
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* Response format for structured outputs
|
|
285
|
-
*/
|
|
286
|
-
interface ResponseFormat {
|
|
287
|
-
/** Output type */
|
|
288
|
-
type: 'text' | 'json_object' | 'json_schema';
|
|
289
|
-
/** JSON schema definition (when type is 'json_schema') */
|
|
290
|
-
jsonSchema?: JSONSchemaDefinition;
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Parameters for text completion requests
|
|
294
|
-
*/
|
|
295
|
-
interface LLMParams {
|
|
296
|
-
/** Array of messages in the conversation */
|
|
297
|
-
messages: LLMMessage[];
|
|
298
|
-
/** Model identifier */
|
|
299
|
-
model: string;
|
|
300
|
-
/** Sampling temperature (0-2) */
|
|
301
|
-
temperature?: number;
|
|
302
|
-
/** Maximum tokens to generate */
|
|
303
|
-
maxTokens?: number;
|
|
304
|
-
/**
|
|
305
|
-
* When true, the provider MUST respect the exact maxTokens value without
|
|
306
|
-
* applying model-specific overrides (e.g. reasoning model minimums).
|
|
307
|
-
* Used by background tasks (cheap LLM) that need strict output limits.
|
|
308
|
-
*/
|
|
309
|
-
strictMaxTokens?: boolean;
|
|
310
|
-
/** Nucleus sampling parameter */
|
|
311
|
-
topP?: number;
|
|
312
|
-
/** Stop sequences */
|
|
313
|
-
stop?: string | string[];
|
|
314
|
-
/** Tool definitions (provider-specific format) */
|
|
315
|
-
tools?: unknown[];
|
|
316
|
-
/** Tool choice configuration */
|
|
317
|
-
toolChoice?: 'auto' | 'none' | 'required' | {
|
|
318
|
-
type: 'function';
|
|
319
|
-
function: {
|
|
320
|
-
name: string;
|
|
321
|
-
};
|
|
322
|
-
};
|
|
323
|
-
/** Response format for structured outputs */
|
|
324
|
-
responseFormat?: ResponseFormat;
|
|
325
|
-
/** Seed for deterministic generation */
|
|
326
|
-
seed?: number;
|
|
327
|
-
/** User identifier for tracking */
|
|
328
|
-
user?: string;
|
|
329
|
-
/** Enable native web search capability */
|
|
330
|
-
webSearchEnabled?: boolean;
|
|
331
|
-
/** Provider-specific parameters from profile */
|
|
332
|
-
profileParameters?: Record<string, unknown>;
|
|
333
|
-
/** Previous response ID for conversation chaining (OpenAI Responses API) */
|
|
334
|
-
previousResponseId?: string;
|
|
335
|
-
/**
|
|
336
|
-
* Per-character cache identifier. Quilltap builds this from the
|
|
337
|
-
* speaking character's ID so the stable persona block (manifesto /
|
|
338
|
-
* description / personality) becomes the actual cache prefix. Each
|
|
339
|
-
* provider decides how to apply it:
|
|
340
|
-
* - OpenAI / Grok use it as `prompt_cache_key` (sticky routing hint).
|
|
341
|
-
* - DeepSeek uses it as `user_id` (KV-cache isolation namespace).
|
|
342
|
-
* - OpenAI-compatible / Z.AI / OpenRouter forward it as `user`.
|
|
343
|
-
* - Anthropic ignores it (content-hashed `cache_control` breakpoints).
|
|
344
|
-
* - Ollama / Curl ignore it.
|
|
345
|
-
* Undefined when no character is active (e.g. user-only chats, titling).
|
|
346
|
-
*/
|
|
347
|
-
cacheKey?: string;
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Response from a text completion
|
|
351
|
-
*/
|
|
352
|
-
interface LLMResponse {
|
|
353
|
-
/** Generated content */
|
|
354
|
-
content: string;
|
|
355
|
-
/** Reason generation stopped */
|
|
356
|
-
finishReason: string | null;
|
|
357
|
-
/** Token usage statistics */
|
|
358
|
-
usage: TokenUsage;
|
|
359
|
-
/** Provider-specific raw response */
|
|
360
|
-
raw?: unknown;
|
|
361
|
-
/** Tool calls made by the model */
|
|
362
|
-
toolCalls?: ToolCall[];
|
|
363
|
-
/** Results of attachment processing */
|
|
364
|
-
attachmentResults?: AttachmentResults;
|
|
365
|
-
/** Google Gemini thought signature */
|
|
366
|
-
thoughtSignature?: string;
|
|
367
|
-
/** Reasoning / chain-of-thought content (DeepSeek thinking mode, etc.) */
|
|
368
|
-
reasoningContent?: string;
|
|
369
|
-
/** Cache usage statistics */
|
|
370
|
-
cacheUsage?: CacheUsage;
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Streaming chunk from a text completion
|
|
374
|
-
*/
|
|
375
|
-
interface StreamChunk {
|
|
376
|
-
/** Content in this chunk */
|
|
377
|
-
content: string;
|
|
378
|
-
/** Whether this is the final chunk */
|
|
379
|
-
done: boolean;
|
|
380
|
-
/** Token usage (typically on final chunk) */
|
|
381
|
-
usage?: TokenUsage;
|
|
382
|
-
/** Tool calls (typically on final chunk) */
|
|
383
|
-
toolCalls?: ToolCall[];
|
|
384
|
-
/** Attachment results (typically on final chunk) */
|
|
385
|
-
attachmentResults?: AttachmentResults;
|
|
386
|
-
/** Raw response for tool call detection */
|
|
387
|
-
rawResponse?: unknown;
|
|
388
|
-
/** Google Gemini thought signature */
|
|
389
|
-
thoughtSignature?: string;
|
|
390
|
-
/** Reasoning / chain-of-thought content, typically on final chunk */
|
|
391
|
-
reasoningContent?: string;
|
|
392
|
-
/** Cache usage statistics (normalized) */
|
|
393
|
-
cacheUsage?: CacheUsage;
|
|
394
|
-
/**
|
|
395
|
-
* Provider-shape `usage` sub-object, captured pre-normalization for
|
|
396
|
-
* cache-instrumentation diagnostics. Each provider's shape differs
|
|
397
|
-
* (OpenAI/Grok/Z.AI: `prompt_tokens_details.cached_tokens`; Anthropic:
|
|
398
|
-
* `cache_read_input_tokens`; Google: `cachedContentTokenCount`).
|
|
399
|
-
* Lets the logger compare provider-reported cache hits against the
|
|
400
|
-
* normalized `cacheUsage` and catch field-mapping regressions.
|
|
401
|
-
*/
|
|
402
|
-
rawProviderUsage?: Record<string, unknown> | null;
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* Text completion provider interface — Shape 1: Text -> Text
|
|
406
|
-
*
|
|
407
|
-
* Sends instructions and data to an LLM and receives text responses,
|
|
408
|
-
* either as a complete response or as a stream of chunks.
|
|
409
|
-
*
|
|
410
|
-
* This covers both standard and "cheap" model calls — the difference
|
|
411
|
-
* is in model selection and parameters, not the interface shape.
|
|
412
|
-
*/
|
|
413
|
-
interface TextProvider {
|
|
414
|
-
/** Whether this provider supports file attachments */
|
|
415
|
-
readonly supportsFileAttachments: boolean;
|
|
416
|
-
/** Supported MIME types for file attachments */
|
|
417
|
-
readonly supportedMimeTypes: string[];
|
|
418
|
-
/** Whether this provider supports web search */
|
|
419
|
-
readonly supportsWebSearch: boolean;
|
|
420
|
-
/**
|
|
421
|
-
* Send a message and get a complete response
|
|
422
|
-
*/
|
|
423
|
-
sendMessage(params: LLMParams, apiKey: string): Promise<LLMResponse>;
|
|
424
|
-
/**
|
|
425
|
-
* Send a message and stream the response
|
|
426
|
-
*/
|
|
427
|
-
streamMessage(params: LLMParams, apiKey: string): AsyncGenerator<StreamChunk>;
|
|
428
|
-
/**
|
|
429
|
-
* Validate an API key
|
|
430
|
-
*/
|
|
431
|
-
validateApiKey(apiKey: string): Promise<boolean>;
|
|
432
|
-
/**
|
|
433
|
-
* Get available models from the provider
|
|
434
|
-
*/
|
|
435
|
-
getAvailableModels(apiKey: string): Promise<string[]>;
|
|
436
|
-
/**
|
|
437
|
-
* Get metadata for a specific model (optional)
|
|
438
|
-
*/
|
|
439
|
-
getModelMetadata?(modelId: string): ModelMetadata | undefined;
|
|
440
|
-
/**
|
|
441
|
-
* Get metadata for all models with warnings (optional)
|
|
442
|
-
*/
|
|
443
|
-
getModelsWithMetadata?(apiKey: string): Promise<ModelMetadata[]>;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* Image Provider — Shape 2: Text -> Image
|
|
448
|
-
*
|
|
449
|
-
* Send instructions (a prompt) to an image generation model,
|
|
450
|
-
* receive one or more generated images.
|
|
451
|
-
*
|
|
452
|
-
* @module @quilltap/plugin-types/providers/image
|
|
453
|
-
*/
|
|
454
|
-
/**
|
|
455
|
-
* Image generation parameters
|
|
456
|
-
*/
|
|
457
|
-
interface ImageGenParams {
|
|
458
|
-
/** Image generation prompt */
|
|
459
|
-
prompt: string;
|
|
460
|
-
/** Negative prompt (what to avoid) */
|
|
461
|
-
negativePrompt?: string;
|
|
462
|
-
/** Model identifier */
|
|
463
|
-
model?: string;
|
|
464
|
-
/** Image size (e.g., '1024x1024') */
|
|
465
|
-
size?: string;
|
|
466
|
-
/** Aspect ratio (e.g., '16:9') */
|
|
467
|
-
aspectRatio?: string;
|
|
468
|
-
/** Image quality */
|
|
469
|
-
quality?: 'standard' | 'hd';
|
|
470
|
-
/** Image style */
|
|
471
|
-
style?: 'vivid' | 'natural';
|
|
472
|
-
/** Number of images to generate */
|
|
473
|
-
n?: number;
|
|
474
|
-
/** Response format */
|
|
475
|
-
responseFormat?: 'url' | 'b64_json';
|
|
476
|
-
/** Seed for reproducibility */
|
|
477
|
-
seed?: number;
|
|
478
|
-
/** Guidance scale for diffusion models */
|
|
479
|
-
guidanceScale?: number;
|
|
480
|
-
/** Inference steps for diffusion models */
|
|
481
|
-
steps?: number;
|
|
482
|
-
}
|
|
483
|
-
/**
|
|
484
|
-
* Generated image result
|
|
485
|
-
*/
|
|
486
|
-
interface GeneratedImage {
|
|
487
|
-
/** Base64 encoded image data */
|
|
488
|
-
data?: string;
|
|
489
|
-
/** URL to the generated image */
|
|
490
|
-
url?: string;
|
|
491
|
-
/** Deprecated: use 'data' instead */
|
|
492
|
-
b64Json?: string;
|
|
493
|
-
/** Image MIME type */
|
|
494
|
-
mimeType?: string;
|
|
495
|
-
/** Revised prompt (some providers modify the prompt) */
|
|
496
|
-
revisedPrompt?: string;
|
|
497
|
-
/** Seed used for generation */
|
|
498
|
-
seed?: number;
|
|
499
|
-
}
|
|
500
|
-
/**
|
|
501
|
-
* Image generation response
|
|
502
|
-
*/
|
|
503
|
-
interface ImageGenResponse {
|
|
504
|
-
/** Array of generated images */
|
|
505
|
-
images: GeneratedImage[];
|
|
506
|
-
/** Provider-specific raw response */
|
|
507
|
-
raw?: unknown;
|
|
508
|
-
}
|
|
509
|
-
/**
|
|
510
|
-
* Image generation provider interface — Shape 2: Text -> Image
|
|
511
|
-
*
|
|
512
|
-
* Sends a text prompt to an image generation model and receives
|
|
513
|
-
* one or more generated images.
|
|
514
|
-
*/
|
|
515
|
-
interface ImageProvider {
|
|
516
|
-
/** Provider identifier */
|
|
517
|
-
readonly provider: string;
|
|
518
|
-
/** Models supported by this provider */
|
|
519
|
-
readonly supportedModels: string[];
|
|
520
|
-
/**
|
|
521
|
-
* Generate an image from a text prompt
|
|
522
|
-
*/
|
|
523
|
-
generateImage(params: ImageGenParams, apiKey: string): Promise<ImageGenResponse>;
|
|
524
|
-
/**
|
|
525
|
-
* Validate an API key
|
|
526
|
-
*/
|
|
527
|
-
validateApiKey(apiKey: string): Promise<boolean>;
|
|
528
|
-
/**
|
|
529
|
-
* Get available models
|
|
530
|
-
*/
|
|
531
|
-
getAvailableModels(apiKey?: string): Promise<string[]>;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
/**
|
|
535
|
-
* Embedding Provider — Shape 3: Text -> Vector
|
|
536
|
-
*
|
|
537
|
-
* Send text to an embedding model, receive a numeric vector representation.
|
|
538
|
-
* Used for semantic search, RAG, and similarity matching.
|
|
539
|
-
*
|
|
540
|
-
* @module @quilltap/plugin-types/providers/embedding
|
|
541
|
-
*/
|
|
542
|
-
/**
|
|
543
|
-
* Result of an embedding operation
|
|
544
|
-
*/
|
|
545
|
-
interface EmbeddingResult {
|
|
546
|
-
/** The embedding vector (array of floating point numbers) */
|
|
547
|
-
embedding: number[];
|
|
548
|
-
/** The model used to generate the embedding */
|
|
549
|
-
model: string;
|
|
550
|
-
/** Number of dimensions in the embedding vector */
|
|
551
|
-
dimensions: number;
|
|
552
|
-
/** Token usage information (if available) */
|
|
553
|
-
usage?: {
|
|
554
|
-
promptTokens: number;
|
|
555
|
-
totalTokens: number;
|
|
556
|
-
cost?: number;
|
|
557
|
-
};
|
|
558
|
-
}
|
|
559
|
-
/**
|
|
560
|
-
* Options for embedding generation
|
|
561
|
-
*/
|
|
562
|
-
interface EmbeddingOptions {
|
|
563
|
-
/** Desired dimensions for the embedding (if model supports variable dimensions) */
|
|
564
|
-
dimensions?: number;
|
|
565
|
-
}
|
|
566
|
-
/**
|
|
567
|
-
* Embedding provider interface — Shape 3: Text -> Vector
|
|
568
|
-
*
|
|
569
|
-
* Sends text to an embedding model and receives a numeric vector
|
|
570
|
-
* representation for use in semantic search, RAG, and similarity matching.
|
|
571
|
-
*/
|
|
572
|
-
interface EmbeddingProvider {
|
|
573
|
-
/**
|
|
574
|
-
* Generate an embedding for a single text
|
|
575
|
-
*
|
|
576
|
-
* @param text The text to embed
|
|
577
|
-
* @param model The model to use
|
|
578
|
-
* @param apiKey The API key for authentication
|
|
579
|
-
* @param options Optional configuration
|
|
580
|
-
* @returns The embedding result
|
|
581
|
-
*/
|
|
582
|
-
generateEmbedding(text: string, model: string, apiKey: string, options?: EmbeddingOptions): Promise<EmbeddingResult>;
|
|
583
|
-
/**
|
|
584
|
-
* Generate embeddings for multiple texts in a batch
|
|
585
|
-
*
|
|
586
|
-
* @param texts Array of texts to embed
|
|
587
|
-
* @param model The model to use
|
|
588
|
-
* @param apiKey The API key for authentication
|
|
589
|
-
* @param options Optional configuration
|
|
590
|
-
* @returns Array of embedding results
|
|
591
|
-
*/
|
|
592
|
-
generateBatchEmbeddings?(texts: string[], model: string, apiKey: string, options?: EmbeddingOptions): Promise<EmbeddingResult[]>;
|
|
593
|
-
/**
|
|
594
|
-
* Get available embedding models
|
|
595
|
-
*
|
|
596
|
-
* @param apiKey The API key for authentication
|
|
597
|
-
* @returns Array of model IDs
|
|
598
|
-
*/
|
|
599
|
-
getAvailableModels?(apiKey: string): Promise<string[]>;
|
|
600
|
-
/**
|
|
601
|
-
* Check if the provider is available and properly configured
|
|
602
|
-
*
|
|
603
|
-
* @param apiKey Optional API key to validate
|
|
604
|
-
* @returns True if the provider is ready to use
|
|
605
|
-
*/
|
|
606
|
-
isAvailable?(apiKey?: string): Promise<boolean>;
|
|
607
|
-
}
|
|
608
|
-
/**
|
|
609
|
-
* Serializable state for local embedding providers
|
|
610
|
-
*
|
|
611
|
-
* Used by providers like TF-IDF that maintain vocabulary state
|
|
612
|
-
*/
|
|
613
|
-
interface LocalEmbeddingProviderState {
|
|
614
|
-
/** The vocabulary as an array of [term, index] pairs */
|
|
615
|
-
vocabulary: [string, number][];
|
|
616
|
-
/** The IDF (Inverse Document Frequency) weights */
|
|
617
|
-
idf: number[];
|
|
618
|
-
/** Average document length across the corpus */
|
|
619
|
-
avgDocLength: number;
|
|
620
|
-
/** Size of the vocabulary */
|
|
621
|
-
vocabularySize: number;
|
|
622
|
-
/** Whether bigrams are included in the vocabulary */
|
|
623
|
-
includeBigrams: boolean;
|
|
624
|
-
/** Timestamp when the vocabulary was fitted */
|
|
625
|
-
fittedAt: string;
|
|
626
|
-
}
|
|
627
|
-
/**
|
|
628
|
-
* Local embedding provider interface
|
|
629
|
-
*
|
|
630
|
-
* Extended interface for local/offline embedding providers that
|
|
631
|
-
* maintain vocabulary state (like TF-IDF). These providers don't
|
|
632
|
-
* require API keys and can work entirely offline.
|
|
633
|
-
*/
|
|
634
|
-
interface LocalEmbeddingProvider extends Omit<EmbeddingProvider, 'generateEmbedding' | 'generateBatchEmbeddings'> {
|
|
635
|
-
/**
|
|
636
|
-
* Generate an embedding for a single text
|
|
637
|
-
* Local providers don't need apiKey parameter
|
|
638
|
-
*
|
|
639
|
-
* @param text The text to embed
|
|
640
|
-
* @returns The embedding result
|
|
641
|
-
*/
|
|
642
|
-
generateEmbedding(text: string): EmbeddingResult;
|
|
643
|
-
/**
|
|
644
|
-
* Generate embeddings for multiple texts in a batch
|
|
645
|
-
*
|
|
646
|
-
* @param texts Array of texts to embed
|
|
647
|
-
* @returns Array of embedding results
|
|
648
|
-
*/
|
|
649
|
-
generateBatchEmbeddings(texts: string[]): EmbeddingResult[];
|
|
650
|
-
/**
|
|
651
|
-
* Fit the vocabulary on a corpus of documents
|
|
652
|
-
*
|
|
653
|
-
* This method analyzes the corpus to build vocabulary, calculate IDF weights,
|
|
654
|
-
* and other statistics needed for embedding generation.
|
|
655
|
-
*
|
|
656
|
-
* @param documents Array of text documents to analyze
|
|
657
|
-
*/
|
|
658
|
-
fitCorpus(documents: string[]): void;
|
|
659
|
-
/**
|
|
660
|
-
* Check if the vocabulary has been fitted
|
|
661
|
-
*
|
|
662
|
-
* @returns True if fitCorpus has been called with documents
|
|
663
|
-
*/
|
|
664
|
-
isFitted(): boolean;
|
|
665
|
-
/**
|
|
666
|
-
* Load state from a serialized representation
|
|
667
|
-
*
|
|
668
|
-
* @param state The serialized provider state
|
|
669
|
-
*/
|
|
670
|
-
loadState(state: LocalEmbeddingProviderState): void;
|
|
671
|
-
/**
|
|
672
|
-
* Get the current state for serialization
|
|
673
|
-
*
|
|
674
|
-
* @returns The provider state, or null if not fitted
|
|
675
|
-
*/
|
|
676
|
-
getState(): LocalEmbeddingProviderState | null;
|
|
677
|
-
/**
|
|
678
|
-
* Get the vocabulary size
|
|
679
|
-
*
|
|
680
|
-
* @returns Number of terms in the vocabulary
|
|
681
|
-
*/
|
|
682
|
-
getVocabularySize(): number;
|
|
683
|
-
/**
|
|
684
|
-
* Get the embedding dimensions
|
|
685
|
-
*
|
|
686
|
-
* @returns Number of dimensions in generated embeddings
|
|
687
|
-
*/
|
|
688
|
-
getDimensions(): number;
|
|
689
|
-
}
|
|
690
|
-
/**
|
|
691
|
-
* Type guard to check if a provider is a local embedding provider
|
|
692
|
-
*/
|
|
693
|
-
declare function isLocalEmbeddingProvider(provider: EmbeddingProvider | LocalEmbeddingProvider): provider is LocalEmbeddingProvider;
|
|
694
|
-
|
|
695
|
-
export { type AnthropicToolDefinition, type AttachmentResults, type CacheUsage, type EmbeddingOptions, type EmbeddingProvider, type EmbeddingResult, type FileAttachment, type GeneratedImage, type GoogleToolDefinition, type ImageGenParams, type ImageProvider as ImageGenProvider, type ImageGenResponse, type ImageProvider, type JSONSchemaDefinition, type LLMMessage, type LLMParams, type TextProvider as LLMProvider, type LLMResponse, type LocalEmbeddingProvider, type LocalEmbeddingProviderState, type ModelMetadata, type ModelWarning, type ModelWarningLevel, type OpenAIToolDefinition, type ResponseFormat, type StreamChunk, type TextProvider, type TokenUsage, type ToolCall, type ToolCallRequest, type ToolFormatOptions, type ToolResult, type UniversalTool, isLocalEmbeddingProvider };
|
|
1
|
+
export { A as AnthropicToolDefinition, a as AttachmentResults, C as CacheUsage, E as EmbeddingOptions, b as EmbeddingProvider, c as EmbeddingResult, F as FileAttachment, G as GeneratedImage, d as GoogleToolDefinition, I as ImageGenParams, e as ImageGenProvider, f as ImageGenResponse, e as ImageProvider, J as JSONSchemaDefinition, L as LLMMessage, h as LLMParams, T as LLMProvider, i as LLMResponse, j as LocalEmbeddingProvider, k as LocalEmbeddingProviderState, M as ModelMetadata, l as ModelWarning, m as ModelWarningLevel, O as OpenAIToolDefinition, R as ResponseFormat, S as StreamChunk, T as TextProvider, n as TokenUsage, o as ToolCall, p as ToolCallRequest, q as ToolFormatOptions, r as ToolResult, U as UniversalTool, s as isLocalEmbeddingProvider } from '../index-B__Tj6zS.mjs';
|