modelfusion 0.35.2 → 0.37.0
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/core/FunctionEvent.d.ts +3 -2
- package/core/getFunctionCallLogger.cjs +3 -2
- package/core/getFunctionCallLogger.js +3 -2
- package/package.json +2 -2
- package/retriever/RetrieveEvent.cjs +2 -0
- package/retriever/RetrieveEvent.d.ts +10 -0
- package/retriever/RetrieveEvent.js +1 -0
- package/retriever/retrieve.cjs +71 -3
- package/retriever/retrieve.js +71 -3
- package/vector-index/VectorIndex.d.ts +2 -1
- package/vector-index/VectorIndexRetriever.cjs +8 -1
- package/vector-index/VectorIndexRetriever.d.ts +13 -7
- package/vector-index/VectorIndexRetriever.js +8 -1
- package/vector-index/memory/MemoryVectorIndex.cjs +2 -1
- package/vector-index/memory/MemoryVectorIndex.d.ts +3 -2
- package/vector-index/memory/MemoryVectorIndex.js +2 -1
- package/vector-index/pinecone/PineconeVectorIndex.d.ts +1 -1
- package/vector-index/upsertIntoVectorIndex.d.ts +1 -1
package/core/FunctionEvent.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
import { ExecuteToolFinishedEvent, ExecuteToolStartedEvent } from "../tool/ExecuteToolEvent.js";
|
2
1
|
import { ModelCallFinishedEvent, ModelCallStartedEvent } from "../model-function/ModelCallEvent.js";
|
2
|
+
import { RetrieveFinishedEvent, RetrieveStartedEvent } from "../retriever/RetrieveEvent.js";
|
3
|
+
import { ExecuteToolFinishedEvent, ExecuteToolStartedEvent } from "../tool/ExecuteToolEvent.js";
|
3
4
|
export interface BaseFunctionEvent {
|
4
5
|
/**
|
5
6
|
* Unique identifier for the function call.
|
@@ -72,4 +73,4 @@ export interface BaseFunctionFinishedEvent extends BaseFunctionEvent {
|
|
72
73
|
*/
|
73
74
|
result: BaseFunctionFinishedEventResult;
|
74
75
|
}
|
75
|
-
export type FunctionEvent = ModelCallStartedEvent | ExecuteToolStartedEvent | ModelCallFinishedEvent | ExecuteToolFinishedEvent;
|
76
|
+
export type FunctionEvent = ModelCallStartedEvent | ExecuteToolStartedEvent | RetrieveStartedEvent | ModelCallFinishedEvent | ExecuteToolFinishedEvent | RetrieveFinishedEvent;
|
@@ -17,14 +17,15 @@ function getFunctionCallLogger(logging) {
|
|
17
17
|
exports.getFunctionCallLogger = getFunctionCallLogger;
|
18
18
|
const basicTextObserver = {
|
19
19
|
onFunctionEvent(event) {
|
20
|
+
const text = `[${event.timestamp.toISOString()}] ${event.callId}${event.functionId != null ? ` (${event.functionId})` : ""} - ${event.functionType} ${event.eventType}`;
|
20
21
|
// log based on event type:
|
21
22
|
switch (event.eventType) {
|
22
23
|
case "started": {
|
23
|
-
console.log(
|
24
|
+
console.log(text);
|
24
25
|
break;
|
25
26
|
}
|
26
27
|
case "finished": {
|
27
|
-
console.log(
|
28
|
+
console.log(`${text} in ${event.durationInMs}ms`);
|
28
29
|
break;
|
29
30
|
}
|
30
31
|
}
|
@@ -13,14 +13,15 @@ export function getFunctionCallLogger(logging) {
|
|
13
13
|
}
|
14
14
|
const basicTextObserver = {
|
15
15
|
onFunctionEvent(event) {
|
16
|
+
const text = `[${event.timestamp.toISOString()}] ${event.callId}${event.functionId != null ? ` (${event.functionId})` : ""} - ${event.functionType} ${event.eventType}`;
|
16
17
|
// log based on event type:
|
17
18
|
switch (event.eventType) {
|
18
19
|
case "started": {
|
19
|
-
console.log(
|
20
|
+
console.log(text);
|
20
21
|
break;
|
21
22
|
}
|
22
23
|
case "finished": {
|
23
|
-
console.log(
|
24
|
+
console.log(`${text} in ${event.durationInMs}ms`);
|
24
25
|
break;
|
25
26
|
}
|
26
27
|
}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "modelfusion",
|
3
3
|
"description": "Build multimodal applications, chatbots, and agents with JavaScript and TypeScript.",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.37.0",
|
5
5
|
"author": "Lars Grammel",
|
6
6
|
"license": "MIT",
|
7
7
|
"keywords": [
|
@@ -73,7 +73,7 @@
|
|
73
73
|
"husky": "^8.0.3",
|
74
74
|
"lint-staged": "14.0.1",
|
75
75
|
"prettier": "3.0.3",
|
76
|
-
"rimraf": "5.0.
|
76
|
+
"rimraf": "5.0.5",
|
77
77
|
"typescript": "5.2.2",
|
78
78
|
"vitest": "^0.34.5"
|
79
79
|
},
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { BaseFunctionFinishedEvent, BaseFunctionStartedEvent } from "../core/FunctionEvent.js";
|
2
|
+
export interface RetrieveStartedEvent extends BaseFunctionStartedEvent {
|
3
|
+
functionType: "retrieve";
|
4
|
+
query: unknown;
|
5
|
+
}
|
6
|
+
export interface RetrieveFinishedEvent extends BaseFunctionFinishedEvent {
|
7
|
+
functionType: "retrieve";
|
8
|
+
query: unknown;
|
9
|
+
results: unknown;
|
10
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/retriever/retrieve.cjs
CHANGED
@@ -1,9 +1,77 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.retrieve = void 0;
|
4
|
+
const nanoid_1 = require("nanoid");
|
5
|
+
const FunctionEventSource_js_1 = require("../core/FunctionEventSource.cjs");
|
6
|
+
const GlobalFunctionLogging_js_1 = require("../core/GlobalFunctionLogging.cjs");
|
7
|
+
const GlobalFunctionObservers_js_1 = require("../core/GlobalFunctionObservers.cjs");
|
8
|
+
const AbortError_js_1 = require("../core/api/AbortError.cjs");
|
9
|
+
const getFunctionCallLogger_js_1 = require("../core/getFunctionCallLogger.cjs");
|
10
|
+
const DurationMeasurement_js_1 = require("../util/DurationMeasurement.cjs");
|
11
|
+
const runSafe_js_1 = require("../util/runSafe.cjs");
|
4
12
|
async function retrieve(retriever, query, options) {
|
5
|
-
|
6
|
-
|
7
|
-
|
13
|
+
const run = options?.run;
|
14
|
+
const eventSource = new FunctionEventSource_js_1.FunctionEventSource({
|
15
|
+
observers: [
|
16
|
+
...(0, getFunctionCallLogger_js_1.getFunctionCallLogger)(options?.logging ?? (0, GlobalFunctionLogging_js_1.getGlobalFunctionLogging)()),
|
17
|
+
...(0, GlobalFunctionObservers_js_1.getGlobalFunctionObservers)(),
|
18
|
+
...(run?.functionObserver != null ? [run.functionObserver] : []),
|
19
|
+
...(options?.observers ?? []),
|
20
|
+
],
|
21
|
+
errorHandler: run?.errorHandler,
|
22
|
+
});
|
23
|
+
const durationMeasurement = (0, DurationMeasurement_js_1.startDurationMeasurement)();
|
24
|
+
const startMetadata = {
|
25
|
+
functionType: "retrieve",
|
26
|
+
callId: `call-${(0, nanoid_1.nanoid)()}`,
|
27
|
+
runId: run?.runId,
|
28
|
+
sessionId: run?.sessionId,
|
29
|
+
userId: run?.userId,
|
30
|
+
functionId: options?.functionId,
|
31
|
+
query,
|
32
|
+
timestamp: durationMeasurement.startDate,
|
33
|
+
startTimestamp: durationMeasurement.startDate,
|
34
|
+
};
|
35
|
+
eventSource.notify({
|
36
|
+
eventType: "started",
|
37
|
+
...startMetadata,
|
38
|
+
});
|
39
|
+
const result = await (0, runSafe_js_1.runSafe)(() => retriever.retrieve(query, options));
|
40
|
+
const finishMetadata = {
|
41
|
+
eventType: "finished",
|
42
|
+
...startMetadata,
|
43
|
+
finishTimestamp: new Date(),
|
44
|
+
durationInMs: durationMeasurement.durationInMs,
|
45
|
+
};
|
46
|
+
if (!result.ok) {
|
47
|
+
if (result.isAborted) {
|
48
|
+
eventSource.notify({
|
49
|
+
...finishMetadata,
|
50
|
+
eventType: "finished",
|
51
|
+
result: {
|
52
|
+
status: "abort",
|
53
|
+
},
|
54
|
+
});
|
55
|
+
throw new AbortError_js_1.AbortError();
|
56
|
+
}
|
57
|
+
eventSource.notify({
|
58
|
+
...finishMetadata,
|
59
|
+
eventType: "finished",
|
60
|
+
result: {
|
61
|
+
status: "error",
|
62
|
+
error: result.error,
|
63
|
+
},
|
64
|
+
});
|
65
|
+
throw result.error;
|
66
|
+
}
|
67
|
+
eventSource.notify({
|
68
|
+
...finishMetadata,
|
69
|
+
eventType: "finished",
|
70
|
+
result: {
|
71
|
+
status: "success",
|
72
|
+
output: result.output,
|
73
|
+
},
|
74
|
+
});
|
75
|
+
return result.output;
|
8
76
|
}
|
9
77
|
exports.retrieve = retrieve;
|
package/retriever/retrieve.js
CHANGED
@@ -1,5 +1,73 @@
|
|
1
|
+
import { nanoid as createId } from "nanoid";
|
2
|
+
import { FunctionEventSource } from "../core/FunctionEventSource.js";
|
3
|
+
import { getGlobalFunctionLogging } from "../core/GlobalFunctionLogging.js";
|
4
|
+
import { getGlobalFunctionObservers } from "../core/GlobalFunctionObservers.js";
|
5
|
+
import { AbortError } from "../core/api/AbortError.js";
|
6
|
+
import { getFunctionCallLogger } from "../core/getFunctionCallLogger.js";
|
7
|
+
import { startDurationMeasurement } from "../util/DurationMeasurement.js";
|
8
|
+
import { runSafe } from "../util/runSafe.js";
|
1
9
|
export async function retrieve(retriever, query, options) {
|
2
|
-
|
3
|
-
|
4
|
-
|
10
|
+
const run = options?.run;
|
11
|
+
const eventSource = new FunctionEventSource({
|
12
|
+
observers: [
|
13
|
+
...getFunctionCallLogger(options?.logging ?? getGlobalFunctionLogging()),
|
14
|
+
...getGlobalFunctionObservers(),
|
15
|
+
...(run?.functionObserver != null ? [run.functionObserver] : []),
|
16
|
+
...(options?.observers ?? []),
|
17
|
+
],
|
18
|
+
errorHandler: run?.errorHandler,
|
19
|
+
});
|
20
|
+
const durationMeasurement = startDurationMeasurement();
|
21
|
+
const startMetadata = {
|
22
|
+
functionType: "retrieve",
|
23
|
+
callId: `call-${createId()}`,
|
24
|
+
runId: run?.runId,
|
25
|
+
sessionId: run?.sessionId,
|
26
|
+
userId: run?.userId,
|
27
|
+
functionId: options?.functionId,
|
28
|
+
query,
|
29
|
+
timestamp: durationMeasurement.startDate,
|
30
|
+
startTimestamp: durationMeasurement.startDate,
|
31
|
+
};
|
32
|
+
eventSource.notify({
|
33
|
+
eventType: "started",
|
34
|
+
...startMetadata,
|
35
|
+
});
|
36
|
+
const result = await runSafe(() => retriever.retrieve(query, options));
|
37
|
+
const finishMetadata = {
|
38
|
+
eventType: "finished",
|
39
|
+
...startMetadata,
|
40
|
+
finishTimestamp: new Date(),
|
41
|
+
durationInMs: durationMeasurement.durationInMs,
|
42
|
+
};
|
43
|
+
if (!result.ok) {
|
44
|
+
if (result.isAborted) {
|
45
|
+
eventSource.notify({
|
46
|
+
...finishMetadata,
|
47
|
+
eventType: "finished",
|
48
|
+
result: {
|
49
|
+
status: "abort",
|
50
|
+
},
|
51
|
+
});
|
52
|
+
throw new AbortError();
|
53
|
+
}
|
54
|
+
eventSource.notify({
|
55
|
+
...finishMetadata,
|
56
|
+
eventType: "finished",
|
57
|
+
result: {
|
58
|
+
status: "error",
|
59
|
+
error: result.error,
|
60
|
+
},
|
61
|
+
});
|
62
|
+
throw result.error;
|
63
|
+
}
|
64
|
+
eventSource.notify({
|
65
|
+
...finishMetadata,
|
66
|
+
eventType: "finished",
|
67
|
+
result: {
|
68
|
+
status: "success",
|
69
|
+
output: result.output,
|
70
|
+
},
|
71
|
+
});
|
72
|
+
return result.output;
|
5
73
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Vector } from "../core/Vector.js";
|
2
|
-
export interface VectorIndex<DATA, INDEX> {
|
2
|
+
export interface VectorIndex<DATA, INDEX, FILTER> {
|
3
3
|
upsertMany(data: Array<{
|
4
4
|
id: string;
|
5
5
|
vector: Vector;
|
@@ -9,6 +9,7 @@ export interface VectorIndex<DATA, INDEX> {
|
|
9
9
|
queryVector: Vector;
|
10
10
|
maxResults: number;
|
11
11
|
similarityThreshold?: number;
|
12
|
+
filter?: FILTER;
|
12
13
|
}): Promise<Array<{
|
13
14
|
id: string;
|
14
15
|
data: DATA;
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VectorIndexRetriever = void 0;
|
4
4
|
const embedText_js_1 = require("../model-function/embed-text/embedText.cjs");
|
5
5
|
class VectorIndexRetriever {
|
6
|
-
constructor({ vectorIndex, embeddingModel, maxResults, similarityThreshold, }) {
|
6
|
+
constructor({ vectorIndex, embeddingModel, maxResults, similarityThreshold, filter, }) {
|
7
7
|
Object.defineProperty(this, "vectorIndex", {
|
8
8
|
enumerable: true,
|
9
9
|
configurable: true,
|
@@ -27,6 +27,7 @@ class VectorIndexRetriever {
|
|
27
27
|
this.settings = {
|
28
28
|
maxResults,
|
29
29
|
similarityThreshold,
|
30
|
+
filter,
|
30
31
|
};
|
31
32
|
}
|
32
33
|
async retrieve(query, options) {
|
@@ -37,6 +38,11 @@ class VectorIndexRetriever {
|
|
37
38
|
run: options.run,
|
38
39
|
});
|
39
40
|
}
|
41
|
+
let filter = this.settings?.filter;
|
42
|
+
if (typeof query === "object") {
|
43
|
+
filter = query.filter ?? filter; // use filter from query if available
|
44
|
+
query = query.text;
|
45
|
+
}
|
40
46
|
const embedding = await (0, embedText_js_1.embedText)(this.embeddingModel, query, {
|
41
47
|
functionId: options?.functionId,
|
42
48
|
run: options?.run,
|
@@ -45,6 +51,7 @@ class VectorIndexRetriever {
|
|
45
51
|
queryVector: embedding,
|
46
52
|
maxResults: this.settings.maxResults ?? 1,
|
47
53
|
similarityThreshold: this.settings.similarityThreshold,
|
54
|
+
filter,
|
48
55
|
});
|
49
56
|
return queryResult.map((item) => item.data);
|
50
57
|
}
|
@@ -2,18 +2,24 @@ import { ModelFunctionOptions } from "../model-function/ModelFunctionOptions.js"
|
|
2
2
|
import { TextEmbeddingModel, TextEmbeddingModelSettings } from "../model-function/embed-text/TextEmbeddingModel.js";
|
3
3
|
import { Retriever, RetrieverSettings } from "../retriever/Retriever.js";
|
4
4
|
import { VectorIndex } from "./VectorIndex.js";
|
5
|
-
export interface VectorIndexRetrieverSettings {
|
5
|
+
export interface VectorIndexRetrieverSettings<FILTER> {
|
6
6
|
maxResults?: number;
|
7
7
|
similarityThreshold?: number;
|
8
|
+
filter?: FILTER;
|
8
9
|
}
|
9
|
-
|
10
|
+
type VectorIndexRetrieverQuery<FILTER> = string | {
|
11
|
+
text: string;
|
12
|
+
filter?: FILTER;
|
13
|
+
};
|
14
|
+
export declare class VectorIndexRetriever<OBJECT, INDEX, FILTER> implements Retriever<OBJECT, VectorIndexRetrieverQuery<FILTER>, VectorIndexRetrieverSettings<FILTER>> {
|
10
15
|
private readonly vectorIndex;
|
11
16
|
private readonly embeddingModel;
|
12
17
|
private readonly settings;
|
13
|
-
constructor({ vectorIndex, embeddingModel, maxResults, similarityThreshold, }: {
|
14
|
-
vectorIndex: VectorIndex<OBJECT, INDEX>;
|
18
|
+
constructor({ vectorIndex, embeddingModel, maxResults, similarityThreshold, filter, }: {
|
19
|
+
vectorIndex: VectorIndex<OBJECT, INDEX, FILTER>;
|
15
20
|
embeddingModel: TextEmbeddingModel<unknown, TextEmbeddingModelSettings>;
|
16
|
-
} & VectorIndexRetrieverSettings);
|
17
|
-
retrieve(query:
|
18
|
-
withSettings(additionalSettings: Partial<VectorIndexRetrieverSettings
|
21
|
+
} & VectorIndexRetrieverSettings<FILTER>);
|
22
|
+
retrieve(query: VectorIndexRetrieverQuery<FILTER>, options?: ModelFunctionOptions<RetrieverSettings>): Promise<OBJECT[]>;
|
23
|
+
withSettings(additionalSettings: Partial<VectorIndexRetrieverSettings<FILTER>>): this;
|
19
24
|
}
|
25
|
+
export {};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { embedText } from "../model-function/embed-text/embedText.js";
|
2
2
|
export class VectorIndexRetriever {
|
3
|
-
constructor({ vectorIndex, embeddingModel, maxResults, similarityThreshold, }) {
|
3
|
+
constructor({ vectorIndex, embeddingModel, maxResults, similarityThreshold, filter, }) {
|
4
4
|
Object.defineProperty(this, "vectorIndex", {
|
5
5
|
enumerable: true,
|
6
6
|
configurable: true,
|
@@ -24,6 +24,7 @@ export class VectorIndexRetriever {
|
|
24
24
|
this.settings = {
|
25
25
|
maxResults,
|
26
26
|
similarityThreshold,
|
27
|
+
filter,
|
27
28
|
};
|
28
29
|
}
|
29
30
|
async retrieve(query, options) {
|
@@ -34,6 +35,11 @@ export class VectorIndexRetriever {
|
|
34
35
|
run: options.run,
|
35
36
|
});
|
36
37
|
}
|
38
|
+
let filter = this.settings?.filter;
|
39
|
+
if (typeof query === "object") {
|
40
|
+
filter = query.filter ?? filter; // use filter from query if available
|
41
|
+
query = query.text;
|
42
|
+
}
|
37
43
|
const embedding = await embedText(this.embeddingModel, query, {
|
38
44
|
functionId: options?.functionId,
|
39
45
|
run: options?.run,
|
@@ -42,6 +48,7 @@ export class VectorIndexRetriever {
|
|
42
48
|
queryVector: embedding,
|
43
49
|
maxResults: this.settings.maxResults ?? 1,
|
44
50
|
similarityThreshold: this.settings.similarityThreshold,
|
51
|
+
filter,
|
45
52
|
});
|
46
53
|
return queryResult.map((item) => item.data);
|
47
54
|
}
|
@@ -40,8 +40,9 @@ class MemoryVectorIndex {
|
|
40
40
|
this.entries.set(entry.id, entry);
|
41
41
|
}
|
42
42
|
}
|
43
|
-
async queryByVector({ queryVector, similarityThreshold, maxResults, }) {
|
43
|
+
async queryByVector({ queryVector, similarityThreshold, maxResults, filter, }) {
|
44
44
|
const results = [...this.entries.values()]
|
45
|
+
.filter((value) => filter?.(value.data) ?? true)
|
45
46
|
.map((entry) => ({
|
46
47
|
id: entry.id,
|
47
48
|
similarity: (0, cosineSimilarity_js_1.cosineSimilarity)(entry.vector, queryVector),
|
@@ -6,7 +6,7 @@ import { VectorIndex } from "../VectorIndex.js";
|
|
6
6
|
* a small number of entries and don't want to set up a real database, e.g. for conversational memory
|
7
7
|
* that does not need to be persisted.
|
8
8
|
*/
|
9
|
-
export declare class MemoryVectorIndex<DATA> implements VectorIndex<DATA, MemoryVectorIndex<DATA
|
9
|
+
export declare class MemoryVectorIndex<DATA> implements VectorIndex<DATA, MemoryVectorIndex<DATA>, (value: DATA) => boolean> {
|
10
10
|
static deserialize<DATA>({ serializedData, schema, }: {
|
11
11
|
serializedData: string;
|
12
12
|
schema?: z.ZodSchema<DATA>;
|
@@ -17,10 +17,11 @@ export declare class MemoryVectorIndex<DATA> implements VectorIndex<DATA, Memory
|
|
17
17
|
vector: Vector;
|
18
18
|
data: DATA;
|
19
19
|
}>): Promise<void>;
|
20
|
-
queryByVector({ queryVector, similarityThreshold, maxResults, }: {
|
20
|
+
queryByVector({ queryVector, similarityThreshold, maxResults, filter, }: {
|
21
21
|
queryVector: Vector;
|
22
22
|
maxResults: number;
|
23
23
|
similarityThreshold?: number;
|
24
|
+
filter?: (value: DATA) => boolean;
|
24
25
|
}): Promise<Array<{
|
25
26
|
id: string;
|
26
27
|
data: DATA;
|
@@ -34,8 +34,9 @@ export class MemoryVectorIndex {
|
|
34
34
|
this.entries.set(entry.id, entry);
|
35
35
|
}
|
36
36
|
}
|
37
|
-
async queryByVector({ queryVector, similarityThreshold, maxResults, }) {
|
37
|
+
async queryByVector({ queryVector, similarityThreshold, maxResults, filter, }) {
|
38
38
|
const results = [...this.entries.values()]
|
39
|
+
.filter((value) => filter?.(value.data) ?? true)
|
39
40
|
.map((entry) => ({
|
40
41
|
id: entry.id,
|
41
42
|
similarity: cosineSimilarity(entry.vector, queryVector),
|
@@ -2,7 +2,7 @@ import { VectorOperationsApi } from "@pinecone-database/pinecone/dist/pinecone-g
|
|
2
2
|
import { z } from "zod";
|
3
3
|
import { Vector } from "../../core/Vector.js";
|
4
4
|
import { VectorIndex } from "../VectorIndex.js";
|
5
|
-
export declare class PineconeVectorIndex<DATA extends object | undefined> implements VectorIndex<DATA, PineconeVectorIndex<DATA
|
5
|
+
export declare class PineconeVectorIndex<DATA extends object | undefined> implements VectorIndex<DATA, PineconeVectorIndex<DATA>, null> {
|
6
6
|
readonly index: VectorOperationsApi;
|
7
7
|
readonly namespace?: string;
|
8
8
|
readonly schema: z.ZodSchema<DATA>;
|
@@ -2,7 +2,7 @@ import { ModelFunctionOptions } from "../model-function/ModelFunctionOptions.js"
|
|
2
2
|
import { TextEmbeddingModel, TextEmbeddingModelSettings } from "../model-function/embed-text/TextEmbeddingModel.js";
|
3
3
|
import { VectorIndex } from "./VectorIndex.js";
|
4
4
|
export declare function upsertIntoVectorIndex<OBJECT, SETTINGS extends TextEmbeddingModelSettings>({ vectorIndex, embeddingModel, generateId, objects, getValueToEmbed, getId, }: {
|
5
|
-
vectorIndex: VectorIndex<OBJECT, unknown>;
|
5
|
+
vectorIndex: VectorIndex<OBJECT, unknown, unknown>;
|
6
6
|
embeddingModel: TextEmbeddingModel<unknown, SETTINGS>;
|
7
7
|
generateId?: () => string;
|
8
8
|
objects: OBJECT[];
|