Skip to content

Commit 2c39e2b

Browse files
committed
feat: add vector types
1 parent a692928 commit 2c39e2b

File tree

5 files changed

+53
-2
lines changed

5 files changed

+53
-2
lines changed

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export * from './errors'
2-
export * from './typings'
1+
export * from "./errors";
2+
export * from "./typings";

src/typings/MsgVectorPayload.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export type MsgVectorPayload = {
2+
conversationID: string;
3+
userContent: string;
4+
botContent: string;
5+
};

src/typings/VectorPoint.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export type VectorPoint = {
2+
id: string | number;
3+
version: number;
4+
score: number;
5+
payload?:
6+
| Record<string, unknown>
7+
| {
8+
[key: string]: unknown;
9+
}
10+
| null
11+
| undefined;
12+
vector?:
13+
| Record<string, unknown>
14+
| number[]
15+
| {
16+
[key: string]: number[] | undefined;
17+
}
18+
| null
19+
| undefined;
20+
};

src/typings/VectorSearchParams.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
export type Match = {
2+
value: string;
3+
};
4+
5+
export type Must = {
6+
key: string;
7+
match: Match;
8+
};
9+
10+
export type Filter = {
11+
must: Must[];
12+
};
13+
14+
export type Searches = {
15+
vector: number[];
16+
limit: number;
17+
with_payload: boolean;
18+
filter: Filter;
19+
};
20+
21+
export type VectorSearchParams = {
22+
searches: Searches[];
23+
};

src/typings/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ export * from "./IUser";
22
export * from "./JsonResp";
33
export * from "./ReqParams";
44
export * from "./IConversation";
5+
export * from "./MsgVectorPayload";
6+
export * from "./VectorPoint";
7+
export * from "./VectorSearchParams";

0 commit comments

Comments
 (0)