import Connection from '../../connection/grpc.js'; import { ConsistencyLevel } from '../../data/index.js'; import { DbVersionSupport } from '../../utils/dbVersion.js'; import { Aggregate, Metrics } from '../aggregate/index.js'; import { BackupCollection } from '../backup/collection.js'; import { Config } from '../config/index.js'; import { Data } from '../data/index.js'; import { Filter } from '../filters/index.js'; import { Generate } from '../generate/index.js'; import { Iterator } from '../iterator/index.js'; import { Query } from '../query/index.js'; import { Sort } from '../sort/index.js'; import { TenantBase, Tenants } from '../tenants/index.js'; import { QueryMetadata, QueryProperty, QueryReference, ReturnVectors } from '../types/index.js'; import { IncludeVector } from '../types/internal.js'; import { MultiTargetVector } from '../vectors/multiTargetVector.js'; export interface Collection { /** This namespace includes all the querying methods available to you when using Weaviate's standard aggregation capabilities. */ aggregate: Aggregate; /** This namespace includes all the backup methods available to you when backing up a collection in Weaviate. */ backup: BackupCollection; /** This namespace includes all the CRUD methods available to you when modifying the configuration of the collection in Weaviate. */ config: Config; /** This namespace includes all the CUD methods available to you when modifying the data of the collection in Weaviate. */ data: Data; /** This namespace includes the methods by which you can create the `FilterValue` values for use when filtering queries over your collection. */ filter: Filter; /** This namespace includes all the querying methods available to you when using Weaviate's generative capabilities. */ generate: Generate; /** This namespace includes the methods by which you can create the `MetricsX` values for use when aggregating over your collection. */ metrics: Metrics; /** The name of the collection. */ name: N; /** This namespace includes all the querying methods available to you when using Weaviate's standard query capabilities. */ query: Query; /** This namespaces includes the methods by which you can create the `Sorting` values for use when sorting queries over your collection. */ sort: Sort; /** This namespace includes all the CRUD methods available to you when modifying the tenants of a multi-tenancy-enabled collection in Weaviate. */ tenants: Tenants; /** This namespaces includes the methods by which you cna create the `MultiTargetVectorJoin` values for use when performing multi-target vector searches over your collection. */ multiTargetVector: MultiTargetVector; /** * Use this method to check if the collection exists in Weaviate. * * @returns {Promise} A promise that resolves to `true` if the collection exists, and `false` otherwise. */ exists: () => Promise; /** * Use this method to return an iterator over the objects in the collection. * * This iterator keeps a record of the last object that it returned to be used in each subsequent call to Weaviate. * Once the collection is exhausted, the iterator exits. * * @typeParam I - The vector(s) to include in the response. If using named vectors, pass an array of strings to include only specific vectors. * @typeParam RV - The vectors(s) to be returned in the response depending on the input in opts.includeVector. * @param {IteratorOptions} opts The options to use when fetching objects from Weaviate. * @returns {Iterator} An iterator over the objects in the collection as an async generator. * * @description If `return_properties` is not provided, all the properties of each object will be * requested from Weaviate except for its vector as this is an expensive operation. Specify `include_vector` * to request the vectors back as well. In addition, if `return_references=None` then none of the references * are returned. Use `wvc.QueryReference` to specify which references to return. */ iterator: , RV extends ReturnVectors>(opts?: IteratorOptions) => Iterator; /** * Use this method to return the total number of objects in the collection. * * This is a short-hand for calling `collection.aggregate.overAll().then(({ totalCount }) => totalCount)`. */ length: () => Promise; /** * Use this method to return a collection object specific to a single consistency level. * * If replication is not configured for this collection then Weaviate will throw an error. * * This method does not send a request to Weaviate. It only returns a new collection object that is specific to the consistency level you specify. * * @param {ConsistencyLevel} consistencyLevel The consistency level to use. * @returns {Collection} A new collection object specific to the consistency level you specified. */ withConsistency: (consistencyLevel: ConsistencyLevel) => Collection; /** * Use this method to return a collection object specific to a single tenant. * * If multi-tenancy is not configured for this collection then Weaviate will throw an error. * * This method does not send a request to Weaviate. It only returns a new collection object that is specific to the tenant you specify. * * @typedef {TenantBase} TT A type that extends TenantBase. * @param {string | TT} tenant The tenant name or tenant object to use. * @returns {Collection} A new collection object specific to the tenant you specified. */ withTenant: (tenant: string | TT) => Collection; } export type IteratorOptions = { includeVector?: I; returnMetadata?: QueryMetadata; returnProperties?: QueryProperty[]; returnReferences?: QueryReference[]; }; declare const collection: (connection: Connection, name: N, dbVersionSupport: DbVersionSupport, consistencyLevel?: ConsistencyLevel, tenant?: string) => Collection; export default collection;