@prenta/plugin-ai 2.0.0 → 3.0.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/CHANGELOG.md +30 -0
- package/README.md +16 -3
- package/dist/__tests__/index.test.js +30 -27
- package/dist/__tests__/index.test.js.map +1 -1
- package/dist/index.d.ts +9 -38
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -47
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/dist/__tests__/alt-text-prompt.test.d.ts +0 -2
- package/dist/__tests__/alt-text-prompt.test.d.ts.map +0 -1
- package/dist/__tests__/alt-text-prompt.test.js +0 -15
- package/dist/__tests__/alt-text-prompt.test.js.map +0 -1
- package/dist/__tests__/content-generator.test.d.ts +0 -2
- package/dist/__tests__/content-generator.test.d.ts.map +0 -1
- package/dist/__tests__/content-generator.test.js +0 -200
- package/dist/__tests__/content-generator.test.js.map +0 -1
- package/dist/__tests__/http.test.d.ts +0 -2
- package/dist/__tests__/http.test.d.ts.map +0 -1
- package/dist/__tests__/http.test.js +0 -44
- package/dist/__tests__/http.test.js.map +0 -1
- package/dist/__tests__/media-vision.test.d.ts +0 -2
- package/dist/__tests__/media-vision.test.d.ts.map +0 -1
- package/dist/__tests__/media-vision.test.js +0 -63
- package/dist/__tests__/media-vision.test.js.map +0 -1
- package/dist/__tests__/meta-generator.test.d.ts +0 -2
- package/dist/__tests__/meta-generator.test.d.ts.map +0 -1
- package/dist/__tests__/meta-generator.test.js +0 -28
- package/dist/__tests__/meta-generator.test.js.map +0 -1
- package/dist/__tests__/plugin-config.test.d.ts +0 -2
- package/dist/__tests__/plugin-config.test.d.ts.map +0 -1
- package/dist/__tests__/plugin-config.test.js +0 -65
- package/dist/__tests__/plugin-config.test.js.map +0 -1
- package/dist/__tests__/prompt.test.d.ts +0 -2
- package/dist/__tests__/prompt.test.d.ts.map +0 -1
- package/dist/__tests__/prompt.test.js +0 -28
- package/dist/__tests__/prompt.test.js.map +0 -1
- package/dist/media/alt-text-generator.d.ts +0 -27
- package/dist/media/alt-text-generator.d.ts.map +0 -1
- package/dist/media/alt-text-generator.js +0 -68
- package/dist/media/alt-text-generator.js.map +0 -1
- package/dist/media/alt-text-prompt.d.ts +0 -6
- package/dist/media/alt-text-prompt.d.ts.map +0 -1
- package/dist/media/alt-text-prompt.js +0 -32
- package/dist/media/alt-text-prompt.js.map +0 -1
- package/dist/media/json.d.ts +0 -4
- package/dist/media/json.d.ts.map +0 -1
- package/dist/media/json.js +0 -8
- package/dist/media/json.js.map +0 -1
- package/dist/prompt.d.ts +0 -30
- package/dist/prompt.d.ts.map +0 -1
- package/dist/prompt.js +0 -46
- package/dist/prompt.js.map +0 -1
- package/dist/providers/anthropic.d.ts +0 -8
- package/dist/providers/anthropic.d.ts.map +0 -1
- package/dist/providers/anthropic.js +0 -156
- package/dist/providers/anthropic.js.map +0 -1
- package/dist/providers/http.d.ts +0 -23
- package/dist/providers/http.d.ts.map +0 -1
- package/dist/providers/http.js +0 -40
- package/dist/providers/http.js.map +0 -1
- package/dist/providers/index.d.ts +0 -49
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.js +0 -34
- package/dist/providers/index.js.map +0 -1
- package/dist/providers/openai.d.ts +0 -7
- package/dist/providers/openai.d.ts.map +0 -1
- package/dist/providers/openai.js +0 -143
- package/dist/providers/openai.js.map +0 -1
- package/dist/search/embeddings.d.ts +0 -12
- package/dist/search/embeddings.d.ts.map +0 -1
- package/dist/search/embeddings.js +0 -35
- package/dist/search/embeddings.js.map +0 -1
- package/dist/search/semantic-search.d.ts +0 -31
- package/dist/search/semantic-search.d.ts.map +0 -1
- package/dist/search/semantic-search.js +0 -59
- package/dist/search/semantic-search.js.map +0 -1
- package/dist/writing/assistant.d.ts +0 -26
- package/dist/writing/assistant.d.ts.map +0 -1
- package/dist/writing/assistant.js +0 -114
- package/dist/writing/assistant.js.map +0 -1
- package/dist/writing/content-generator.d.ts +0 -104
- package/dist/writing/content-generator.d.ts.map +0 -1
- package/dist/writing/content-generator.js +0 -278
- package/dist/writing/content-generator.js.map +0 -1
- package/dist/writing/meta-generator.d.ts +0 -17
- package/dist/writing/meta-generator.d.ts.map +0 -1
- package/dist/writing/meta-generator.js +0 -55
- package/dist/writing/meta-generator.js.map +0 -1
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_AI_STREAM_TIMEOUT_MS, fetchWithTimeout, readErrorBody } from './http.js';
|
|
2
|
-
const DEFAULT_MODEL = 'claude-sonnet-4-20250514';
|
|
3
|
-
const API_BASE = 'https://api.anthropic.com/v1';
|
|
4
|
-
const API_VERSION = '2023-06-01';
|
|
5
|
-
/** Creates an Anthropic-backed AI provider. */
|
|
6
|
-
export function createAnthropicProvider(config) {
|
|
7
|
-
const model = config.model ?? DEFAULT_MODEL;
|
|
8
|
-
const headers = {
|
|
9
|
-
'x-api-key': config.apiKey,
|
|
10
|
-
'anthropic-version': API_VERSION,
|
|
11
|
-
'Content-Type': 'application/json',
|
|
12
|
-
};
|
|
13
|
-
return {
|
|
14
|
-
async generateText(prompt, options) {
|
|
15
|
-
const response = await fetchWithTimeout(`${API_BASE}/messages`, {
|
|
16
|
-
method: 'POST',
|
|
17
|
-
headers,
|
|
18
|
-
body: JSON.stringify({
|
|
19
|
-
model,
|
|
20
|
-
max_tokens: options?.maxTokens ?? 1024,
|
|
21
|
-
...(options?.temperature !== undefined ? { temperature: options.temperature } : {}),
|
|
22
|
-
...(options?.systemPrompt ? { system: options.systemPrompt } : {}),
|
|
23
|
-
messages: [{ role: 'user', content: prompt }],
|
|
24
|
-
}),
|
|
25
|
-
});
|
|
26
|
-
if (!response.ok) {
|
|
27
|
-
throw new Error(`Anthropic API error (${response.status}): ${await readErrorBody(response)}`);
|
|
28
|
-
}
|
|
29
|
-
const data = (await response.json());
|
|
30
|
-
const text = data.content
|
|
31
|
-
?.filter((b) => b.type === 'text')
|
|
32
|
-
.map((b) => b.text)
|
|
33
|
-
.join('') ?? '';
|
|
34
|
-
return {
|
|
35
|
-
text,
|
|
36
|
-
usage: {
|
|
37
|
-
promptTokens: data.usage?.input_tokens ?? 0,
|
|
38
|
-
completionTokens: data.usage?.output_tokens ?? 0,
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
},
|
|
42
|
-
async analyzeImage(image, prompt, options) {
|
|
43
|
-
const response = await fetchWithTimeout(`${API_BASE}/messages`, {
|
|
44
|
-
method: 'POST',
|
|
45
|
-
headers,
|
|
46
|
-
body: JSON.stringify({
|
|
47
|
-
model,
|
|
48
|
-
max_tokens: options?.maxTokens ?? 512,
|
|
49
|
-
...(options?.temperature !== undefined ? { temperature: options.temperature } : {}),
|
|
50
|
-
...(options?.systemPrompt ? { system: options.systemPrompt } : {}),
|
|
51
|
-
messages: [
|
|
52
|
-
{
|
|
53
|
-
role: 'user',
|
|
54
|
-
content: [
|
|
55
|
-
{
|
|
56
|
-
type: 'image',
|
|
57
|
-
source: { type: 'base64', media_type: image.mimeType, data: image.base64 },
|
|
58
|
-
},
|
|
59
|
-
{ type: 'text', text: prompt },
|
|
60
|
-
],
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
}),
|
|
64
|
-
});
|
|
65
|
-
if (!response.ok) {
|
|
66
|
-
throw new Error(`Anthropic vision error (${response.status}): ${await readErrorBody(response)}`);
|
|
67
|
-
}
|
|
68
|
-
const data = (await response.json());
|
|
69
|
-
const text = data.content
|
|
70
|
-
?.filter((b) => b.type === 'text')
|
|
71
|
-
.map((b) => b.text)
|
|
72
|
-
.join('') ?? '';
|
|
73
|
-
return {
|
|
74
|
-
text,
|
|
75
|
-
usage: {
|
|
76
|
-
promptTokens: data.usage?.input_tokens ?? 0,
|
|
77
|
-
completionTokens: data.usage?.output_tokens ?? 0,
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
},
|
|
81
|
-
async generateEmbedding(text) {
|
|
82
|
-
if (config.openaiApiKey) {
|
|
83
|
-
const response = await fetchWithTimeout('https://api.openai.com/v1/embeddings', {
|
|
84
|
-
method: 'POST',
|
|
85
|
-
headers: {
|
|
86
|
-
Authorization: `Bearer ${config.openaiApiKey}`,
|
|
87
|
-
'Content-Type': 'application/json',
|
|
88
|
-
},
|
|
89
|
-
body: JSON.stringify({
|
|
90
|
-
model: 'text-embedding-3-small',
|
|
91
|
-
input: text,
|
|
92
|
-
}),
|
|
93
|
-
});
|
|
94
|
-
if (!response.ok) {
|
|
95
|
-
throw new Error(`OpenAI embeddings error (${response.status}): ${await readErrorBody(response)}`);
|
|
96
|
-
}
|
|
97
|
-
const data = (await response.json());
|
|
98
|
-
return data.data[0]?.embedding ?? [];
|
|
99
|
-
}
|
|
100
|
-
throw new Error('Anthropic does not provide a native embeddings API. ' +
|
|
101
|
-
'Pass openaiApiKey in the Anthropic provider config to use OpenAI embeddings as a fallback, ' +
|
|
102
|
-
'or use the OpenAI provider directly for embedding tasks.');
|
|
103
|
-
},
|
|
104
|
-
async *streamText(prompt, options) {
|
|
105
|
-
const response = await fetchWithTimeout(`${API_BASE}/messages`, {
|
|
106
|
-
method: 'POST',
|
|
107
|
-
headers,
|
|
108
|
-
body: JSON.stringify({
|
|
109
|
-
model,
|
|
110
|
-
max_tokens: options?.maxTokens ?? 1024,
|
|
111
|
-
...(options?.temperature !== undefined ? { temperature: options.temperature } : {}),
|
|
112
|
-
...(options?.systemPrompt ? { system: options.systemPrompt } : {}),
|
|
113
|
-
stream: true,
|
|
114
|
-
messages: [{ role: 'user', content: prompt }],
|
|
115
|
-
}),
|
|
116
|
-
}, DEFAULT_AI_STREAM_TIMEOUT_MS);
|
|
117
|
-
if (!response.ok) {
|
|
118
|
-
throw new Error(`Anthropic stream error (${response.status}): ${await readErrorBody(response)}`);
|
|
119
|
-
}
|
|
120
|
-
const reader = response.body?.getReader();
|
|
121
|
-
if (!reader)
|
|
122
|
-
throw new Error('No response body for streaming');
|
|
123
|
-
const decoder = new TextDecoder();
|
|
124
|
-
let buffer = '';
|
|
125
|
-
try {
|
|
126
|
-
while (true) {
|
|
127
|
-
const { done, value } = await reader.read();
|
|
128
|
-
if (done)
|
|
129
|
-
break;
|
|
130
|
-
buffer += decoder.decode(value, { stream: true });
|
|
131
|
-
const lines = buffer.split('\n');
|
|
132
|
-
buffer = lines.pop() ?? '';
|
|
133
|
-
for (const line of lines) {
|
|
134
|
-
const trimmed = line.trim();
|
|
135
|
-
if (!trimmed.startsWith('data: '))
|
|
136
|
-
continue;
|
|
137
|
-
const payload = trimmed.slice(6);
|
|
138
|
-
try {
|
|
139
|
-
const event = JSON.parse(payload);
|
|
140
|
-
if (event.type === 'content_block_delta' && event.delta?.text) {
|
|
141
|
-
yield event.delta.text;
|
|
142
|
-
}
|
|
143
|
-
if (event.type === 'message_stop')
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
catch { }
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
finally {
|
|
151
|
-
reader.releaseLock();
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
//# sourceMappingURL=anthropic.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AASzF,MAAM,aAAa,GAAG,0BAA0B,CAAA;AAChD,MAAM,QAAQ,GAAG,8BAA8B,CAAA;AAC/C,MAAM,WAAW,GAAG,YAAY,CAAA;AAEhC,+CAA+C;AAC/C,MAAM,UAAU,uBAAuB,CAAC,MAIvC;IACC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,aAAa,CAAA;IAE3C,MAAM,OAAO,GAAG;QACd,WAAW,EAAE,MAAM,CAAC,MAAM;QAC1B,mBAAmB,EAAE,WAAW;QAChC,cAAc,EAAE,kBAAkB;KACnC,CAAA;IAED,OAA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AK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAA;oBAC3C,IAAI,IAAI;wBAAE,MAAK;oBAEf,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;oBACjD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;oBAChC,MAAM,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,CAAA;oBAE1B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;wBACzB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;wBAC3B,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC;4BAAE,SAAQ;wBAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;wBAEhC,IAAI,CAAC;4BACH,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAG/B,CAAA;4BAED,IAAI,KAAK,CAAC,IAAI,KAAK,qBAAqB,IAAI,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC;gCAC9D,MAAM,KAAK,CAAC,KAAK,CAAC,IAAI,CAAA;4BACxB,CAAC;4BAED,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc;gCAAE,OAAM;wBAC3C,CAAC;wBAAC,MAAM,CAAC,CAAA,CAAC;oBACZ,CAAC;gBACH,CAAC;YACH,CAAC;oBAAS,CAAC;gBACT,MAAM,CAAC,WAAW,EAAE,CAAA;YACtB,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/providers/http.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared HTTP utilities for AI providers.
|
|
3
|
-
*
|
|
4
|
-
* RELIABILITY: every provider call MUST be bounded by a timeout. Without one, a
|
|
5
|
-
* hung upstream connection holds the (often serverless) function open until the
|
|
6
|
-
* platform's hard limit, consuming the caller's rate-limit slot and stalling the
|
|
7
|
-
* request with no cancellation. `AbortSignal.timeout` (Node 18+/20+) aborts the
|
|
8
|
-
* fetch — including a stalled response-body read — when the budget elapses.
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Streaming responses legitimately run longer than a single completion, so they
|
|
12
|
-
* get a more generous cap. This still bounds a connection that hangs without
|
|
13
|
-
* ever sending `[DONE]`.
|
|
14
|
-
*/
|
|
15
|
-
export declare const DEFAULT_AI_STREAM_TIMEOUT_MS = 120000;
|
|
16
|
-
/** `fetch` with a hard timeout. Translates abort/timeout into a clear Error. */
|
|
17
|
-
export declare function fetchWithTimeout(url: string, init: RequestInit, timeoutMs?: number): Promise<Response>;
|
|
18
|
-
/**
|
|
19
|
-
* Read an error response body, truncated to {@link MAX_ERROR_BODY_CHARS} so a
|
|
20
|
-
* verbose or hostile upstream payload can't bloat error messages or logs.
|
|
21
|
-
*/
|
|
22
|
-
export declare function readErrorBody(response: Response): Promise<string>;
|
|
23
|
-
//# sourceMappingURL=http.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/providers/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,SAAU,CAAA;AAKnD,gFAAgF;AAChF,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,WAAW,EACjB,SAAS,GAAE,MAA8B,GACxC,OAAO,CAAC,QAAQ,CAAC,CASnB;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAGvE"}
|
package/dist/providers/http.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared HTTP utilities for AI providers.
|
|
3
|
-
*
|
|
4
|
-
* RELIABILITY: every provider call MUST be bounded by a timeout. Without one, a
|
|
5
|
-
* hung upstream connection holds the (often serverless) function open until the
|
|
6
|
-
* platform's hard limit, consuming the caller's rate-limit slot and stalling the
|
|
7
|
-
* request with no cancellation. `AbortSignal.timeout` (Node 18+/20+) aborts the
|
|
8
|
-
* fetch — including a stalled response-body read — when the budget elapses.
|
|
9
|
-
*/
|
|
10
|
-
/** Default per-request timeout for non-streaming provider calls (ms). */
|
|
11
|
-
const DEFAULT_AI_TIMEOUT_MS = 60_000;
|
|
12
|
-
/**
|
|
13
|
-
* Streaming responses legitimately run longer than a single completion, so they
|
|
14
|
-
* get a more generous cap. This still bounds a connection that hangs without
|
|
15
|
-
* ever sending `[DONE]`.
|
|
16
|
-
*/
|
|
17
|
-
export const DEFAULT_AI_STREAM_TIMEOUT_MS = 120_000;
|
|
18
|
-
/** Cap how much of an upstream error body we surface (keeps logs/messages bounded). */
|
|
19
|
-
const MAX_ERROR_BODY_CHARS = 500;
|
|
20
|
-
/** `fetch` with a hard timeout. Translates abort/timeout into a clear Error. */
|
|
21
|
-
export async function fetchWithTimeout(url, init, timeoutMs = DEFAULT_AI_TIMEOUT_MS) {
|
|
22
|
-
try {
|
|
23
|
-
return await fetch(url, { ...init, signal: AbortSignal.timeout(timeoutMs) });
|
|
24
|
-
}
|
|
25
|
-
catch (err) {
|
|
26
|
-
if (err instanceof DOMException && (err.name === 'TimeoutError' || err.name === 'AbortError')) {
|
|
27
|
-
throw new Error(`AI provider request timed out after ${timeoutMs}ms`);
|
|
28
|
-
}
|
|
29
|
-
throw err;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Read an error response body, truncated to {@link MAX_ERROR_BODY_CHARS} so a
|
|
34
|
-
* verbose or hostile upstream payload can't bloat error messages or logs.
|
|
35
|
-
*/
|
|
36
|
-
export async function readErrorBody(response) {
|
|
37
|
-
const text = await response.text().catch(() => 'Unknown error');
|
|
38
|
-
return text.length > MAX_ERROR_BODY_CHARS ? `${text.slice(0, MAX_ERROR_BODY_CHARS)}…` : text;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=http.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/providers/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,yEAAyE;AACzE,MAAM,qBAAqB,GAAG,MAAM,CAAA;AAEpC;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,OAAO,CAAA;AAEnD,uFAAuF;AACvF,MAAM,oBAAoB,GAAG,GAAG,CAAA;AAEhC,gFAAgF;AAChF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,GAAW,EACX,IAAiB,EACjB,YAAoB,qBAAqB;IAEzC,IAAI,CAAC;QACH,OAAO,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;IAC9E,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,YAAY,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,cAAc,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,CAAC,EAAE,CAAC;YAC9F,MAAM,IAAI,KAAK,CAAC,uCAAuC,SAAS,IAAI,CAAC,CAAA;QACvE,CAAC;QACD,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,QAAkB;IACpD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,CAAA;IAC/D,OAAO,IAAI,CAAC,MAAM,GAAG,oBAAoB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAA;AAC9F,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export interface GenerateOptions {
|
|
2
|
-
maxTokens?: number;
|
|
3
|
-
temperature?: number;
|
|
4
|
-
systemPrompt?: string;
|
|
5
|
-
}
|
|
6
|
-
export interface GenerateResult {
|
|
7
|
-
text: string;
|
|
8
|
-
usage: {
|
|
9
|
-
promptTokens: number;
|
|
10
|
-
completionTokens: number;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export interface StreamOptions extends GenerateOptions {
|
|
14
|
-
}
|
|
15
|
-
/** A raw image to analyze with a multimodal (vision) model. */
|
|
16
|
-
export interface ImageInput {
|
|
17
|
-
/** base64-encoded image bytes (no data-URL prefix). */
|
|
18
|
-
base64: string;
|
|
19
|
-
/** image MIME type, e.g. `image/png`. */
|
|
20
|
-
mimeType: string;
|
|
21
|
-
}
|
|
22
|
-
export interface AIProvider {
|
|
23
|
-
generateText(prompt: string, options?: GenerateOptions): Promise<GenerateResult>;
|
|
24
|
-
generateEmbedding(text: string): Promise<number[]>;
|
|
25
|
-
streamText(prompt: string, options?: StreamOptions): AsyncIterable<string>;
|
|
26
|
-
/**
|
|
27
|
-
* Optional multimodal capability: analyze actual image bytes with a vision
|
|
28
|
-
* model. Providers that don't support vision omit this; callers MUST feature-
|
|
29
|
-
* detect (`typeof provider.analyzeImage === 'function'`) and fall back to a
|
|
30
|
-
* text-only heuristic. Without this, "vision" features that pass only a URL
|
|
31
|
-
* string hallucinate their output.
|
|
32
|
-
*/
|
|
33
|
-
analyzeImage?(image: ImageInput, prompt: string, options?: GenerateOptions): Promise<GenerateResult>;
|
|
34
|
-
}
|
|
35
|
-
export interface AIProviderConfig {
|
|
36
|
-
provider: 'anthropic' | 'openai';
|
|
37
|
-
apiKey: string;
|
|
38
|
-
model?: string;
|
|
39
|
-
openaiApiKey?: string;
|
|
40
|
-
}
|
|
41
|
-
/** Creates an AI provider instance for the specified backend. */
|
|
42
|
-
export declare function createAIProvider(config: AIProviderConfig): AIProvider;
|
|
43
|
-
/** Set the global AI provider used by all plugin features. */
|
|
44
|
-
export declare function setAIProvider(provider: AIProvider): void;
|
|
45
|
-
/** Get the global AI provider. Returns null if not configured. */
|
|
46
|
-
export declare function getAIProvider(): AIProvider | null;
|
|
47
|
-
/** Get the global AI provider or throw if not configured. */
|
|
48
|
-
export declare function requireAIProvider(): AIProvider;
|
|
49
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAA;KAAE,CAAA;CAC1D;AAED,MAAM,WAAW,aAAc,SAAQ,eAAe;CAAG;AAEzD,+DAA+D;AAC/D,MAAM,WAAW,UAAU;IACzB,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAA;IACd,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;IAChF,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAClD,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,CAAA;IAC1E;;;;;;OAMG;IACH,YAAY,CAAC,CACX,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,cAAc,CAAC,CAAA;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,WAAW,GAAG,QAAQ,CAAA;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAID,iEAAiE;AACjE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU,CAarE;AAED,8DAA8D;AAC9D,wBAAgB,aAAa,CAAC,QAAQ,EAAE,UAAU,GAAG,IAAI,CAExD;AAED,kEAAkE;AAClE,wBAAgB,aAAa,IAAI,UAAU,GAAG,IAAI,CAEjD;AAED,6DAA6D;AAC7D,wBAAgB,iBAAiB,IAAI,UAAU,CAO9C"}
|
package/dist/providers/index.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { createAnthropicProvider } from './anthropic.js';
|
|
2
|
-
import { createOpenAIProvider } from './openai.js';
|
|
3
|
-
let _globalProvider = null;
|
|
4
|
-
/** Creates an AI provider instance for the specified backend. */
|
|
5
|
-
export function createAIProvider(config) {
|
|
6
|
-
switch (config.provider) {
|
|
7
|
-
case 'anthropic':
|
|
8
|
-
return createAnthropicProvider({
|
|
9
|
-
apiKey: config.apiKey,
|
|
10
|
-
model: config.model,
|
|
11
|
-
openaiApiKey: config.openaiApiKey,
|
|
12
|
-
});
|
|
13
|
-
case 'openai':
|
|
14
|
-
return createOpenAIProvider({ apiKey: config.apiKey, model: config.model });
|
|
15
|
-
default:
|
|
16
|
-
throw new Error(`Unsupported AI provider: ${config.provider}`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
/** Set the global AI provider used by all plugin features. */
|
|
20
|
-
export function setAIProvider(provider) {
|
|
21
|
-
_globalProvider = provider;
|
|
22
|
-
}
|
|
23
|
-
/** Get the global AI provider. Returns null if not configured. */
|
|
24
|
-
export function getAIProvider() {
|
|
25
|
-
return _globalProvider;
|
|
26
|
-
}
|
|
27
|
-
/** Get the global AI provider or throw if not configured. */
|
|
28
|
-
export function requireAIProvider() {
|
|
29
|
-
if (!_globalProvider) {
|
|
30
|
-
throw new Error('AI provider not configured. Call aiPlugin({ provider, apiKey }) before using AI features.');
|
|
31
|
-
}
|
|
32
|
-
return _globalProvider;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAgDlD,IAAI,eAAe,GAAsB,IAAI,CAAA;AAE7C,iEAAiE;AACjE,MAAM,UAAU,gBAAgB,CAAC,MAAwB;IACvD,QAAQ,MAAM,CAAC,QAAQ,EAAE,CAAC;QACxB,KAAK,WAAW;YACd,OAAO,uBAAuB,CAAC;gBAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,YAAY,EAAE,MAAM,CAAC,YAAY;aAClC,CAAC,CAAA;QACJ,KAAK,QAAQ;YACX,OAAO,oBAAoB,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAA;QAC7E;YACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAA;IAClE,CAAC;AACH,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,aAAa,CAAC,QAAoB;IAChD,eAAe,GAAG,QAAQ,CAAA;AAC5B,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,aAAa;IAC3B,OAAO,eAAe,CAAA;AACxB,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,iBAAiB;IAC/B,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,CAAA;IACH,CAAC;IACD,OAAO,eAAe,CAAA;AACxB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../src/providers/openai.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EAKX,MAAM,YAAY,CAAA;AAMnB,4CAA4C;AAC5C,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CA8K3F"}
|
package/dist/providers/openai.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_AI_STREAM_TIMEOUT_MS, fetchWithTimeout, readErrorBody } from './http.js';
|
|
2
|
-
const DEFAULT_MODEL = 'gpt-4o';
|
|
3
|
-
const EMBEDDING_MODEL = 'text-embedding-3-small';
|
|
4
|
-
const API_BASE = 'https://api.openai.com/v1';
|
|
5
|
-
/** Creates an OpenAI-backed AI provider. */
|
|
6
|
-
export function createOpenAIProvider(config) {
|
|
7
|
-
const model = config.model ?? DEFAULT_MODEL;
|
|
8
|
-
const headers = {
|
|
9
|
-
Authorization: `Bearer ${config.apiKey}`,
|
|
10
|
-
'Content-Type': 'application/json',
|
|
11
|
-
};
|
|
12
|
-
return {
|
|
13
|
-
async generateText(prompt, options) {
|
|
14
|
-
const response = await fetchWithTimeout(`${API_BASE}/chat/completions`, {
|
|
15
|
-
method: 'POST',
|
|
16
|
-
headers,
|
|
17
|
-
body: JSON.stringify({
|
|
18
|
-
model,
|
|
19
|
-
max_tokens: options?.maxTokens ?? 1024,
|
|
20
|
-
temperature: options?.temperature ?? 0.7,
|
|
21
|
-
messages: [
|
|
22
|
-
...(options?.systemPrompt ? [{ role: 'system', content: options.systemPrompt }] : []),
|
|
23
|
-
{ role: 'user', content: prompt },
|
|
24
|
-
],
|
|
25
|
-
}),
|
|
26
|
-
});
|
|
27
|
-
if (!response.ok) {
|
|
28
|
-
throw new Error(`OpenAI API error (${response.status}): ${await readErrorBody(response)}`);
|
|
29
|
-
}
|
|
30
|
-
const data = (await response.json());
|
|
31
|
-
return {
|
|
32
|
-
text: data.choices[0]?.message?.content ?? '',
|
|
33
|
-
usage: {
|
|
34
|
-
promptTokens: data.usage?.prompt_tokens ?? 0,
|
|
35
|
-
completionTokens: data.usage?.completion_tokens ?? 0,
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
},
|
|
39
|
-
async analyzeImage(image, prompt, options) {
|
|
40
|
-
const response = await fetchWithTimeout(`${API_BASE}/chat/completions`, {
|
|
41
|
-
method: 'POST',
|
|
42
|
-
headers,
|
|
43
|
-
body: JSON.stringify({
|
|
44
|
-
model,
|
|
45
|
-
max_tokens: options?.maxTokens ?? 512,
|
|
46
|
-
temperature: options?.temperature ?? 0.3,
|
|
47
|
-
messages: [
|
|
48
|
-
...(options?.systemPrompt ? [{ role: 'system', content: options.systemPrompt }] : []),
|
|
49
|
-
{
|
|
50
|
-
role: 'user',
|
|
51
|
-
content: [
|
|
52
|
-
{ type: 'text', text: prompt },
|
|
53
|
-
{
|
|
54
|
-
type: 'image_url',
|
|
55
|
-
image_url: { url: `data:${image.mimeType};base64,${image.base64}` },
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
}),
|
|
61
|
-
});
|
|
62
|
-
if (!response.ok) {
|
|
63
|
-
throw new Error(`OpenAI vision error (${response.status}): ${await readErrorBody(response)}`);
|
|
64
|
-
}
|
|
65
|
-
const data = (await response.json());
|
|
66
|
-
return {
|
|
67
|
-
text: data.choices[0]?.message?.content ?? '',
|
|
68
|
-
usage: {
|
|
69
|
-
promptTokens: data.usage?.prompt_tokens ?? 0,
|
|
70
|
-
completionTokens: data.usage?.completion_tokens ?? 0,
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
},
|
|
74
|
-
async generateEmbedding(text) {
|
|
75
|
-
const response = await fetchWithTimeout(`${API_BASE}/embeddings`, {
|
|
76
|
-
method: 'POST',
|
|
77
|
-
headers,
|
|
78
|
-
body: JSON.stringify({
|
|
79
|
-
model: EMBEDDING_MODEL,
|
|
80
|
-
input: text,
|
|
81
|
-
}),
|
|
82
|
-
});
|
|
83
|
-
if (!response.ok) {
|
|
84
|
-
throw new Error(`OpenAI embeddings error (${response.status}): ${await readErrorBody(response)}`);
|
|
85
|
-
}
|
|
86
|
-
const data = (await response.json());
|
|
87
|
-
return data.data[0]?.embedding ?? [];
|
|
88
|
-
},
|
|
89
|
-
async *streamText(prompt, options) {
|
|
90
|
-
const response = await fetchWithTimeout(`${API_BASE}/chat/completions`, {
|
|
91
|
-
method: 'POST',
|
|
92
|
-
headers,
|
|
93
|
-
body: JSON.stringify({
|
|
94
|
-
model,
|
|
95
|
-
max_tokens: options?.maxTokens ?? 1024,
|
|
96
|
-
temperature: options?.temperature ?? 0.7,
|
|
97
|
-
stream: true,
|
|
98
|
-
messages: [
|
|
99
|
-
...(options?.systemPrompt ? [{ role: 'system', content: options.systemPrompt }] : []),
|
|
100
|
-
{ role: 'user', content: prompt },
|
|
101
|
-
],
|
|
102
|
-
}),
|
|
103
|
-
}, DEFAULT_AI_STREAM_TIMEOUT_MS);
|
|
104
|
-
if (!response.ok) {
|
|
105
|
-
throw new Error(`OpenAI stream error (${response.status}): ${await readErrorBody(response)}`);
|
|
106
|
-
}
|
|
107
|
-
const reader = response.body?.getReader();
|
|
108
|
-
if (!reader)
|
|
109
|
-
throw new Error('No response body for streaming');
|
|
110
|
-
const decoder = new TextDecoder();
|
|
111
|
-
let buffer = '';
|
|
112
|
-
try {
|
|
113
|
-
while (true) {
|
|
114
|
-
const { done, value } = await reader.read();
|
|
115
|
-
if (done)
|
|
116
|
-
break;
|
|
117
|
-
buffer += decoder.decode(value, { stream: true });
|
|
118
|
-
const lines = buffer.split('\n');
|
|
119
|
-
buffer = lines.pop() ?? '';
|
|
120
|
-
for (const line of lines) {
|
|
121
|
-
const trimmed = line.trim();
|
|
122
|
-
if (!trimmed || !trimmed.startsWith('data: '))
|
|
123
|
-
continue;
|
|
124
|
-
const payload = trimmed.slice(6);
|
|
125
|
-
if (payload === '[DONE]')
|
|
126
|
-
return;
|
|
127
|
-
try {
|
|
128
|
-
const chunk = JSON.parse(payload);
|
|
129
|
-
const content = chunk.choices[0]?.delta?.content;
|
|
130
|
-
if (content)
|
|
131
|
-
yield content;
|
|
132
|
-
}
|
|
133
|
-
catch { }
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
finally {
|
|
138
|
-
reader.releaseLock();
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
//# sourceMappingURL=openai.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openai.js","sourceRoot":"","sources":["../../src/providers/openai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AASzF,MAAM,aAAa,GAAG,QAAQ,CAAA;AAC9B,MAAM,eAAe,GAAG,wBAAwB,CAAA;AAChD,MAAM,QAAQ,GAAG,2BAA2B,CAAA;AAE5C,4CAA4C;AAC5C,MAAM,UAAU,oBAAoB,CAAC,MAA0C;IAC7E,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,aAAa,CAAA;IAE3C,MAAM,OAAO,GAAG;QACd,aAAa,EAAE,UAAU,MAAM,CAAC,MAAM,EAAE;QACxC,cAAc,EAAE,kBAAkB;KACnC,CAAA;IAED,OAAO;QACL,KAAK,CAAC,YAAY,CAAC,MAAc,EAAE,OAAyB;YAC1D,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,GAA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5B,CAAC;wBAAC,MAAM,CAAC,CAAA,CAAC;oBACZ,CAAC;gBACH,CAAC;YACH,CAAC;oBAAS,CAAC;gBACT,MAAM,CAAC,WAAW,EAAE,CAAA;YACtB,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { AIProvider } from '../providers/index.js';
|
|
2
|
-
export interface EmbeddingResult {
|
|
3
|
-
vector: number[];
|
|
4
|
-
dimensions: number;
|
|
5
|
-
model: string;
|
|
6
|
-
tokenCount: number;
|
|
7
|
-
}
|
|
8
|
-
/** Generates a vector embedding for the given text. */
|
|
9
|
-
export declare function generateEmbedding(text: string, provider?: AIProvider): Promise<EmbeddingResult>;
|
|
10
|
-
/** Computes cosine similarity between two vectors, returning a value in [-1, 1]. */
|
|
11
|
-
export declare function cosineSimilarity(a: number[], b: number[]): number;
|
|
12
|
-
//# sourceMappingURL=embeddings.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"embeddings.d.ts","sourceRoot":"","sources":["../../src/search/embeddings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,uDAAuD;AACvD,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,UAAU,GACpB,OAAO,CAAC,eAAe,CAAC,CAc1B;AAED,oFAAoF;AACpF,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAoBjE"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/** Generates a vector embedding for the given text. */
|
|
2
|
-
export async function generateEmbedding(text, provider) {
|
|
3
|
-
if (!provider) {
|
|
4
|
-
throw new Error('Embedding generation requires an AI provider');
|
|
5
|
-
}
|
|
6
|
-
const vector = await provider.generateEmbedding(text);
|
|
7
|
-
const tokenCount = Math.ceil(text.split(/\s+/).length * 1.3);
|
|
8
|
-
return {
|
|
9
|
-
vector,
|
|
10
|
-
dimensions: vector.length,
|
|
11
|
-
model: 'provider-default',
|
|
12
|
-
tokenCount,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
/** Computes cosine similarity between two vectors, returning a value in [-1, 1]. */
|
|
16
|
-
export function cosineSimilarity(a, b) {
|
|
17
|
-
if (a.length !== b.length) {
|
|
18
|
-
throw new Error(`Vector dimension mismatch: ${a.length} vs ${b.length}`);
|
|
19
|
-
}
|
|
20
|
-
if (a.length === 0)
|
|
21
|
-
return 0;
|
|
22
|
-
let dotProduct = 0;
|
|
23
|
-
let magnitudeA = 0;
|
|
24
|
-
let magnitudeB = 0;
|
|
25
|
-
for (let i = 0; i < a.length; i++) {
|
|
26
|
-
dotProduct += a[i] * b[i];
|
|
27
|
-
magnitudeA += a[i] * a[i];
|
|
28
|
-
magnitudeB += b[i] * b[i];
|
|
29
|
-
}
|
|
30
|
-
const magnitude = Math.sqrt(magnitudeA) * Math.sqrt(magnitudeB);
|
|
31
|
-
if (magnitude === 0)
|
|
32
|
-
return 0;
|
|
33
|
-
return dotProduct / magnitude;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=embeddings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"embeddings.js","sourceRoot":"","sources":["../../src/search/embeddings.ts"],"names":[],"mappings":"AASA,uDAAuD;AACvD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAAY,EACZ,QAAqB;IAErB,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;IACjE,CAAC;IAED,MAAM,MAAM,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E7B,OAAO,UAAU,GAAG,SAAS,CAAA;AAC/B,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { AIProvider } from '../providers/index.js';
|
|
2
|
-
export interface SemanticSearchOptions {
|
|
3
|
-
limit?: number;
|
|
4
|
-
threshold?: number;
|
|
5
|
-
collections?: string[];
|
|
6
|
-
filters?: Record<string, unknown>;
|
|
7
|
-
provider?: AIProvider;
|
|
8
|
-
corpus?: Array<{
|
|
9
|
-
id: string;
|
|
10
|
-
collectionSlug: string;
|
|
11
|
-
title: string;
|
|
12
|
-
content: string;
|
|
13
|
-
embedding?: number[];
|
|
14
|
-
}>;
|
|
15
|
-
}
|
|
16
|
-
export interface SemanticSearchResult {
|
|
17
|
-
id: string;
|
|
18
|
-
collectionSlug: string;
|
|
19
|
-
title: string;
|
|
20
|
-
excerpt: string;
|
|
21
|
-
score: number;
|
|
22
|
-
highlights: string[];
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Performs semantic search across content using vector similarity.
|
|
26
|
-
*
|
|
27
|
-
* If `corpus` is provided with pre-computed embeddings, performs in-memory
|
|
28
|
-
* cosine similarity search. Otherwise, requires a vector database integration.
|
|
29
|
-
*/
|
|
30
|
-
export declare function semanticSearch(query: string, options?: SemanticSearchOptions): Promise<SemanticSearchResult[]>;
|
|
31
|
-
//# sourceMappingURL=semantic-search.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"semantic-search.d.ts","sourceRoot":"","sources":["../../src/search/semantic-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAKvD,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,QAAQ,CAAC,EAAE,UAAU,CAAA;IACrB,MAAM,CAAC,EAAE,KAAK,CAAC;QACb,EAAE,EAAE,MAAM,CAAA;QACV,cAAc,EAAE,MAAM,CAAA;QACtB,KAAK,EAAE,MAAM,CAAA;QACb,OAAO,EAAE,MAAM,CAAA;QACf,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;KACrB,CAAC,CAAA;CACH;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,cAAc,EAAE,MAAM,CAAA;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,EAAE,CAAA;CACrB;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,oBAAoB,EAAE,CAAC,CA6DjC"}
|