UNPKG

weaviate-client

Version:
237 lines (236 loc) • 12.8 kB
import { WhereFilter } from '../../openapi/types.js'; import { BM25, Hybrid, NearAudioSearch, NearDepthSearch, NearIMUSearch, NearImageSearch, NearObject, NearTextSearch, NearThermalSearch, NearVector, NearVideoSearch, Selection, Targets, VectorForTarget } from '../../proto/v1/base_search.js'; import { BatchObject as BatchObjectGRPC, BatchReference as BatchReferenceGRPC } from '../../proto/v1/batch.js'; import { GenerativeSearch } from '../../proto/v1/generative.js'; import { Boost as BoostGRPC, GroupBy } from '../../proto/v1/search_get.js'; import { AggregateFetchArgs, AggregateHybridArgs, AggregateNearImageArgs, AggregateNearObjectArgs, AggregateNearTextArgs, AggregateNearVectorArgs } from '../../grpc/aggregator.js'; import { SearchBm25Args, SearchFetchArgs, SearchHybridArgs, SearchNearAudioArgs, SearchNearDepthArgs, SearchNearIMUArgs, SearchNearImageArgs, SearchNearObjectArgs, SearchNearTextArgs, SearchNearThermalArgs, SearchNearVectorArgs, SearchNearVideoArgs } from '../../grpc/searcher.js'; import { AggregateRequest_GroupBy } from '../../proto/v1/aggregate.js'; import { Filters as FiltersGRPC, Vectors } from '../../proto/v1/base.js'; import { FilterValue } from '../filters/index.js'; import { AggregateBaseOptions, AggregateHybridOptions, AggregateNearOptions, BatchReference, BoostOptions, DiversityConfig, GenerativeConfigRuntime, GroupByAggregate, GroupedTask, PropertiesMetrics, SinglePrompt } from '../index.js'; import { BaseHybridOptions, BaseNearOptions, Bm25Options, Bm25SearchOptions, FetchObjectByIdOptions, FetchObjectsOptions, HybridNearTextSubSearch, HybridNearVectorSubSearch, HybridOptions, HybridSearchOptions, ListOfVectors, MultiVectorType, NearOptions, NearTextOptions, NearVectorInputType, PrimitiveVectorType, SingleVectorType, TargetVectorInputType } from '../query/types.js'; import { TenantBC, TenantCreate, TenantUpdate } from '../tenants/types.js'; import { BatchObjects, DataObject, GenerateOptions, GeoCoordinate, GroupByOptions, MetadataKeys, NestedProperties, NonReferenceInputs, PhoneNumberInput, QueryMetadata, ReferenceInput, WeaviateField } from '../types/index.js'; export declare class DataGuards { static isText: (argument?: WeaviateField) => argument is string; static isTextArray: (argument?: WeaviateField) => argument is string[]; static isInt: (argument?: WeaviateField) => argument is number; static isIntArray: (argument?: WeaviateField) => argument is number[]; static isFloat: (argument?: WeaviateField) => argument is number; static isFloatArray: (argument?: WeaviateField) => argument is number[]; static isBoolean: (argument?: WeaviateField) => argument is boolean; static isBooleanArray: (argument?: WeaviateField) => argument is boolean[]; static isDate: (argument?: WeaviateField) => argument is Date; static isDateArray: (argument?: WeaviateField) => argument is Date[]; static isGeoCoordinate: (argument?: WeaviateField) => argument is GeoCoordinate; static isPhoneNumber: (argument?: WeaviateField) => argument is PhoneNumberInput; static isNested: (argument?: WeaviateField) => argument is NestedProperties; static isNestedArray: (argument?: WeaviateField) => argument is NestedProperties[]; static isEmptyArray: (argument?: WeaviateField) => argument is []; static isDataObject: <T>(obj: DataObject<T> | NonReferenceInputs<T>) => obj is DataObject<T>; } export declare class MetadataGuards { static isKeys: (argument?: QueryMetadata) => argument is MetadataKeys; static isAll: (argument?: QueryMetadata) => boolean; static isAllAndQueryProfile: (argument?: QueryMetadata) => boolean; static isUndefined: (argument?: QueryMetadata) => argument is undefined; } declare class Aggregate { private static aggregations; private static common; static groupBy: <T>(groupBy?: GroupByAggregate<T>) => AggregateRequest_GroupBy; static hybrid: <V>(query: string, opts?: AggregateHybridOptions<any, PropertiesMetrics<any>, V>) => Promise<AggregateHybridArgs>; static nearImage: <V>(image: string, opts?: AggregateNearOptions<PropertiesMetrics<any>, V>) => AggregateNearImageArgs; static nearObject: <V>(id: string, opts?: AggregateNearOptions<PropertiesMetrics<any>, V>) => AggregateNearObjectArgs; static nearText: <V>(query: string | string[], opts?: AggregateNearOptions<PropertiesMetrics<any>, V>) => AggregateNearTextArgs; static nearVector: <V>(vector: NearVectorInputType, opts?: AggregateNearOptions<PropertiesMetrics<any>, V>) => Promise<AggregateNearVectorArgs>; static overAll: (opts?: AggregateBaseOptions<PropertiesMetrics<any>>) => AggregateFetchArgs; } declare class Search { private static queryProperties; private static metadata; private static sortBy; private static rerank; static selection: (diversity?: DiversityConfig) => Selection | undefined; static groupBy: <T>(groupBy?: GroupByOptions<T>) => GroupBy; static isGroupBy: <T>(args: any) => args is T; private static common; static bm25: <T, V>(query: string, opts?: Bm25Options<T, V>) => SearchBm25Args; static fetchObjects: <T, V>(args?: FetchObjectsOptions<T, V>) => SearchFetchArgs; static fetchObjectById: <T, V>(args: { id: string; } & FetchObjectByIdOptions<T, V>) => SearchFetchArgs; static hybrid: <T, V, I>(args: { query: string; supportsVectors: boolean; }, opts?: HybridOptions<T, V, I>) => Promise<SearchHybridArgs>; static nearAudio: <T, V, I>(args: { audio: string; }, opts?: NearOptions<T, V, I>) => SearchNearAudioArgs; static nearDepth: <T, V, I>(args: { depth: string; }, opts?: NearOptions<T, V, I>) => SearchNearDepthArgs; static nearImage: <T, V, I>(args: { image: string; }, opts?: NearOptions<T, V, I>) => SearchNearImageArgs; static nearIMU: <T, V, I>(args: { imu: string; }, opts?: NearOptions<T, V, I>) => SearchNearIMUArgs; static nearObject: <T, V, I>(args: { id: string; }, opts?: NearOptions<T, V, I>) => SearchNearObjectArgs; static nearText: <T, V, I>(args: { query: string | string[]; }, opts?: NearTextOptions<T, V, I>) => SearchNearTextArgs; static nearThermal: <T, V, I>(args: { thermal: string; }, opts?: NearOptions<T, V, I>) => SearchNearThermalArgs; static nearVector: <T, V, I>(args: { vector: NearVectorInputType; supportsVectors: boolean; }, opts?: NearOptions<T, V, I>) => Promise<SearchNearVectorArgs>; static nearVideo: <T, V, I>(args: { video: string; }, opts?: NearOptions<T, V, I>) => SearchNearVideoArgs; } export declare class Serialize { static aggregate: typeof Aggregate; static search: typeof Search; static isNamedVectors: <T, V, I>(opts?: BaseNearOptions<T, V, I>) => boolean; static isMultiTarget: <T, V, I>(opts?: BaseNearOptions<T, V, I>) => boolean; static isMultiWeightPerTarget: <T, V, I>(opts?: BaseNearOptions<T, V, I>) => boolean; static isMultiVector: (vec?: NearVectorInputType) => boolean; static isMultiVectorPerTarget: (vec?: NearVectorInputType) => boolean; private static withImages; private static generativeQuery; static generative: <T>(args: { supportsSingleGrouped: boolean; }, opts?: GenerateOptions<T, GenerativeConfigRuntime | undefined>) => Promise<GenerativeSearch>; static isSinglePrompt(arg?: string | SinglePrompt): arg is SinglePrompt; static isGroupedTask<T>(arg?: string | GroupedTask<T>): arg is GroupedTask<T>; private static bm25QueryProperties; private static bm25SearchOperator; static bm25Search: <T>(args: { query: string; } & Bm25SearchOptions<T>) => BM25; private static diversitySelection; static isHybridVectorSearch: <T, V, I>(vector: BaseHybridOptions<T, V, I>["vector"]) => vector is PrimitiveVectorType | Record<string, PrimitiveVectorType | ListOfVectors<SingleVectorType> | ListOfVectors<MultiVectorType>>; static isHybridNearTextSearch: <T, V, I>(vector: BaseHybridOptions<T, V, I>["vector"]) => vector is HybridNearTextSubSearch; static isHybridNearVectorSearch: <T, V, I>(vector: BaseHybridOptions<T, V, I>["vector"]) => vector is HybridNearVectorSubSearch; private static hybridVector; static hybridSearch: <T, V>(args: { query: string; supportsVectors: boolean; } & HybridSearchOptions<T, V>) => Promise<Hybrid>; static nearAudioSearch: <T, V, I>(args: { audio: string; } & NearOptions<T, V, I>) => NearAudioSearch; static nearDepthSearch: <T, V, I>(args: { depth: string; } & NearOptions<T, V, I>) => NearDepthSearch; static nearImageSearch: <T, V, I>(args: { image: string; } & NearOptions<T, V, I>) => NearImageSearch; static nearIMUSearch: <T, V, I>(args: { imu: string; } & NearOptions<T, V, I>) => NearIMUSearch; static nearObjectSearch: <T, V, I>(args: { id: string; } & NearOptions<T, V, I>) => NearObject; static nearTextSearch: <V>(args: { query: string | string[]; targetVector?: TargetVectorInputType<V>; certainty?: number; distance?: number; diversity?: DiversityConfig; moveAway?: { concepts?: string[]; force?: number; objects?: string[]; }; moveTo?: { concepts?: string[]; force?: number; objects?: string[]; }; }) => NearTextSearch; static nearThermalSearch: <T, V, I>(args: { thermal: string; } & NearOptions<T, V, I>) => NearThermalSearch; private static vectorToBytes; /** * Convert a 2D array of numbers to a Uint8Array * * Defined as an async method so that control can be relinquished back to the event loop on each outer loop for large vectors */ private static vectorsToBytes; static nearVectorSearch: <V>(args: { vector: NearVectorInputType; supportsVectors: boolean; certainty?: number; distance?: number; diversity?: DiversityConfig; targetVector?: TargetVectorInputType<V>; }) => Promise<NearVector>; static targetVector: <V>(args?: { targetVector?: TargetVectorInputType<V>; }) => { targets?: Targets; targetVectors?: string[]; }; static vectors: <V>(args: { supportsVectors: boolean; argumentName: "nearVector" | "vector"; targetVector?: TargetVectorInputType<V>; vector?: NearVectorInputType; }) => Promise<{ targetVectors?: string[]; targets?: Targets; vectorBytes?: Uint8Array; vectors?: Vectors[]; vectorPerTarget?: Record<string, Uint8Array>; vectorForTargets?: VectorForTarget[]; }>; private static targets; static nearVideoSearch: <T, V, I>(args: { video: string; } & NearOptions<T, V, I>) => NearVideoSearch; private static boostCurve; private static boostModifier; static boostGRPC: (boost: BoostOptions) => BoostGRPC; static filtersGRPC: (filters: FilterValue) => FiltersGRPC; private static filtersGRPCValueText; private static filtersGRPCValueTextArray; private static filterTargetToREST; static filtersREST: (filters: FilterValue) => WhereFilter; private static operator; static restProperties: (properties: Record<string, WeaviateField | undefined>, references?: Record<string, ReferenceInput<any> | undefined>) => Record<string, any>; private static batchProperties; static batchObject: <T>(collection: string, object: DataObject<T> | NonReferenceInputs<T>, requiresInsertFix: boolean, tenant?: string) => { grpc: BatchObjectGRPC; object: { id: string; collection: string; tenant: string | undefined; properties?: NonReferenceInputs<T> | undefined; references?: import("../index.js").ReferenceInputs<T> | undefined; vectors?: number[] | import("../index.js").Vectors; }; }; static batchObjects: <T>(collection: string, objects: (DataObject<T> | NonReferenceInputs<T>)[], requiresInsertFix: boolean, tenant?: string) => Promise<BatchObjects<T>>; static batchReference: (ref: BatchReference) => { grpc: BatchReferenceGRPC; beacon: string; }; static tenants<T, M>(tenants: T[], mapper: (tenant: T) => M): M[][]; static tenantCreate<T extends TenantBC | TenantCreate>(tenant: T): { name: string; activityStatus?: 'HOT' | 'COLD'; }; static tenantUpdate<T extends TenantBC | TenantUpdate>(tenant: T): { name: string; activityStatus: 'HOT' | 'COLD' | 'FROZEN'; }; } export {};