modelfusion 0.39.0 → 0.40.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/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.39.0",
4
+ "version": "0.40.0",
5
5
  "author": "Lars Grammel",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -61,7 +61,6 @@
61
61
  "zod-to-json-schema": "3.21.4"
62
62
  },
63
63
  "devDependencies": {
64
- "@pinecone-database/pinecone": "^0.1.6",
65
64
  "@tsconfig/recommended": "1.0.3",
66
65
  "@types/deep-equal": "^1.0.2",
67
66
  "@types/node": "18.11.9",
@@ -76,13 +75,5 @@
76
75
  "rimraf": "5.0.5",
77
76
  "typescript": "5.2.2",
78
77
  "vitest": "^0.34.5"
79
- },
80
- "peerDependencies": {
81
- "@pinecone-database/pinecone": "0.1.6"
82
- },
83
- "peerDependenciesMeta": {
84
- "@pinecone-database/pinecone": {
85
- "optional": true
86
- }
87
78
  }
88
79
  }
@@ -17,5 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./VectorIndex.cjs"), exports);
18
18
  __exportStar(require("./VectorIndexRetriever.cjs"), exports);
19
19
  __exportStar(require("./memory/MemoryVectorIndex.cjs"), exports);
20
- __exportStar(require("./pinecone/PineconeVectorIndex.cjs"), exports);
21
20
  __exportStar(require("./upsertIntoVectorIndex.cjs"), exports);
@@ -1,5 +1,4 @@
1
1
  export * from "./VectorIndex.js";
2
2
  export * from "./VectorIndexRetriever.js";
3
3
  export * from "./memory/MemoryVectorIndex.js";
4
- export * from "./pinecone/PineconeVectorIndex.js";
5
4
  export * from "./upsertIntoVectorIndex.js";
@@ -1,5 +1,4 @@
1
1
  export * from "./VectorIndex.js";
2
2
  export * from "./VectorIndexRetriever.js";
3
3
  export * from "./memory/MemoryVectorIndex.js";
4
- export * from "./pinecone/PineconeVectorIndex.js";
5
4
  export * from "./upsertIntoVectorIndex.js";
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PineconeVectorIndex = void 0;
4
- class PineconeVectorIndex {
5
- constructor({ index, namespace, schema, }) {
6
- Object.defineProperty(this, "index", {
7
- enumerable: true,
8
- configurable: true,
9
- writable: true,
10
- value: void 0
11
- });
12
- Object.defineProperty(this, "namespace", {
13
- enumerable: true,
14
- configurable: true,
15
- writable: true,
16
- value: void 0
17
- });
18
- Object.defineProperty(this, "schema", {
19
- enumerable: true,
20
- configurable: true,
21
- writable: true,
22
- value: void 0
23
- });
24
- this.index = index;
25
- this.namespace = namespace;
26
- this.schema = schema;
27
- }
28
- async upsertMany(data) {
29
- this.index.upsert({
30
- upsertRequest: {
31
- namespace: this.namespace,
32
- vectors: data.map((entry) => ({
33
- id: entry.id,
34
- values: entry.vector,
35
- metadata: entry.data,
36
- })),
37
- },
38
- });
39
- }
40
- async queryByVector({ queryVector, similarityThreshold, maxResults, }) {
41
- const { matches } = await this.index.query({
42
- queryRequest: {
43
- namespace: this.namespace,
44
- vector: queryVector,
45
- topK: maxResults,
46
- includeMetadata: true,
47
- },
48
- });
49
- if (matches == undefined) {
50
- return [];
51
- }
52
- return matches
53
- .filter((match) => similarityThreshold == undefined ||
54
- match.score == undefined ||
55
- match.score > similarityThreshold)
56
- .map((match) => ({
57
- id: match.id,
58
- data: this.schema.parse(match.metadata),
59
- similarity: match.score,
60
- }));
61
- }
62
- asIndex() {
63
- return this;
64
- }
65
- }
66
- exports.PineconeVectorIndex = PineconeVectorIndex;
@@ -1,29 +0,0 @@
1
- import { VectorOperationsApi } from "@pinecone-database/pinecone/dist/pinecone-generated-ts-fetch/index.js";
2
- import { z } from "zod";
3
- import { Vector } from "../../core/Vector.js";
4
- import { VectorIndex } from "../VectorIndex.js";
5
- export declare class PineconeVectorIndex<DATA extends object | undefined> implements VectorIndex<DATA, PineconeVectorIndex<DATA>, null> {
6
- readonly index: VectorOperationsApi;
7
- readonly namespace?: string;
8
- readonly schema: z.ZodSchema<DATA>;
9
- constructor({ index, namespace, schema, }: {
10
- index: VectorOperationsApi;
11
- namespace?: string;
12
- schema: z.ZodSchema<DATA>;
13
- });
14
- upsertMany(data: Array<{
15
- id: string;
16
- vector: Vector;
17
- data: DATA;
18
- }>): Promise<void>;
19
- queryByVector({ queryVector, similarityThreshold, maxResults, }: {
20
- queryVector: Vector;
21
- maxResults: number;
22
- similarityThreshold?: number;
23
- }): Promise<Array<{
24
- id: string;
25
- data: DATA;
26
- similarity?: number;
27
- }>>;
28
- asIndex(): PineconeVectorIndex<DATA>;
29
- }
@@ -1,62 +0,0 @@
1
- export class PineconeVectorIndex {
2
- constructor({ index, namespace, schema, }) {
3
- Object.defineProperty(this, "index", {
4
- enumerable: true,
5
- configurable: true,
6
- writable: true,
7
- value: void 0
8
- });
9
- Object.defineProperty(this, "namespace", {
10
- enumerable: true,
11
- configurable: true,
12
- writable: true,
13
- value: void 0
14
- });
15
- Object.defineProperty(this, "schema", {
16
- enumerable: true,
17
- configurable: true,
18
- writable: true,
19
- value: void 0
20
- });
21
- this.index = index;
22
- this.namespace = namespace;
23
- this.schema = schema;
24
- }
25
- async upsertMany(data) {
26
- this.index.upsert({
27
- upsertRequest: {
28
- namespace: this.namespace,
29
- vectors: data.map((entry) => ({
30
- id: entry.id,
31
- values: entry.vector,
32
- metadata: entry.data,
33
- })),
34
- },
35
- });
36
- }
37
- async queryByVector({ queryVector, similarityThreshold, maxResults, }) {
38
- const { matches } = await this.index.query({
39
- queryRequest: {
40
- namespace: this.namespace,
41
- vector: queryVector,
42
- topK: maxResults,
43
- includeMetadata: true,
44
- },
45
- });
46
- if (matches == undefined) {
47
- return [];
48
- }
49
- return matches
50
- .filter((match) => similarityThreshold == undefined ||
51
- match.score == undefined ||
52
- match.score > similarityThreshold)
53
- .map((match) => ({
54
- id: match.id,
55
- data: this.schema.parse(match.metadata),
56
- similarity: match.score,
57
- }));
58
- }
59
- asIndex() {
60
- return this;
61
- }
62
- }