@stacksjs/ai 0.70.86 → 0.70.88
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/package.json +1 -1
- package/dist/agents/claude/index.d.ts +0 -29
- package/dist/agents/index.d.ts +0 -6
- package/dist/buddy.d.ts +0 -67
- package/dist/drivers/anthropic/index.d.ts +0 -40
- package/dist/drivers/claude-agent-sdk/index.d.ts +0 -40
- package/dist/drivers/index.d.ts +0 -13
- package/dist/drivers/ollama/index.d.ts +0 -93
- package/dist/drivers/openai/index.d.ts +0 -66
- package/dist/image.d.ts +0 -83
- package/dist/index.d.ts +0 -39
- package/dist/index.js +0 -175
- package/dist/mcp.d.ts +0 -115
- package/dist/personalization.d.ts +0 -118
- package/dist/search.d.ts +0 -101
- package/dist/text.d.ts +0 -10
- package/dist/types.d.ts +0 -185
- package/dist/utils/client-bedrock-runtime.d.ts +0 -16
- package/dist/utils/client-bedrock.d.ts +0 -27
- package/dist/utils/model-access.d.ts +0 -1
- package/dist/utils/retry.d.ts +0 -38
- package/dist/utils/tokens.d.ts +0 -50
- package/dist/utils/usage.d.ts +0 -56
- package/dist/utils/vision.d.ts +0 -22
package/dist/text.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare function summarize(text: string, options?: SummarizeOptions): Promise<string>;
|
|
2
|
-
export declare function ask(question: string, options?: AskOptions): Promise<string>;
|
|
3
|
-
declare interface AiOptions {
|
|
4
|
-
maxTokenCount?: number
|
|
5
|
-
temperature?: number
|
|
6
|
-
topP?: number
|
|
7
|
-
modelId?: string
|
|
8
|
-
}
|
|
9
|
-
export declare interface SummarizeOptions extends AiOptions {}
|
|
10
|
-
export declare interface AskOptions extends AiOptions {}
|
package/dist/types.d.ts
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AI Module Types
|
|
3
|
-
*
|
|
4
|
-
* Shared type definitions for AI drivers and agents.
|
|
5
|
-
*/
|
|
6
|
-
export declare interface AIMessage {
|
|
7
|
-
role: 'user' | 'assistant' | 'system'
|
|
8
|
-
content: string | AIMessageContent[]
|
|
9
|
-
}
|
|
10
|
-
export declare interface AIMessageContent {
|
|
11
|
-
type: 'text' | 'image_url' | 'image'
|
|
12
|
-
text?: string
|
|
13
|
-
image_url?: { url: string, detail?: 'auto' | 'low' | 'high' }
|
|
14
|
-
source?: { type: 'base64', media_type: string, data: string }
|
|
15
|
-
}
|
|
16
|
-
export declare interface AIDriver {
|
|
17
|
-
name: string
|
|
18
|
-
process: (command: string, context: string, history: AIMessage[]) => Promise<string>
|
|
19
|
-
stream?: (command: string, context: string, history: AIMessage[]) => AsyncGenerator<string>
|
|
20
|
-
embed?: (input: string | string[]) => Promise<number[] | number[][]>
|
|
21
|
-
}
|
|
22
|
-
export declare interface AIDriverConfig {
|
|
23
|
-
apiKey?: string
|
|
24
|
-
baseUrl?: string
|
|
25
|
-
model?: string
|
|
26
|
-
maxTokens?: number
|
|
27
|
-
}
|
|
28
|
-
export declare interface StreamingResult {
|
|
29
|
-
stream: ReadableStream<Uint8Array>
|
|
30
|
-
fullResponse: Promise<string>
|
|
31
|
-
}
|
|
32
|
-
export declare interface EmbeddingResult {
|
|
33
|
-
embedding: number[]
|
|
34
|
-
index: number
|
|
35
|
-
object: string
|
|
36
|
-
}
|
|
37
|
-
export declare interface EmbeddingsResponse {
|
|
38
|
-
data: EmbeddingResult[]
|
|
39
|
-
model: string
|
|
40
|
-
usage: {
|
|
41
|
-
prompt_tokens: number
|
|
42
|
-
total_tokens: number
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Tool / function definition that the model can call back into.
|
|
47
|
-
* Cross-provider shape: OpenAI's `tools[]` and Anthropic's `tools[]`
|
|
48
|
-
* map to this same structure via the JSON Schema for parameters.
|
|
49
|
-
*/
|
|
50
|
-
export declare interface AITool {
|
|
51
|
-
name: string
|
|
52
|
-
description?: string
|
|
53
|
-
parameters?: Record<string, unknown>
|
|
54
|
-
}
|
|
55
|
-
export declare interface ChatCompletionOptions {
|
|
56
|
-
model?: string
|
|
57
|
-
maxTokens?: number
|
|
58
|
-
temperature?: number
|
|
59
|
-
topP?: number
|
|
60
|
-
stop?: string | string[]
|
|
61
|
-
stream?: boolean
|
|
62
|
-
tools?: AITool[]
|
|
63
|
-
toolChoice?: 'auto' | 'required' | 'none' | { name: string }
|
|
64
|
-
responseFormat?: AIResponseFormat
|
|
65
|
-
}
|
|
66
|
-
export declare interface AIResult {
|
|
67
|
-
content: string
|
|
68
|
-
model: string
|
|
69
|
-
usage?: {
|
|
70
|
-
promptTokens: number
|
|
71
|
-
completionTokens: number
|
|
72
|
-
totalTokens: number
|
|
73
|
-
}
|
|
74
|
-
finishReason?: string
|
|
75
|
-
}
|
|
76
|
-
export declare interface ClaudeAPIResponse {
|
|
77
|
-
content: Array<{ type: string, text: string }>
|
|
78
|
-
}
|
|
79
|
-
export declare interface OpenAIAPIResponse {
|
|
80
|
-
choices: Array<{ message: { content: string } }>
|
|
81
|
-
}
|
|
82
|
-
export declare interface OllamaAPIResponse {
|
|
83
|
-
message: { content: string }
|
|
84
|
-
}
|
|
85
|
-
export declare interface ClaudeStreamEvent {
|
|
86
|
-
type: string
|
|
87
|
-
subtype?: string
|
|
88
|
-
message?: {
|
|
89
|
-
content: Array<{
|
|
90
|
-
type: string
|
|
91
|
-
text?: string
|
|
92
|
-
name?: string
|
|
93
|
-
input?: Record<string, unknown>
|
|
94
|
-
}>
|
|
95
|
-
}
|
|
96
|
-
delta?: { text?: string }
|
|
97
|
-
result?: string
|
|
98
|
-
index?: number
|
|
99
|
-
content_block?: {
|
|
100
|
-
type: string
|
|
101
|
-
text?: string
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
// Buddy Types
|
|
105
|
-
export declare interface RepoState {
|
|
106
|
-
path: string
|
|
107
|
-
name: string
|
|
108
|
-
branch: string
|
|
109
|
-
hasChanges: boolean
|
|
110
|
-
lastCommit?: string
|
|
111
|
-
}
|
|
112
|
-
export declare interface GitHubCredentials {
|
|
113
|
-
token: string
|
|
114
|
-
username: string
|
|
115
|
-
name: string
|
|
116
|
-
email: string
|
|
117
|
-
}
|
|
118
|
-
export declare interface BuddyState {
|
|
119
|
-
repo: RepoState | null
|
|
120
|
-
conversationHistory: AIMessage[]
|
|
121
|
-
currentDriver: string
|
|
122
|
-
github: GitHubCredentials | null
|
|
123
|
-
}
|
|
124
|
-
export declare interface BuddyConfig {
|
|
125
|
-
workDir: string
|
|
126
|
-
commitMessage: string
|
|
127
|
-
ollamaHost: string
|
|
128
|
-
ollamaModel: string
|
|
129
|
-
}
|
|
130
|
-
export declare interface BuddyApiKeys {
|
|
131
|
-
anthropic?: string
|
|
132
|
-
openai?: string
|
|
133
|
-
claudeCliHost?: string
|
|
134
|
-
}
|
|
135
|
-
// Image types
|
|
136
|
-
export declare interface ImageGenerationConfig {
|
|
137
|
-
provider: 'openai'
|
|
138
|
-
model?: string
|
|
139
|
-
apiKey?: string
|
|
140
|
-
}
|
|
141
|
-
// Search/RAG types
|
|
142
|
-
export declare interface SearchConfig {
|
|
143
|
-
embeddingProvider: 'openai' | 'ollama'
|
|
144
|
-
embeddingModel?: string
|
|
145
|
-
generationProvider?: 'anthropic' | 'openai' | 'ollama'
|
|
146
|
-
generationModel?: string
|
|
147
|
-
}
|
|
148
|
-
// MCP types
|
|
149
|
-
export declare interface MCPConfig {
|
|
150
|
-
servers: Array<{
|
|
151
|
-
name: string
|
|
152
|
-
command?: string
|
|
153
|
-
args?: string[]
|
|
154
|
-
url?: string
|
|
155
|
-
env?: Record<string, string>
|
|
156
|
-
}>
|
|
157
|
-
}
|
|
158
|
-
// AI module config (used by @stacksjs/config)
|
|
159
|
-
export declare interface AIConfig {
|
|
160
|
-
default?: string
|
|
161
|
-
models?: string[]
|
|
162
|
-
drivers?: {
|
|
163
|
-
anthropic?: AIDriverConfig & { anthropicVersion?: string }
|
|
164
|
-
openai?: AIDriverConfig & { embeddingModel?: string }
|
|
165
|
-
ollama?: AIDriverConfig & { host?: string; embeddingModel?: string }
|
|
166
|
-
}
|
|
167
|
-
image?: ImageGenerationConfig
|
|
168
|
-
search?: SearchConfig
|
|
169
|
-
mcp?: MCPConfig
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Structured-output / JSON-mode response format. Modeled after
|
|
173
|
-
* OpenAI's `response_format` but the Anthropic driver maps it to
|
|
174
|
-
* the tools-as-json pattern internally (stacksjs/stacks#1878 A-1).
|
|
175
|
-
*/
|
|
176
|
-
export type AIResponseFormat = | { type: 'text' }
|
|
177
|
-
| { type: 'json_object' }
|
|
178
|
-
| {
|
|
179
|
-
type: 'json_schema'
|
|
180
|
-
json_schema: {
|
|
181
|
-
name: string
|
|
182
|
-
schema: Record<string, unknown>
|
|
183
|
-
strict?: boolean
|
|
184
|
-
}
|
|
185
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { InvokeModelCommandInput, InvokeModelCommandOutput, InvokeModelWithResponseStreamCommandInput, InvokeModelWithResponseStreamCommandOutput } from '@stacksjs/ts-cloud/aws';
|
|
2
|
-
export type { InvokeModelCommandInput, InvokeModelWithResponseStreamCommandInput };
|
|
3
|
-
/*
|
|
4
|
-
* Invoke Model
|
|
5
|
-
* @param {InvokeModelCommandInput} params
|
|
6
|
-
* @returns {Promise<InvokeModelCommandOutput>}
|
|
7
|
-
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/BedrockRuntime.html#invokeModel-property
|
|
8
|
-
*/
|
|
9
|
-
export declare function invokeModel(params: InvokeModelCommandInput): Promise<InvokeModelCommandOutput>;
|
|
10
|
-
/*
|
|
11
|
-
* Invoke Model With Response Stream
|
|
12
|
-
* @param {InvokeModelWithResponseStreamCommandInput} params
|
|
13
|
-
* @returns {Promise<InvokeModelWithResponseStreamCommandOutput>}
|
|
14
|
-
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/BedrockRuntime.html#invokeModelWithResponseStream-property
|
|
15
|
-
*/
|
|
16
|
-
export declare function invokeModelWithResponseStream(params: InvokeModelWithResponseStreamCommandInput): Promise<InvokeModelWithResponseStreamCommandOutput>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { CreateModelCustomizationJobCommandInput, CreateModelCustomizationJobCommandOutput, GetModelCustomizationJobCommandInput, GetModelCustomizationJobCommandOutput, ListFoundationModelsCommandInput, ListFoundationModelsCommandOutput } from '@stacksjs/ts-cloud/aws';
|
|
2
|
-
export type {
|
|
3
|
-
CreateModelCustomizationJobCommandInput,
|
|
4
|
-
GetModelCustomizationJobCommandInput,
|
|
5
|
-
ListFoundationModelsCommandInput,
|
|
6
|
-
};
|
|
7
|
-
/*
|
|
8
|
-
* Create Model Customization Job
|
|
9
|
-
* @param {CreateModelCustomizationJobCommandInput} params
|
|
10
|
-
* @returns {Promise<CreateModelCustomizationJobCommandOutput>}
|
|
11
|
-
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Bedrock.html#CreateModelCustomizationJob-property
|
|
12
|
-
*/
|
|
13
|
-
export declare function createModelCustomizationJob(param: CreateModelCustomizationJobCommandInput): Promise<CreateModelCustomizationJobCommandOutput>;
|
|
14
|
-
/*
|
|
15
|
-
* Get Model Customization Job
|
|
16
|
-
* @param {GetModelCustomizationJobCommandInput} params
|
|
17
|
-
* @returns {Promise<GetModelCustomizationJobCommandOutput>}
|
|
18
|
-
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Bedrock.html#getModelCustomizationJob-property
|
|
19
|
-
*/
|
|
20
|
-
export declare function getModelCustomizationJob(params: GetModelCustomizationJobCommandInput): Promise<GetModelCustomizationJobCommandOutput>;
|
|
21
|
-
/*
|
|
22
|
-
* List Foundation Models
|
|
23
|
-
* @param {ListFoundationModelsCommandInput} params
|
|
24
|
-
* @returns {Promise<ListFoundationModelsCommandOutput>}
|
|
25
|
-
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Bedrock.html#listFoundationModels-property
|
|
26
|
-
*/
|
|
27
|
-
export declare function listFoundationModels(params: ListFoundationModelsCommandInput): Promise<ListFoundationModelsCommandOutput>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function requestModelAccess(): Promise<void>;
|
package/dist/utils/retry.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetch with automatic retry on 429 / 5xx. Returns the final
|
|
3
|
-
* `Response` — the caller checks `.ok` and parses the body as usual.
|
|
4
|
-
*
|
|
5
|
-
* Does NOT retry network-level errors (connection reset, DNS
|
|
6
|
-
* failure) — those throw synchronously and the caller's existing
|
|
7
|
-
* try/catch handles them.
|
|
8
|
-
*/
|
|
9
|
-
export declare function fetchWithRetry(input: RequestInfo | URL, init?: RequestInit, config?: RetryConfig): Promise<Response>;
|
|
10
|
-
/**
|
|
11
|
-
* Retry helper for AI driver HTTP calls (stacksjs/stacks#1878 A-5).
|
|
12
|
-
*
|
|
13
|
-
* Background: OpenAI / Anthropic / etc. routinely return 429 (rate
|
|
14
|
-
* limit) and 5xx (capacity / overloaded) responses with a
|
|
15
|
-
* `Retry-After` header indicating when the caller should try again.
|
|
16
|
-
* The pre-fix AI drivers threw immediately on any non-2xx, surfacing
|
|
17
|
-
* transient capacity issues as hard user-facing failures.
|
|
18
|
-
*
|
|
19
|
-
* This helper wraps `fetch()` with:
|
|
20
|
-
* - Honor `Retry-After` (seconds or HTTP-date) for 429 + 503
|
|
21
|
-
* - Exponential backoff + jitter for other 5xx
|
|
22
|
-
* - Cap at `maxRetries` attempts (default 3)
|
|
23
|
-
* - Surface the final non-recoverable response to the caller
|
|
24
|
-
*
|
|
25
|
-
* No retry on 4xx other than 429 — those are caller bugs (bad API
|
|
26
|
-
* key, malformed request) that won't clear with more retries.
|
|
27
|
-
*/
|
|
28
|
-
/**
|
|
29
|
-
* Configurable retry policy. Defaults are tuned for the typical
|
|
30
|
-
* "Anthropic returned 429, try again in 3s" case without being so
|
|
31
|
-
* aggressive that a permanent outage hangs the request loop for
|
|
32
|
-
* minutes.
|
|
33
|
-
*/
|
|
34
|
-
export declare interface RetryConfig {
|
|
35
|
-
maxRetries?: number
|
|
36
|
-
baseDelayMs?: number
|
|
37
|
-
maxDelayMs?: number
|
|
38
|
-
}
|
package/dist/utils/tokens.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Estimate the number of tokens in `text` for the given model.
|
|
3
|
-
* Heuristic only — for exact counts, use the provider's tokenizer.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```ts
|
|
7
|
-
* if (estimateTokens(prompt, 'gpt-4o') > 100_000) {
|
|
8
|
-
* throw new Error('prompt too long; consider chunking')
|
|
9
|
-
* }
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
export declare function estimateTokens(text: string, model?: string): number;
|
|
13
|
-
/**
|
|
14
|
-
* Estimate total tokens for a chat-completion request: sum of
|
|
15
|
-
* every message's content plus a fixed per-message overhead
|
|
16
|
-
* (matches the rough "+4 per message + 2 for the conversation"
|
|
17
|
-
* heuristic OpenAI's docs publish).
|
|
18
|
-
*/
|
|
19
|
-
export declare function estimateMessageTokens(messages: Array<{ role: string, content: string | unknown }>, model?: string): number;
|
|
20
|
-
/**
|
|
21
|
-
* Inspect `text` for common prompt-injection patterns. Returns
|
|
22
|
-
* `{ ok, matched, cleaned }`. Apps decide what to do with the
|
|
23
|
-
* result — reject the request (`if (!result.ok) throw...`), pass
|
|
24
|
-
* the cleaned text on (`useText(result.cleaned)`), or just log
|
|
25
|
-
* for audit while letting the original through.
|
|
26
|
-
*
|
|
27
|
-
* **Limits:** this is heuristic. Adversarial inputs can paraphrase
|
|
28
|
-
* around any specific pattern. Use as a cheap first filter; for
|
|
29
|
-
* real defense, isolate the user input from the system prompt
|
|
30
|
-
* structurally (different roles, JSON-mode for the system layer)
|
|
31
|
-
* and guard the output side too.
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```ts
|
|
35
|
-
* const check = sanitizePrompt(userInput)
|
|
36
|
-
* if (!check.ok) {
|
|
37
|
-
* log.warn('possible injection attempt', { patterns: check.matched })
|
|
38
|
-
* // option A: reject
|
|
39
|
-
* throw new HttpError(400, 'invalid input')
|
|
40
|
-
* // option B: pass cleaned
|
|
41
|
-
* await chat([{ role: 'user', content: check.cleaned }])
|
|
42
|
-
* }
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
export declare function sanitizePrompt(text: string): SanitizeResult;
|
|
46
|
-
export declare interface SanitizeResult {
|
|
47
|
-
ok: boolean
|
|
48
|
-
matched: string[]
|
|
49
|
-
cleaned: string
|
|
50
|
-
}
|
package/dist/utils/usage.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Register a usage reporter. Returns an `unregister` callback for
|
|
3
|
-
* apps that want to swap reporters at runtime (test setup/teardown,
|
|
4
|
-
* tenant isolation, etc.).
|
|
5
|
-
*/
|
|
6
|
-
export declare function onUsage(reporter: UsageReporter): () => void;
|
|
7
|
-
/**
|
|
8
|
-
* Drop every registered reporter. Useful for tests.
|
|
9
|
-
*/
|
|
10
|
-
export declare function clearUsageReporters(): void;
|
|
11
|
-
/**
|
|
12
|
-
* Emit a usage record to every registered reporter. Called by
|
|
13
|
-
* driver completion paths after the response lands. Reporter
|
|
14
|
-
* errors are caught + logged so a misbehaving sink doesn't
|
|
15
|
-
* propagate up to the caller.
|
|
16
|
-
*/
|
|
17
|
-
export declare function recordUsage(record: UsageRecord): void;
|
|
18
|
-
/**
|
|
19
|
-
* Snapshot the currently-registered reporters. Useful for tests
|
|
20
|
-
* to assert behavior without exposing the internal array.
|
|
21
|
-
*/
|
|
22
|
-
export declare function listUsageReporters(): readonly UsageReporter[];
|
|
23
|
-
/**
|
|
24
|
-
* AI usage tracking (stacksjs/stacks#1878 A-6).
|
|
25
|
-
*
|
|
26
|
-
* Background: `AIResult.usage` returns token counts per-call but
|
|
27
|
-
* nothing aggregates them. Apps that want "this user has spent
|
|
28
|
-
* $X this month" build the aggregation themselves — wiring a
|
|
29
|
-
* listener on every model invocation, persisting the running
|
|
30
|
-
* total, etc.
|
|
31
|
-
*
|
|
32
|
-
* This module ships a singleton recorder that drivers emit to on
|
|
33
|
-
* each completion. Apps install one or more `UsageReporter`
|
|
34
|
-
* functions that get called with `{ provider, model, prompt_tokens,
|
|
35
|
-
* completion_tokens, timestamp, durationMs }` and decide what to
|
|
36
|
-
* do (store to DB, push to Datadog, etc.). Default behavior with
|
|
37
|
-
* no reporter is a no-op — the framework doesn't impose a sink.
|
|
38
|
-
*/
|
|
39
|
-
export declare interface UsageRecord {
|
|
40
|
-
provider: string
|
|
41
|
-
model: string
|
|
42
|
-
promptTokens: number
|
|
43
|
-
completionTokens: number
|
|
44
|
-
totalTokens: number
|
|
45
|
-
durationMs: number
|
|
46
|
-
timestamp: number
|
|
47
|
-
metadata?: Record<string, unknown>
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* A reporter is called once per recorded completion. Multiple
|
|
51
|
-
* reporters can be installed simultaneously; they fire in
|
|
52
|
-
* registration order. Reporters MUST NOT throw — errors are
|
|
53
|
-
* caught and logged but otherwise ignored so a flaky metrics
|
|
54
|
-
* sink doesn't break the user's completion call.
|
|
55
|
-
*/
|
|
56
|
-
export type UsageReporter = (record: UsageRecord) => void | Promise<void>;
|
package/dist/utils/vision.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { AIMessage, AIMessageContent } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Normalize an entire `messages` array for the requested provider.
|
|
4
|
-
* Messages whose `content` is a plain string pass through unchanged.
|
|
5
|
-
* Messages with a content array get each block translated.
|
|
6
|
-
*/
|
|
7
|
-
export declare function normalizeMessagesForProvider(messages: AIMessage[], provider: 'openai' | 'anthropic'): AIMessage[];
|
|
8
|
-
/**
|
|
9
|
-
* Convenience: convert a single command + optional image inputs into
|
|
10
|
-
* an `AIMessage` content array suitable for `chat()` calls. Used by
|
|
11
|
-
* the higher-level `text()` / `chat()` helpers when a user passes
|
|
12
|
-
* `{ command, images }` together.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* const content = buildMessageWithImages('What is in this image?', [
|
|
17
|
-
* { url: 'https://example.com/cat.jpg' },
|
|
18
|
-
* ])
|
|
19
|
-
* await chat([{ role: 'user', content }])
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export declare function buildMessageWithImages(command: string, images: Array<{ url?: string, dataBase64?: string, mediaType?: string, detail?: 'auto' | 'low' | 'high' }>): AIMessageContent[];
|