index int64 0 731k | package stringlengths 2 98 ⌀ | name stringlengths 1 76 | docstring stringlengths 0 281k ⌀ | code stringlengths 4 1.07M ⌀ | signature stringlengths 2 42.8k ⌀ |
|---|---|---|---|---|---|
730,336 | mmengine.fileio.handlers.registry_utils | register_handler | null | def register_handler(file_formats, **kwargs):
def wrap(cls):
_register_handler(cls(**kwargs), file_formats)
return cls
return wrap
| (file_formats, **kwargs) |
730,338 | mmengine.fileio.io | remove | Remove a file.
Args:
filepath (str, Path): Path to be removed.
backend_args (dict, optional): Arguments to instantiate the
corresponding backend. Defaults to None.
Raises:
FileNotFoundError: If filepath does not exist, an FileNotFoundError
will be raised.
... | def remove(
filepath: Union[str, Path],
backend_args: Optional[dict] = None,
) -> None:
"""Remove a file.
Args:
filepath (str, Path): Path to be removed.
backend_args (dict, optional): Arguments to instantiate the
corresponding backend. Defaults to None.
Raises:
... | (filepath: Union[str, pathlib.Path], backend_args: Optional[dict] = None) -> NoneType |
730,339 | mmengine.utils.misc | requires_executable | A decorator to check if some executable files are installed.
Example:
>>> @requires_executable('ffmpeg')
>>> func(arg1, args):
>>> print(1)
1
| def requires_executable(prerequisites):
"""A decorator to check if some executable files are installed.
Example:
>>> @requires_executable('ffmpeg')
>>> func(arg1, args):
>>> print(1)
1
"""
return check_prerequisites(prerequisites, checker=_check_executable)
| (prerequisites) |
730,340 | mmengine.utils.misc | requires_package | A decorator to check if some python packages are installed.
Example:
>>> @requires_package('numpy')
>>> func(arg1, args):
>>> return numpy.zeros(1)
array([0.])
>>> @requires_package(['numpy', 'non_package'])
>>> func(arg1, args):
>>> return numpy.zero... | def requires_package(prerequisites):
"""A decorator to check if some python packages are installed.
Example:
>>> @requires_package('numpy')
>>> func(arg1, args):
>>> return numpy.zeros(1)
array([0.])
>>> @requires_package(['numpy', 'non_package'])
>>> func(ar... | (prerequisites) |
730,341 | mmengine.fileio.io | rmtree | Recursively delete a directory tree.
Args:
dir_path (str or Path): A directory to be removed.
backend_args (dict, optional): Arguments to instantiate the
corresponding backend. Defaults to None.
Examples:
>>> dir_path = '/path/of/dir'
>>> rmtree(dir_path)
| def rmtree(
dir_path: Union[str, Path],
backend_args: Optional[dict] = None,
) -> None:
"""Recursively delete a directory tree.
Args:
dir_path (str or Path): A directory to be removed.
backend_args (dict, optional): Arguments to instantiate the
corresponding backend. Default... | (dir_path: Union[str, pathlib.Path], backend_args: Optional[dict] = None) -> NoneType |
730,342 | mmengine.utils.path | scandir | Scan a directory to find the interested files.
Args:
dir_path (str | :obj:`Path`): Path of the directory.
suffix (str | tuple(str), optional): File suffix that we are
interested in. Defaults to None.
recursive (bool, optional): If set to True, recursively scan the
di... | def scandir(dir_path, suffix=None, recursive=False, case_sensitive=True):
"""Scan a directory to find the interested files.
Args:
dir_path (str | :obj:`Path`): Path of the directory.
suffix (str | tuple(str), optional): File suffix that we are
interested in. Defaults to None.
... | (dir_path, suffix=None, recursive=False, case_sensitive=True) |
730,343 | mmengine.utils.misc | slice_list | Slice a list into several sub lists by a list of given length.
Args:
in_list (list): The list to be sliced.
lens(int or list): The expected length of each out list.
Returns:
list: A list of sliced list.
| def slice_list(in_list, lens):
"""Slice a list into several sub lists by a list of given length.
Args:
in_list (list): The list to be sliced.
lens(int or list): The expected length of each out list.
Returns:
list: A list of sliced list.
"""
if isinstance(lens, int):
... | (in_list, lens) |
730,344 | mmengine.utils.path | symlink | null | def symlink(src, dst, overwrite=True, **kwargs):
if os.path.lexists(dst) and overwrite:
os.remove(dst)
os.symlink(src, dst, **kwargs)
| (src, dst, overwrite=True, **kwargs) |
730,345 | mmengine.utils.misc | parse | null | def _ntuple(n):
def parse(x):
if isinstance(x, collections.abc.Iterable):
return x
return tuple(repeat(x, n))
return parse
| (x) |
730,350 | mmengine.utils.progressbar | track_iter_progress | Track the progress of tasks iteration or enumeration with a progress
bar.
Tasks are yielded with a simple for-loop.
Args:
tasks (Sequence): If tasks is a tuple, it must contain two elements,
the first being the tasks to be completed and the other being the
number of tasks. ... | def track_iter_progress(tasks: Sequence, bar_width: int = 50, file=sys.stdout):
"""Track the progress of tasks iteration or enumeration with a progress
bar.
Tasks are yielded with a simple for-loop.
Args:
tasks (Sequence): If tasks is a tuple, it must contain two elements,
the firs... | (tasks: Sequence, bar_width: int = 50, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>) |
730,351 | mmengine.utils.progressbar | track_parallel_progress | Track the progress of parallel task execution with a progress bar.
The built-in :mod:`multiprocessing` module is used for process pools and
tasks are done with :func:`Pool.map` or :func:`Pool.imap_unordered`.
Args:
func (callable): The function to be applied to each task.
tasks (Sequence):... | def track_parallel_progress(func: Callable,
tasks: Sequence,
nproc: int,
initializer: Callable = None,
initargs: tuple = None,
bar_width: int = 50,
chun... | (func: Callable, tasks: Sequence, nproc: int, initializer: Optional[Callable] = None, initargs: Optional[tuple] = None, bar_width: int = 50, chunksize: int = 1, skip_first: bool = False, keep_order: bool = True, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>) |
730,352 | mmengine.utils.progressbar | track_progress | Track the progress of tasks execution with a progress bar.
Tasks are done with a simple for-loop.
Args:
func (callable): The function to be applied to each task.
tasks (Sequence): If tasks is a tuple, it must contain two elements,
the first being the tasks to be completed and the o... | def track_progress(func: Callable,
tasks: Sequence,
bar_width: int = 50,
file=sys.stdout,
**kwargs):
"""Track the progress of tasks execution with a progress bar.
Tasks are done with a simple for-loop.
Args:
func (callable... | (func: Callable, tasks: Sequence, bar_width: int = 50, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, **kwargs) |
730,353 | mmengine.utils.progressbar_rich | track_progress_rich | Track the progress of parallel task execution with a progress bar. The
built-in :mod:`multiprocessing` module is used for process pools and tasks
are done with :func:`Pool.map` or :func:`Pool.imap_unordered`.
Args:
func (callable): The function to be applied to each task.
tasks (Iterable or... | def track_progress_rich(func: Callable,
tasks: Iterable = tuple(),
task_num: int = None,
nproc: int = 1,
chunksize: int = 1,
description: str = 'Processing',
color: str = 'blue... | (func: Callable, tasks: Iterable = (), task_num: Optional[int] = None, nproc: int = 1, chunksize: int = 1, description: str = 'Processing', color: str = 'blue') -> list |
730,354 | mmengine.registry.utils | traverse_registry_tree | Traverse the whole registry tree from any given node, and collect
information of all registered modules in this registry tree.
Args:
registry (Registry): a registry node in the registry tree.
verbose (bool): Whether to print log. Defaults to True
Returns:
list: Statistic results of... | def traverse_registry_tree(registry: Registry, verbose: bool = True) -> list:
"""Traverse the whole registry tree from any given node, and collect
information of all registered modules in this registry tree.
Args:
registry (Registry): a registry node in the registry tree.
verbose (bool): Wh... | (registry: mmengine.registry.registry.Registry, verbose: bool = True) -> list |
730,355 | mmengine.utils.misc | tuple_cast | Cast elements of an iterable object into a tuple of some type.
A partial method of :func:`iter_cast`.
| def tuple_cast(inputs, dst_type):
"""Cast elements of an iterable object into a tuple of some type.
A partial method of :func:`iter_cast`.
"""
return iter_cast(inputs, dst_type, return_type=tuple)
| (inputs, dst_type) |
730,358 | datasette_query_history | extra_css_urls | null | @hookimpl
def extra_css_urls(database, table, columns, view_name, datasette):
return [
"/-/static-plugins/datasette_query_history/datasette-query-history.css",
]
| (database, table, columns, view_name, datasette) |
730,359 | datasette_query_history | extra_js_urls | null | @hookimpl
def extra_js_urls(database, table, columns, view_name, datasette):
return [
"/-/static-plugins/datasette_query_history/datasette-query-history.js",
]
| (database, table, columns, view_name, datasette) |
730,360 | jupytercad_freecad | _jupyter_labextension_paths | null | def _jupyter_labextension_paths():
return [{"src": "labextension", "dest": "@jupytercad/jupytercad-freecad"}]
| () |
730,361 | jupytercad_freecad | _jupyter_server_extension_points | null | def _jupyter_server_extension_points():
return [{"module": "jupytercad_freecad"}]
| () |
730,362 | jupytercad_freecad | _load_jupyter_server_extension | Registers the API handler to receive HTTP requests from the frontend extension.
Parameters
----------
server_app: jupyterlab.labapp.LabApp
JupyterLab application instance
| def _load_jupyter_server_extension(server_app):
"""Registers the API handler to receive HTTP requests from the frontend extension.
Parameters
----------
server_app: jupyterlab.labapp.LabApp
JupyterLab application instance
"""
setup_handlers(server_app.web_app)
name = "jupytercad_fre... | (server_app) |
730,365 | jupytercad_freecad.handlers | setup_handlers | null | def setup_handlers(web_app):
host_pattern = ".*$"
base_url = web_app.settings["base_url"]
route_pattern = url_path_join(base_url, "jupytercad_freecad", "backend-check")
handlers = [(route_pattern, BackendCheckHandler)]
web_app.add_handlers(host_pattern, handlers)
| (web_app) |
730,366 | chromadb.api | AdminAPI | null | class AdminAPI(ABC):
@abstractmethod
def create_database(self, name: str, tenant: str = DEFAULT_TENANT) -> None:
"""Create a new database. Raises an error if the database already exists.
Args:
database: The name of the database to create.
"""
pass
@abstractmeth... | () |
730,367 | chromadb.api | create_database | Create a new database. Raises an error if the database already exists.
Args:
database: The name of the database to create.
| @abstractmethod
def create_database(self, name: str, tenant: str = DEFAULT_TENANT) -> None:
"""Create a new database. Raises an error if the database already exists.
Args:
database: The name of the database to create.
"""
pass
| (self, name: str, tenant: str = 'default_tenant') -> NoneType |
730,368 | chromadb.api | create_tenant | Create a new tenant. Raises an error if the tenant already exists.
Args:
tenant: The name of the tenant to create.
| @abstractmethod
def create_tenant(self, name: str) -> None:
"""Create a new tenant. Raises an error if the tenant already exists.
Args:
tenant: The name of the tenant to create.
"""
pass
| (self, name: str) -> NoneType |
730,369 | chromadb.api | get_database | Get a database. Raises an error if the database does not exist.
Args:
database: The name of the database to get.
tenant: The tenant of the database to get.
| @abstractmethod
def get_database(self, name: str, tenant: str = DEFAULT_TENANT) -> Database:
"""Get a database. Raises an error if the database does not exist.
Args:
database: The name of the database to get.
tenant: The tenant of the database to get.
"""
pass
| (self, name: str, tenant: str = 'default_tenant') -> chromadb.types.Database |
730,370 | chromadb.api | get_tenant | Get a tenant. Raises an error if the tenant does not exist.
Args:
tenant: The name of the tenant to get.
| @abstractmethod
def get_tenant(self, name: str) -> Tenant:
"""Get a tenant. Raises an error if the tenant does not exist.
Args:
tenant: The name of the tenant to get.
"""
pass
| (self, name: str) -> chromadb.types.Tenant |
730,371 | chromadb | AdminClient |
Creates an admin client that can be used to create tenants and databases.
| def AdminClient(settings: Settings = Settings()) -> AdminAPI:
"""
Creates an admin client that can be used to create tenants and databases.
"""
return AdminClientCreator(settings=settings)
| (settings: chromadb.config.Settings = Settings(environment='', chroma_api_impl='chromadb.api.segment.SegmentAPI', chroma_server_nofile=None, chroma_server_thread_pool_size=40, tenant_id='default', topic_namespace='default', chroma_server_host=None, chroma_server_headers=None, chroma_server_http_port=None, chroma_server... |
730,372 | chromadb.api.client | AdminClient | null | class AdminClient(SharedSystemClient, AdminAPI):
_server: ServerAPI
def __init__(self, settings: Settings = Settings()) -> None:
super().__init__(settings)
self._server = self._system.instance(ServerAPI)
@override
def create_database(self, name: str, tenant: str = DEFAULT_TENANT) -> No... | (settings: chromadb.config.Settings = Settings(environment='', chroma_api_impl='chromadb.api.segment.SegmentAPI', chroma_server_nofile=None, chroma_server_thread_pool_size=40, tenant_id='default', topic_namespace='default', chroma_server_host=None, chroma_server_headers=None, chroma_server_http_port=None, chroma_server... |
730,373 | chromadb.api.client | __init__ | null | def __init__(self, settings: Settings = Settings()) -> None:
super().__init__(settings)
self._server = self._system.instance(ServerAPI)
| (self, settings: chromadb.config.Settings = Settings(environment='', chroma_api_impl='chromadb.api.segment.SegmentAPI', chroma_server_nofile=None, chroma_server_thread_pool_size=40, tenant_id='default', topic_namespace='default', chroma_server_host=None, chroma_server_headers=None, chroma_server_http_port=None, chroma_... |
730,374 | chromadb.api.client | _get_identifier_from_settings | null | @staticmethod
def _get_identifier_from_settings(settings: Settings) -> str:
identifier = ""
api_impl = settings.chroma_api_impl
if api_impl is None:
raise ValueError("Chroma API implementation must be set in settings")
elif api_impl == "chromadb.api.segment.SegmentAPI":
if settings.is_pe... | (settings: chromadb.config.Settings) -> str |
730,375 | chromadb.api.client | _populate_data_from_system | null | @staticmethod
def _populate_data_from_system(system: System) -> str:
identifier = SharedSystemClient._get_identifier_from_settings(system.settings)
SharedSystemClient._identifer_to_system[identifier] = system
return identifier
| (system: chromadb.config.System) -> str |
730,376 | chromadb.api.client | clear_system_cache | null | @staticmethod
def clear_system_cache() -> None:
SharedSystemClient._identifer_to_system = {}
| () -> NoneType |
730,377 | chromadb.api.client | create_database | Create a new database. Raises an error if the database already exists.
Args:
database: The name of the database to create.
| @override
def create_database(self, name: str, tenant: str = DEFAULT_TENANT) -> None:
return self._server.create_database(name=name, tenant=tenant)
| (self, name: str, tenant: str = 'default_tenant') -> NoneType |
730,378 | chromadb.api.client | create_tenant | Create a new tenant. Raises an error if the tenant already exists.
Args:
tenant: The name of the tenant to create.
| @override
def create_tenant(self, name: str) -> None:
return self._server.create_tenant(name=name)
| (self, name: str) -> NoneType |
730,379 | chromadb.api.client | get_database | Get a database. Raises an error if the database does not exist.
Args:
database: The name of the database to get.
tenant: The tenant of the database to get.
| @override
def get_database(self, name: str, tenant: str = DEFAULT_TENANT) -> Database:
return self._server.get_database(name=name, tenant=tenant)
| (self, name: str, tenant: str = 'default_tenant') -> chromadb.types.Database |
730,380 | chromadb.api.client | get_tenant | Get a tenant. Raises an error if the tenant does not exist.
Args:
tenant: The name of the tenant to get.
| @override
def get_tenant(self, name: str) -> Tenant:
return self._server.get_tenant(name=name)
| (self, name: str) -> chromadb.types.Tenant |
730,381 | chromadb | Client |
Return a running chroma.API instance
tenant: The tenant to use for this client. Defaults to the default tenant.
database: The database to use for this client. Defaults to the default database.
| def Client(
settings: Settings = __settings,
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
) -> ClientAPI:
"""
Return a running chroma.API instance
tenant: The tenant to use for this client. Defaults to the default tenant.
database: The database to use for this client. Def... | (settings: chromadb.config.Settings = Settings(environment='', chroma_api_impl='chromadb.api.segment.SegmentAPI', chroma_server_nofile=None, chroma_server_thread_pool_size=40, tenant_id='default', topic_namespace='default', chroma_server_host=None, chroma_server_headers=None, chroma_server_http_port=None, chroma_server... |
730,382 | chromadb.api | ClientAPI | null | class ClientAPI(BaseAPI, ABC):
tenant: str
database: str
@abstractmethod
def set_tenant(self, tenant: str, database: str = DEFAULT_DATABASE) -> None:
"""Set the tenant and database for the client. Raises an error if the tenant or
database does not exist.
Args:
tenan... | () |
730,383 | chromadb.api | _add | [Internal] Add embeddings to a collection specified by UUID.
If (some) ids already exist, only the new embeddings will be added.
Args:
ids: The ids to associate with the embeddings.
collection_id: The UUID of the collection to add the embeddings to.
embedding: The se... | @abstractmethod
def _add(
self,
ids: IDs,
collection_id: UUID,
embeddings: Embeddings,
metadatas: Optional[Metadatas] = None,
documents: Optional[Documents] = None,
uris: Optional[URIs] = None,
) -> bool:
"""[Internal] Add embeddings to a collection specified by UUID.
If (some) ids a... | (self, ids: List[str], collection_id: uuid.UUID, embeddings: List[Union[Sequence[float], Sequence[int]]], metadatas: Optional[List[Mapping[str, Union[str, int, float, bool]]]] = None, documents: Optional[List[str]] = None, uris: Optional[List[str]] = None) -> bool |
730,384 | chromadb.api | _count | [Internal] Returns the number of entries in a collection specified by UUID.
Args:
collection_id: The UUID of the collection to count the embeddings in.
Returns:
int: The number of embeddings in the collection
| @abstractmethod
def _count(self, collection_id: UUID) -> int:
"""[Internal] Returns the number of entries in a collection specified by UUID.
Args:
collection_id: The UUID of the collection to count the embeddings in.
Returns:
int: The number of embeddings in the collection
"""
pass
| (self, collection_id: uuid.UUID) -> int |
730,385 | chromadb.api | _delete | [Internal] Deletes entries from a collection specified by UUID.
Args:
collection_id: The UUID of the collection to delete the entries from.
ids: The IDs of the entries to delete. Defaults to None.
where: Conditional filtering on metadata. Defaults to {}.
where_do... | @abstractmethod
def _delete(
self,
collection_id: UUID,
ids: Optional[IDs],
where: Optional[Where] = {},
where_document: Optional[WhereDocument] = {},
) -> IDs:
"""[Internal] Deletes entries from a collection specified by UUID.
Args:
collection_id: The UUID of the collection to delet... | (self, collection_id: uuid.UUID, ids: Optional[List[str]], where: Optional[Dict[Union[str, Literal['$and'], Literal['$or']], Union[str, int, float, bool, Dict[Union[Literal['$gt'], Literal['$gte'], Literal['$lt'], Literal['$lte'], Literal['$ne'], Literal['$eq'], Literal['$and'], Literal['$or']], Union[str, int, float, ... |
730,386 | chromadb.api | _get | [Internal] Returns entries from a collection specified by UUID.
Args:
ids: The IDs of the entries to get. Defaults to None.
where: Conditional filtering on metadata. Defaults to {}.
sort: The column to sort the entries by. Defaults to None.
limit: The maximum num... | @abstractmethod
def _get(
self,
collection_id: UUID,
ids: Optional[IDs] = None,
where: Optional[Where] = {},
sort: Optional[str] = None,
limit: Optional[int] = None,
offset: Optional[int] = None,
page: Optional[int] = None,
page_size: Optional[int] = None,
where_document: Optiona... | (self, collection_id: uuid.UUID, ids: Optional[List[str]] = None, where: Optional[Dict[Union[str, Literal['$and'], Literal['$or']], Union[str, int, float, bool, Dict[Union[Literal['$gt'], Literal['$gte'], Literal['$lt'], Literal['$lte'], Literal['$ne'], Literal['$eq'], Literal['$and'], Literal['$or']], Union[str, int, ... |
730,387 | chromadb.api | _modify | [Internal] Modify a collection by UUID. Can update the name and/or metadata.
Args:
id: The internal UUID of the collection to modify.
new_name: The new name of the collection.
If None, the existing name will remain. Defaults to None.
new_metad... | def _modify(
self,
id: UUID,
new_name: Optional[str] = None,
new_metadata: Optional[CollectionMetadata] = None,
) -> None:
"""[Internal] Modify a collection by UUID. Can update the name and/or metadata.
Args:
id: The internal UUID of the collection to modify.
new_name: The new na... | (self, id: uuid.UUID, new_name: Optional[str] = None, new_metadata: Optional[Dict[str, Any]] = None) -> NoneType |
730,388 | chromadb.api | _peek | [Internal] Returns the first n entries in a collection specified by UUID.
Args:
collection_id: The UUID of the collection to peek into.
n: The number of entries to peek. Defaults to 10.
Returns:
GetResult: The first n entries in the collection.
| @abstractmethod
def _peek(self, collection_id: UUID, n: int = 10) -> GetResult:
"""[Internal] Returns the first n entries in a collection specified by UUID.
Args:
collection_id: The UUID of the collection to peek into.
n: The number of entries to peek. Defaults to 10.
Returns:
GetRes... | (self, collection_id: uuid.UUID, n: int = 10) -> chromadb.api.types.GetResult |
730,389 | chromadb.api | _query | [Internal] Performs a nearest neighbors query on a collection specified by UUID.
Args:
collection_id: The UUID of the collection to query.
query_embeddings: The embeddings to use as the query.
n_results: The number of results to return. Defaults to 10.
where: Con... | @abstractmethod
def _query(
self,
collection_id: UUID,
query_embeddings: Embeddings,
n_results: int = 10,
where: Where = {},
where_document: WhereDocument = {},
include: Include = ["embeddings", "metadatas", "documents", "distances"],
) -> QueryResult:
"""[Internal] Performs a nearest ne... | (self, collection_id: uuid.UUID, query_embeddings: List[Union[Sequence[float], Sequence[int]]], n_results: int = 10, where: Dict[Union[str, Literal['$and'], Literal['$or']], Union[str, int, float, bool, Dict[Union[Literal['$gt'], Literal['$gte'], Literal['$lt'], Literal['$lte'], Literal['$ne'], Literal['$eq'], Literal[... |
730,390 | chromadb.api | _update | [Internal] Update entries in a collection specified by UUID.
Args:
collection_id: The UUID of the collection to update the embeddings in.
ids: The IDs of the entries to update.
embeddings: The sequence of embeddings to update. Defaults to None.
metadatas: The met... | @abstractmethod
def _update(
self,
collection_id: UUID,
ids: IDs,
embeddings: Optional[Embeddings] = None,
metadatas: Optional[Metadatas] = None,
documents: Optional[Documents] = None,
uris: Optional[URIs] = None,
) -> bool:
"""[Internal] Update entries in a collection specified by UUID.... | (self, collection_id: uuid.UUID, ids: List[str], embeddings: Optional[List[Union[Sequence[float], Sequence[int]]]] = None, metadatas: Optional[List[Mapping[str, Union[str, int, float, bool]]]] = None, documents: Optional[List[str]] = None, uris: Optional[List[str]] = None) -> bool |
730,391 | chromadb.api | _upsert | [Internal] Add or update entries in the a collection specified by UUID.
If an entry with the same id already exists, it will be updated,
otherwise it will be added.
Args:
collection_id: The collection to add the embeddings to
ids: The ids to associate with the embeddings... | @abstractmethod
def _upsert(
self,
collection_id: UUID,
ids: IDs,
embeddings: Embeddings,
metadatas: Optional[Metadatas] = None,
documents: Optional[Documents] = None,
uris: Optional[URIs] = None,
) -> bool:
"""[Internal] Add or update entries in the a collection specified by UUID.
I... | (self, collection_id: uuid.UUID, ids: List[str], embeddings: List[Union[Sequence[float], Sequence[int]]], metadatas: Optional[List[Mapping[str, Union[str, int, float, bool]]]] = None, documents: Optional[List[str]] = None, uris: Optional[List[str]] = None) -> bool |
730,392 | chromadb.api | clear_system_cache | Clear the system cache so that new systems can be created for an existing path.
This should only be used for testing purposes. | @staticmethod
@abstractmethod
def clear_system_cache() -> None:
"""Clear the system cache so that new systems can be created for an existing path.
This should only be used for testing purposes."""
pass
| () -> NoneType |
730,393 | chromadb.api | count_collections | Count the number of collections.
Returns:
int: The number of collections.
Examples:
```python
client.count_collections()
# 1
```
| @abstractmethod
def count_collections(self) -> int:
"""Count the number of collections.
Returns:
int: The number of collections.
Examples:
```python
client.count_collections()
# 1
```
"""
pass
| (self) -> int |
730,394 | chromadb.api | create_collection | Create a new collection with the given name and metadata.
Args:
name: The name of the collection to create.
metadata: Optional metadata to associate with the collection.
embedding_function: Optional function to use to embed documents.
Uses the ... | @abstractmethod
def create_collection(
self,
name: str,
metadata: Optional[CollectionMetadata] = None,
embedding_function: Optional[
EmbeddingFunction[Embeddable]
] = ef.DefaultEmbeddingFunction(), # type: ignore
data_loader: Optional[DataLoader[Loadable]] = None,
get_or_create: boo... | (self, name: str, metadata: Optional[Dict[str, Any]] = None, embedding_function: Optional[chromadb.api.types.EmbeddingFunction[Union[List[str], List[numpy.ndarray[Any, numpy.dtype[Union[numpy.uint64, numpy.int64, numpy.float64]]]]]]] = <chromadb.utils.embedding_functions.ONNXMiniLM_L6_V2 object at 0x7fd509816bf0>, data... |
730,395 | chromadb.api | delete_collection | Delete a collection with the given name.
Args:
name: The name of the collection to delete.
Raises:
ValueError: If the collection does not exist.
Examples:
```python
client.delete_collection("my_collection")
```
| @abstractmethod
def delete_collection(
self,
name: str,
) -> None:
"""Delete a collection with the given name.
Args:
name: The name of the collection to delete.
Raises:
ValueError: If the collection does not exist.
Examples:
```python
client.delete_collection("my_... | (self, name: str) -> NoneType |
730,396 | chromadb.api | get_collection | Get a collection with the given name.
Args:
id: The UUID of the collection to get. Id and Name are simultaneously used for lookup if provided.
name: The name of the collection to get
embedding_function: Optional function to use to embed documents.
... | @abstractmethod
def get_collection(
self,
name: str,
id: Optional[UUID] = None,
embedding_function: Optional[
EmbeddingFunction[Embeddable]
] = ef.DefaultEmbeddingFunction(), # type: ignore
data_loader: Optional[DataLoader[Loadable]] = None,
) -> Collection:
"""Get a collection with... | (self, name: str, id: Optional[uuid.UUID] = None, embedding_function: Optional[chromadb.api.types.EmbeddingFunction[Union[List[str], List[numpy.ndarray[Any, numpy.dtype[Union[numpy.uint64, numpy.int64, numpy.float64]]]]]]] = <chromadb.utils.embedding_functions.ONNXMiniLM_L6_V2 object at 0x7fd508c09e10>, data_loader: Op... |
730,397 | chromadb.api | get_or_create_collection | Get or create a collection with the given name and metadata.
Args:
name: The name of the collection to get or create
metadata: Optional metadata to associate with the collection. If
the collection alredy exists, the metadata will be updated if
provided and not Non... | @abstractmethod
def get_or_create_collection(
self,
name: str,
metadata: Optional[CollectionMetadata] = None,
embedding_function: Optional[
EmbeddingFunction[Embeddable]
] = ef.DefaultEmbeddingFunction(), # type: ignore
data_loader: Optional[DataLoader[Loadable]] = None,
) -> Collection... | (self, name: str, metadata: Optional[Dict[str, Any]] = None, embedding_function: Optional[chromadb.api.types.EmbeddingFunction[Union[List[str], List[numpy.ndarray[Any, numpy.dtype[Union[numpy.uint64, numpy.int64, numpy.float64]]]]]]] = <chromadb.utils.embedding_functions.ONNXMiniLM_L6_V2 object at 0x7fd508c095a0>, data... |
730,398 | chromadb.api | get_settings | Get the settings used to initialize.
Returns:
Settings: The settings used to initialize.
| @abstractmethod
def get_settings(self) -> Settings:
"""Get the settings used to initialize.
Returns:
Settings: The settings used to initialize.
"""
pass
| (self) -> chromadb.config.Settings |
730,399 | chromadb.api | get_version | Get the version of Chroma.
Returns:
str: The version of Chroma
| @abstractmethod
def get_version(self) -> str:
"""Get the version of Chroma.
Returns:
str: The version of Chroma
"""
pass
| (self) -> str |
730,400 | chromadb.api | heartbeat | Get the current time in nanoseconds since epoch.
Used to check if the server is alive.
Returns:
int: The current time in nanoseconds since epoch
| @abstractmethod
def heartbeat(self) -> int:
"""Get the current time in nanoseconds since epoch.
Used to check if the server is alive.
Returns:
int: The current time in nanoseconds since epoch
"""
pass
| (self) -> int |
730,401 | chromadb.api | list_collections | List all collections.
Args:
limit: The maximum number of entries to return. Defaults to None.
offset: The number of entries to skip before returning. Defaults to None.
Returns:
Sequence[Collection]: A list of collections
Examples:
```python
... | @abstractmethod
def list_collections(
self,
limit: Optional[int] = None,
offset: Optional[int] = None,
) -> Sequence[Collection]:
"""List all collections.
Args:
limit: The maximum number of entries to return. Defaults to None.
offset: The number of entries to skip before returning. D... | (self, limit: Optional[int] = None, offset: Optional[int] = None) -> Sequence[chromadb.api.models.Collection.Collection] |
730,402 | chromadb.api | reset | Resets the database. This will delete all collections and entries.
Returns:
bool: True if the database was reset successfully.
| @abstractmethod
def reset(self) -> bool:
"""Resets the database. This will delete all collections and entries.
Returns:
bool: True if the database was reset successfully.
"""
pass
| (self) -> bool |
730,403 | chromadb.api | set_database | Set the database for the client. Raises an error if the database does not exist.
Args:
database: The database to set.
| @abstractmethod
def set_database(self, database: str) -> None:
"""Set the database for the client. Raises an error if the database does not exist.
Args:
database: The database to set.
"""
pass
| (self, database: str) -> NoneType |
730,404 | chromadb.api | set_tenant | Set the tenant and database for the client. Raises an error if the tenant or
database does not exist.
Args:
tenant: The tenant to set.
database: The database to set.
| @abstractmethod
def set_tenant(self, tenant: str, database: str = DEFAULT_DATABASE) -> None:
"""Set the tenant and database for the client. Raises an error if the tenant or
database does not exist.
Args:
tenant: The tenant to set.
database: The database to set.
"""
pass
| (self, tenant: str, database: str = 'default_database') -> NoneType |
730,405 | chromadb.api.client | Client | A client for Chroma. This is the main entrypoint for interacting with Chroma.
A client internally stores its tenant and database and proxies calls to a
Server API instance of Chroma. It treats the Server API and corresponding System
as a singleton, so multiple clients connecting to the same resource will sh... | class Client(SharedSystemClient, ClientAPI):
"""A client for Chroma. This is the main entrypoint for interacting with Chroma.
A client internally stores its tenant and database and proxies calls to a
Server API instance of Chroma. It treats the Server API and corresponding System
as a singleton, so mult... | (tenant: str = 'default_tenant', database: str = 'default_database', settings: chromadb.config.Settings = Settings(environment='', chroma_api_impl='chromadb.api.segment.SegmentAPI', chroma_server_nofile=None, chroma_server_thread_pool_size=40, tenant_id='default', topic_namespace='default', chroma_server_host=None, chr... |
730,406 | chromadb.api.client | __init__ | null | def __init__(
self,
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
settings: Settings = Settings(),
) -> None:
super().__init__(settings=settings)
self.tenant = tenant
self.database = database
# Create an admin client for verifying that databases and tenants exist
se... | (self, tenant: str = 'default_tenant', database: str = 'default_database', settings: chromadb.config.Settings = Settings(environment='', chroma_api_impl='chromadb.api.segment.SegmentAPI', chroma_server_nofile=None, chroma_server_thread_pool_size=40, tenant_id='default', topic_namespace='default', chroma_server_host=Non... |
730,407 | chromadb.api.client | _add | [Internal] Add embeddings to a collection specified by UUID.
If (some) ids already exist, only the new embeddings will be added.
Args:
ids: The ids to associate with the embeddings.
collection_id: The UUID of the collection to add the embeddings to.
embedding: The se... | @override
def _add(
self,
ids: IDs,
collection_id: UUID,
embeddings: Embeddings,
metadatas: Optional[Metadatas] = None,
documents: Optional[Documents] = None,
uris: Optional[URIs] = None,
) -> bool:
return self._server._add(
ids=ids,
collection_id=collection_id,
e... | (self, ids: List[str], collection_id: uuid.UUID, embeddings: List[Union[Sequence[float], Sequence[int]]], metadatas: Optional[List[Mapping[str, Union[str, int, float, bool]]]] = None, documents: Optional[List[str]] = None, uris: Optional[List[str]] = None) -> bool |
730,408 | chromadb.api.client | _count | [Internal] Returns the number of entries in a collection specified by UUID.
Args:
collection_id: The UUID of the collection to count the embeddings in.
Returns:
int: The number of embeddings in the collection
| @override
def _count(self, collection_id: UUID) -> int:
return self._server._count(
collection_id=collection_id,
)
| (self, collection_id: uuid.UUID) -> int |
730,409 | chromadb.api.client | _delete | null | def _delete(
self,
collection_id: UUID,
ids: Optional[IDs],
where: Optional[Where] = {},
where_document: Optional[WhereDocument] = {},
) -> IDs:
return self._server._delete(
collection_id=collection_id,
ids=ids,
where=where,
where_document=where_document,
)
| (self, collection_id: uuid.UUID, ids: Optional[List[str]], where: Optional[Dict[Union[str, Literal['$and'], Literal['$or']], Union[str, int, float, bool, Dict[Union[Literal['$gt'], Literal['$gte'], Literal['$lt'], Literal['$lte'], Literal['$ne'], Literal['$eq'], Literal['$and'], Literal['$or']], Union[str, int, float, ... |
730,410 | chromadb.api.client | _get | [Internal] Returns entries from a collection specified by UUID.
Args:
ids: The IDs of the entries to get. Defaults to None.
where: Conditional filtering on metadata. Defaults to {}.
sort: The column to sort the entries by. Defaults to None.
limit: The maximum num... | @override
def _get(
self,
collection_id: UUID,
ids: Optional[IDs] = None,
where: Optional[Where] = {},
sort: Optional[str] = None,
limit: Optional[int] = None,
offset: Optional[int] = None,
page: Optional[int] = None,
page_size: Optional[int] = None,
where_document: Optional[Wher... | (self, collection_id: uuid.UUID, ids: Optional[List[str]] = None, where: Optional[Dict[Union[str, Literal['$and'], Literal['$or']], Union[str, int, float, bool, Dict[Union[Literal['$gt'], Literal['$gte'], Literal['$lt'], Literal['$lte'], Literal['$ne'], Literal['$eq'], Literal['$and'], Literal['$or']], Union[str, int, ... |
730,412 | chromadb.api.client | _modify | [Internal] Modify a collection by UUID. Can update the name and/or metadata.
Args:
id: The internal UUID of the collection to modify.
new_name: The new name of the collection.
If None, the existing name will remain. Defaults to None.
new_metad... | @override
def _modify(
self,
id: UUID,
new_name: Optional[str] = None,
new_metadata: Optional[CollectionMetadata] = None,
) -> None:
return self._server._modify(
id=id,
new_name=new_name,
new_metadata=new_metadata,
)
| (self, id: uuid.UUID, new_name: Optional[str] = None, new_metadata: Optional[Dict[str, Any]] = None) -> NoneType |
730,413 | chromadb.api.client | _peek | [Internal] Returns the first n entries in a collection specified by UUID.
Args:
collection_id: The UUID of the collection to peek into.
n: The number of entries to peek. Defaults to 10.
Returns:
GetResult: The first n entries in the collection.
| @override
def _peek(self, collection_id: UUID, n: int = 10) -> GetResult:
return self._server._peek(
collection_id=collection_id,
n=n,
)
| (self, collection_id: uuid.UUID, n: int = 10) -> chromadb.api.types.GetResult |
730,415 | chromadb.api.client | _query | [Internal] Performs a nearest neighbors query on a collection specified by UUID.
Args:
collection_id: The UUID of the collection to query.
query_embeddings: The embeddings to use as the query.
n_results: The number of results to return. Defaults to 10.
where: Con... | @override
def _query(
self,
collection_id: UUID,
query_embeddings: Embeddings,
n_results: int = 10,
where: Where = {},
where_document: WhereDocument = {},
include: Include = ["embeddings", "metadatas", "documents", "distances"],
) -> QueryResult:
return self._server._query(
colle... | (self, collection_id: uuid.UUID, query_embeddings: List[Union[Sequence[float], Sequence[int]]], n_results: int = 10, where: Dict[Union[str, Literal['$and'], Literal['$or']], Union[str, int, float, bool, Dict[Union[Literal['$gt'], Literal['$gte'], Literal['$lt'], Literal['$lte'], Literal['$ne'], Literal['$eq'], Literal[... |
730,416 | chromadb.api.client | _update | [Internal] Update entries in a collection specified by UUID.
Args:
collection_id: The UUID of the collection to update the embeddings in.
ids: The IDs of the entries to update.
embeddings: The sequence of embeddings to update. Defaults to None.
metadatas: The met... | @override
def _update(
self,
collection_id: UUID,
ids: IDs,
embeddings: Optional[Embeddings] = None,
metadatas: Optional[Metadatas] = None,
documents: Optional[Documents] = None,
uris: Optional[URIs] = None,
) -> bool:
return self._server._update(
collection_id=collection_id,
... | (self, collection_id: uuid.UUID, ids: List[str], embeddings: Optional[List[Union[Sequence[float], Sequence[int]]]] = None, metadatas: Optional[List[Mapping[str, Union[str, int, float, bool]]]] = None, documents: Optional[List[str]] = None, uris: Optional[List[str]] = None) -> bool |
730,417 | chromadb.api.client | _upsert | [Internal] Add or update entries in the a collection specified by UUID.
If an entry with the same id already exists, it will be updated,
otherwise it will be added.
Args:
collection_id: The collection to add the embeddings to
ids: The ids to associate with the embeddings... | @override
def _upsert(
self,
collection_id: UUID,
ids: IDs,
embeddings: Embeddings,
metadatas: Optional[Metadatas] = None,
documents: Optional[Documents] = None,
uris: Optional[URIs] = None,
) -> bool:
return self._server._upsert(
collection_id=collection_id,
ids=ids,
... | (self, collection_id: uuid.UUID, ids: List[str], embeddings: List[Union[Sequence[float], Sequence[int]]], metadatas: Optional[List[Mapping[str, Union[str, int, float, bool]]]] = None, documents: Optional[List[str]] = None, uris: Optional[List[str]] = None) -> bool |
730,418 | chromadb.api.client | _validate_tenant_database | null | def _validate_tenant_database(self, tenant: str, database: str) -> None:
try:
self._admin_client.get_tenant(name=tenant)
except requests.exceptions.ConnectionError:
raise ValueError(
"Could not connect to a Chroma server. Are you sure it is running?"
)
# Propagate ChromaE... | (self, tenant: str, database: str) -> NoneType |
730,420 | chromadb.api.client | count_collections | Count the number of collections.
Returns:
int: The number of collections.
Examples:
```python
client.count_collections()
# 1
```
| @override
def count_collections(self) -> int:
return self._server.count_collections(
tenant=self.tenant, database=self.database
)
| (self) -> int |
730,421 | chromadb.api.client | create_collection | Create a new collection with the given name and metadata.
Args:
name: The name of the collection to create.
metadata: Optional metadata to associate with the collection.
embedding_function: Optional function to use to embed documents.
Uses the ... | @override
def create_collection(
self,
name: str,
metadata: Optional[CollectionMetadata] = None,
embedding_function: Optional[
EmbeddingFunction[Embeddable]
] = ef.DefaultEmbeddingFunction(), # type: ignore
data_loader: Optional[DataLoader[Loadable]] = None,
get_or_create: bool = Fa... | (self, name: str, metadata: Optional[Dict[str, Any]] = None, embedding_function: Optional[chromadb.api.types.EmbeddingFunction[Union[List[str], List[numpy.ndarray[Any, numpy.dtype[Union[numpy.uint64, numpy.int64, numpy.float64]]]]]]] = <chromadb.utils.embedding_functions.ONNXMiniLM_L6_V2 object at 0x7fd508aebee0>, data... |
730,422 | chromadb.api.client | delete_collection | Delete a collection with the given name.
Args:
name: The name of the collection to delete.
Raises:
ValueError: If the collection does not exist.
Examples:
```python
client.delete_collection("my_collection")
```
| @override
def delete_collection(
self,
name: str,
) -> None:
return self._server.delete_collection(
name=name,
tenant=self.tenant,
database=self.database,
)
| (self, name: str) -> NoneType |
730,423 | chromadb.api.client | get_collection | Get a collection with the given name.
Args:
id: The UUID of the collection to get. Id and Name are simultaneously used for lookup if provided.
name: The name of the collection to get
embedding_function: Optional function to use to embed documents.
... | @override
def get_collection(
self,
name: str,
id: Optional[UUID] = None,
embedding_function: Optional[
EmbeddingFunction[Embeddable]
] = ef.DefaultEmbeddingFunction(), # type: ignore
data_loader: Optional[DataLoader[Loadable]] = None,
) -> Collection:
return self._server.get_collec... | (self, name: str, id: Optional[uuid.UUID] = None, embedding_function: Optional[chromadb.api.types.EmbeddingFunction[Union[List[str], List[numpy.ndarray[Any, numpy.dtype[Union[numpy.uint64, numpy.int64, numpy.float64]]]]]]] = <chromadb.utils.embedding_functions.ONNXMiniLM_L6_V2 object at 0x7fd509048d30>, data_loader: Op... |
730,424 | chromadb.api.client | get_or_create_collection | Get or create a collection with the given name and metadata.
Args:
name: The name of the collection to get or create
metadata: Optional metadata to associate with the collection. If
the collection alredy exists, the metadata will be updated if
provided and not Non... | @override
def get_or_create_collection(
self,
name: str,
metadata: Optional[CollectionMetadata] = None,
embedding_function: Optional[
EmbeddingFunction[Embeddable]
] = ef.DefaultEmbeddingFunction(), # type: ignore
data_loader: Optional[DataLoader[Loadable]] = None,
) -> Collection:
... | (self, name: str, metadata: Optional[Dict[str, Any]] = None, embedding_function: Optional[chromadb.api.types.EmbeddingFunction[Union[List[str], List[numpy.ndarray[Any, numpy.dtype[Union[numpy.uint64, numpy.int64, numpy.float64]]]]]]] = <chromadb.utils.embedding_functions.ONNXMiniLM_L6_V2 object at 0x7fd508ae9840>, data... |
730,425 | chromadb.api.client | get_settings | Get the settings used to initialize.
Returns:
Settings: The settings used to initialize.
| @override
def get_settings(self) -> Settings:
return self._server.get_settings()
| (self) -> chromadb.config.Settings |
730,426 | chromadb.api.client | get_version | Get the version of Chroma.
Returns:
str: The version of Chroma
| @override
def get_version(self) -> str:
return self._server.get_version()
| (self) -> str |
730,427 | chromadb.api.client | heartbeat | Get the current time in nanoseconds since epoch.
Used to check if the server is alive.
Returns:
int: The current time in nanoseconds since epoch
| @override
def heartbeat(self) -> int:
return self._server.heartbeat()
| (self) -> int |
730,428 | chromadb.api.client | list_collections | List all collections.
Args:
limit: The maximum number of entries to return. Defaults to None.
offset: The number of entries to skip before returning. Defaults to None.
Returns:
Sequence[Collection]: A list of collections
Examples:
```python
... | @override
def list_collections(
self, limit: Optional[int] = None, offset: Optional[int] = None
) -> Sequence[Collection]:
return self._server.list_collections(
limit, offset, tenant=self.tenant, database=self.database
)
| (self, limit: Optional[int] = None, offset: Optional[int] = None) -> Sequence[chromadb.api.models.Collection.Collection] |
730,429 | chromadb.api.client | reset | Resets the database. This will delete all collections and entries.
Returns:
bool: True if the database was reset successfully.
| @override
def reset(self) -> bool:
return self._server.reset()
| (self) -> bool |
730,430 | chromadb.api.client | set_database | Set the database for the client. Raises an error if the database does not exist.
Args:
database: The database to set.
| @override
def set_database(self, database: str) -> None:
self._validate_tenant_database(tenant=self.tenant, database=database)
self.database = database
| (self, database: str) -> NoneType |
730,431 | chromadb.api.client | set_tenant | Set the tenant and database for the client. Raises an error if the tenant or
database does not exist.
Args:
tenant: The tenant to set.
database: The database to set.
| @override
def set_tenant(self, tenant: str, database: str = DEFAULT_DATABASE) -> None:
self._validate_tenant_database(tenant=tenant, database=database)
self.tenant = tenant
self.database = database
| (self, tenant: str, database: str = 'default_database') -> NoneType |
730,432 | chromadb | CloudClient |
Creates a client to connect to a tennant and database on the Chroma cloud.
Args:
tenant: The tenant to use for this client.
database: The database to use for this client.
api_key: The api key to use for this client.
| def CloudClient(
tenant: str,
database: str,
api_key: Optional[str] = None,
settings: Optional[Settings] = None,
*, # Following arguments are keyword-only, intended for testing only.
cloud_host: str = "api.trychroma.com",
cloud_port: int = 8000,
enable_ssl: bool = True,
) -> ClientAPI:
... | (tenant: str, database: str, api_key: Optional[str] = None, settings: Optional[chromadb.config.Settings] = None, *, cloud_host: str = 'api.trychroma.com', cloud_port: int = 8000, enable_ssl: bool = True) -> chromadb.api.ClientAPI |
730,433 | chromadb.api.models.Collection | Collection | null | class Collection(BaseModel):
name: str
id: UUID
metadata: Optional[CollectionMetadata] = None
tenant: Optional[str] = None
database: Optional[str] = None
_client: "ServerAPI" = PrivateAttr()
_embedding_function: Optional[EmbeddingFunction[Embeddable]] = PrivateAttr()
_data_loader: Option... | (client: 'ServerAPI', name: str, id: uuid.UUID, embedding_function: Optional[chromadb.api.types.EmbeddingFunction[Union[List[str], List[numpy.ndarray[Any, numpy.dtype[Union[numpy.uint64, numpy.int64, numpy.float64]]]]]]] = <chromadb.utils.embedding_functions.ONNXMiniLM_L6_V2 object at 0x7fd508aead70>, data_loader: Opti... |
730,440 | chromadb.api.models.Collection | __init__ | null | def __init__(
self,
client: "ServerAPI",
name: str,
id: UUID,
embedding_function: Optional[
EmbeddingFunction[Embeddable]
] = ef.DefaultEmbeddingFunction(), # type: ignore
data_loader: Optional[DataLoader[Loadable]] = None,
tenant: Optional[str] = None,
database: Optional[st... | (self, client: 'ServerAPI', name: str, id: uuid.UUID, embedding_function: Optional[chromadb.api.types.EmbeddingFunction[Union[List[str], List[numpy.ndarray[Any, numpy.dtype[Union[numpy.uint64, numpy.int64, numpy.float64]]]]]]] = <chromadb.utils.embedding_functions.ONNXMiniLM_L6_V2 object at 0x7fd508aead70>, data_loader... |
730,454 | chromadb.api.models.Collection | _embed | null | def _embed(self, input: Any) -> Embeddings:
if self._embedding_function is None:
raise ValueError(
"You must provide an embedding function to compute embeddings."
"https://docs.trychroma.com/embeddings"
)
return self._embedding_function(input=input)
| (self, input: Any) -> List[Union[Sequence[float], Sequence[int]]] |
730,456 | chromadb.api.models.Collection | _normalize_embeddings | null | @staticmethod
def _normalize_embeddings(
embeddings: Union[
OneOrMany[Embedding],
OneOrMany[np.ndarray],
]
) -> Embeddings:
if isinstance(embeddings, np.ndarray):
return embeddings.tolist()
return embeddings
| (embeddings: Union[Sequence[float], Sequence[int], List[Union[Sequence[float], Sequence[int]]], numpy.ndarray, List[numpy.ndarray]]) -> List[Union[Sequence[float], Sequence[int]]] |
730,457 | chromadb.api.models.Collection | _validate_embedding_set | null | def _validate_embedding_set(
self,
ids: OneOrMany[ID],
embeddings: Optional[
Union[
OneOrMany[Embedding],
OneOrMany[np.ndarray],
]
],
metadatas: Optional[OneOrMany[Metadata]],
documents: Optional[OneOrMany[Document]],
images: Optional[OneOrMany[Image]]... | (self, ids: Union[str, List[str]], embeddings: Union[Sequence[float], Sequence[int], List[Union[Sequence[float], Sequence[int]]], numpy.ndarray, List[numpy.ndarray], NoneType], metadatas: Union[Mapping[str, Union[str, int, float, bool]], List[Mapping[str, Union[str, int, float, bool]]], NoneType], documents: Union[str,... |
730,458 | chromadb.api.models.Collection | add | Add embeddings to the data store.
Args:
ids: The ids of the embeddings you wish to add
embeddings: The embeddings to add. If None, embeddings will be computed based on the documents or images using the embedding_function set for the Collection. Optional.
metadatas: The metada... | def add(
self,
ids: OneOrMany[ID],
embeddings: Optional[
Union[
OneOrMany[Embedding],
OneOrMany[np.ndarray],
]
] = None,
metadatas: Optional[OneOrMany[Metadata]] = None,
documents: Optional[OneOrMany[Document]] = None,
images: Optional[OneOrMany[Image]... | (self, ids: Union[str, List[str]], embeddings: Union[Sequence[float], Sequence[int], List[Union[Sequence[float], Sequence[int]]], numpy.ndarray, List[numpy.ndarray], NoneType] = None, metadatas: Union[Mapping[str, Union[str, int, float, bool]], List[Mapping[str, Union[str, int, float, bool]]], NoneType] = None, documen... |
730,460 | chromadb.api.models.Collection | count | The total number of embeddings added to the database
Returns:
int: The total number of embeddings added to the database
| def count(self) -> int:
"""The total number of embeddings added to the database
Returns:
int: The total number of embeddings added to the database
"""
return self._client._count(collection_id=self.id)
| (self) -> int |
730,461 | chromadb.api.models.Collection | delete | Delete the embeddings based on ids and/or a where filter
Args:
ids: The ids of the embeddings to delete
where: A Where type dict used to filter the delection by. E.g. `{"$and": ["color" : "red", "price": {"$gte": 4.20}]}`. Optional.
where_document: A WhereDocument type dict ... | def delete(
self,
ids: Optional[IDs] = None,
where: Optional[Where] = None,
where_document: Optional[WhereDocument] = None,
) -> None:
"""Delete the embeddings based on ids and/or a where filter
Args:
ids: The ids of the embeddings to delete
where: A Where type dict used to filte... | (self, ids: Optional[List[str]] = None, where: Optional[Dict[Union[str, Literal['$and'], Literal['$or']], Union[str, int, float, bool, Dict[Union[Literal['$gt'], Literal['$gte'], Literal['$lt'], Literal['$lte'], Literal['$ne'], Literal['$eq'], Literal['$and'], Literal['$or']], Union[str, int, float, bool]], Dict[Union[... |
730,463 | chromadb.api.models.Collection | get | Get embeddings and their associate data from the data store. If no ids or where filter is provided returns
all embeddings up to limit starting at offset.
Args:
ids: The ids of the embeddings to get. Optional.
where: A Where type dict used to filter results by. E.g. `{"$and": ["c... | def get(
self,
ids: Optional[OneOrMany[ID]] = None,
where: Optional[Where] = None,
limit: Optional[int] = None,
offset: Optional[int] = None,
where_document: Optional[WhereDocument] = None,
include: Include = ["metadatas", "documents"],
) -> GetResult:
"""Get embeddings and their associa... | (self, ids: Union[str, List[str], NoneType] = None, where: Optional[Dict[Union[str, Literal['$and'], Literal['$or']], Union[str, int, float, bool, Dict[Union[Literal['$gt'], Literal['$gte'], Literal['$lt'], Literal['$lte'], Literal['$ne'], Literal['$eq'], Literal['$and'], Literal['$or']], Union[str, int, float, bool]],... |
730,469 | chromadb.api.models.Collection | modify | Modify the collection name or metadata
Args:
name: The updated name for the collection. Optional.
metadata: The updated metadata for the collection. Optional.
Returns:
None
| def modify(
self, name: Optional[str] = None, metadata: Optional[CollectionMetadata] = None
) -> None:
"""Modify the collection name or metadata
Args:
name: The updated name for the collection. Optional.
metadata: The updated metadata for the collection. Optional.
Returns:
None
... | (self, name: Optional[str] = None, metadata: Optional[Dict[str, Any]] = None) -> NoneType |
730,470 | chromadb.api.models.Collection | peek | Get the first few results in the database up to limit
Args:
limit: The number of results to return.
Returns:
GetResult: A GetResult object containing the results.
| def peek(self, limit: int = 10) -> GetResult:
"""Get the first few results in the database up to limit
Args:
limit: The number of results to return.
Returns:
GetResult: A GetResult object containing the results.
"""
return self._client._peek(self.id, limit)
| (self, limit: int = 10) -> chromadb.api.types.GetResult |
730,471 | chromadb.api.models.Collection | query | Get the n_results nearest neighbor embeddings for provided query_embeddings or query_texts.
Args:
query_embeddings: The embeddings to get the closes neighbors of. Optional.
query_texts: The document texts to get the closes neighbors of. Optional.
query_images: The images to ... | def query(
self,
query_embeddings: Optional[
Union[
OneOrMany[Embedding],
OneOrMany[np.ndarray],
]
] = None,
query_texts: Optional[OneOrMany[Document]] = None,
query_images: Optional[OneOrMany[Image]] = None,
query_uris: Optional[OneOrMany[URI]] = None,
... | (self, query_embeddings: Union[Sequence[float], Sequence[int], List[Union[Sequence[float], Sequence[int]]], numpy.ndarray, List[numpy.ndarray], NoneType] = None, query_texts: Union[str, List[str], NoneType] = None, query_images: Union[numpy.ndarray[Any, numpy.dtype[Union[numpy.uint64, numpy.int64, numpy.float64]]], Lis... |
730,472 | chromadb.api.models.Collection | update | Update the embeddings, metadatas or documents for provided ids.
Args:
ids: The ids of the embeddings to update
embeddings: The embeddings to update. If None, embeddings will be computed based on the documents or images using the embedding_function set for the Collection. Optional.
... | def update(
self,
ids: OneOrMany[ID],
embeddings: Optional[
Union[
OneOrMany[Embedding],
OneOrMany[np.ndarray],
]
] = None,
metadatas: Optional[OneOrMany[Metadata]] = None,
documents: Optional[OneOrMany[Document]] = None,
images: Optional[OneOrMany[Ima... | (self, ids: Union[str, List[str]], embeddings: Union[Sequence[float], Sequence[int], List[Union[Sequence[float], Sequence[int]]], numpy.ndarray, List[numpy.ndarray], NoneType] = None, metadatas: Union[Mapping[str, Union[str, int, float, bool]], List[Mapping[str, Union[str, int, float, bool]]], NoneType] = None, documen... |
730,473 | chromadb.api.models.Collection | upsert | Update the embeddings, metadatas or documents for provided ids, or create them if they don't exist.
Args:
ids: The ids of the embeddings to update
embeddings: The embeddings to add. If None, embeddings will be computed based on the documents using the embedding_function set for the Coll... | def upsert(
self,
ids: OneOrMany[ID],
embeddings: Optional[
Union[
OneOrMany[Embedding],
OneOrMany[np.ndarray],
]
] = None,
metadatas: Optional[OneOrMany[Metadata]] = None,
documents: Optional[OneOrMany[Document]] = None,
images: Optional[OneOrMany[Ima... | (self, ids: Union[str, List[str]], embeddings: Union[Sequence[float], Sequence[int], List[Union[Sequence[float], Sequence[int]]], numpy.ndarray, List[numpy.ndarray], NoneType] = None, metadatas: Union[Mapping[str, Union[str, int, float, bool]], List[Mapping[str, Union[str, int, float, bool]]], NoneType] = None, documen... |
730,474 | chromadb.api.types | EmbeddingFunction | null | class EmbeddingFunction(Protocol[D]):
def __call__(self, input: D) -> Embeddings:
...
def __init_subclass__(cls) -> None:
super().__init_subclass__()
# Raise an exception if __call__ is not defined since it is expected to be defined
call = getattr(cls, "__call__")
def _... | (*args, **kwargs) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.