Skip to content

Commit

Permalink
fix: rename RawSparseVector as SparseVector
Browse files Browse the repository at this point in the history
  • Loading branch information
CahidArda committed Dec 26, 2024
1 parent e34429e commit a3ea9a7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/commands/client/query/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Dict, NAMESPACE, RawSparseVector } from "../types";
import type { Dict, NAMESPACE, SparseVector } from "../types";

export type QueryCommandPayload = {
topK: number;
Expand All @@ -10,15 +10,15 @@ export type QueryCommandPayload = {
fusionAlgorithm?: FusionAlgorithm;
queryMode?: QueryMode;
} & (
| { vector?: number[]; sparseVector?: RawSparseVector; data?: never }
| { vector?: number[]; sparseVector?: SparseVector; data?: never }
| { data: string; vector?: never; sparseVector?: never }
);

export type QueryResult<TMetadata = Dict> = {
id: number | string;
score: number;
vector?: number[];
sparseVector?: RawSparseVector;
sparseVector?: SparseVector;
metadata?: TMetadata;
data?: string;
};
Expand Down
4 changes: 2 additions & 2 deletions src/commands/client/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export type Vector<TMetadata = Dict> = {
id: string;
vector?: number[];
sparseVector?: RawSparseVector;
sparseVector?: SparseVector;
metadata?: TMetadata;
data?: string;
};
Expand All @@ -10,4 +10,4 @@ export type NAMESPACE = string;

export type Dict = Record<string, unknown>;

export type RawSparseVector = [index: number[], factors: number[]];
export type SparseVector = [indices: number[], values: number[]];
4 changes: 2 additions & 2 deletions src/commands/client/update/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { NAMESPACE, RawSparseVector } from "@commands/client/types";
import type { NAMESPACE, SparseVector } from "@commands/client/types";
import { Command } from "@commands/command";
import { UpstashError } from "@error/index";

Expand All @@ -13,7 +13,7 @@ type MetadataUpdatePayload<TMetadata> = {
type VectorUpdatePayload = {
id: string | number;
vector?: number[];
sparseVector?: RawSparseVector;
sparseVector?: SparseVector;
};

type DataUpdatePayload = {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/client/upsert/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { NAMESPACE, RawSparseVector } from "@commands/client/types";
import type { NAMESPACE, SparseVector } from "@commands/client/types";
import { Command } from "@commands/command";

type NoInfer<T> = T extends infer U ? U : never;

type VectorPayload<TMetadata> = {
id: number | string;
vector?: number[];
sparseVector?: RawSparseVector;
sparseVector?: SparseVector;
metadata?: NoInfer<TMetadata>;
};

Expand Down

0 comments on commit a3ea9a7

Please sign in to comment.