Skip to content

Commit

Permalink
Revert "[ENH] Multimodal Embeddings" (#1344)
Browse files Browse the repository at this point in the history
Reverts #1293
  • Loading branch information
atroyn authored Nov 7, 2023
1 parent 4db9955 commit 69cd2ba
Show file tree
Hide file tree
Showing 12 changed files with 186 additions and 696 deletions.
29 changes: 8 additions & 21 deletions chromadb/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from chromadb.api.types import (
CollectionMetadata,
Documents,
Embeddable,
EmbeddingFunction,
Embeddings,
IDs,
Expand Down Expand Up @@ -59,9 +58,7 @@ def create_collection(
self,
name: str,
metadata: Optional[CollectionMetadata] = None,
embedding_function: Optional[
EmbeddingFunction[Embeddable]
] = ef.DefaultEmbeddingFunction(), # type: ignore
embedding_function: Optional[EmbeddingFunction] = ef.DefaultEmbeddingFunction(),
get_or_create: bool = False,
) -> Collection:
"""Create a new collection with the given name and metadata.
Expand Down Expand Up @@ -93,11 +90,9 @@ def create_collection(
@abstractmethod
def get_collection(
self,
name: str,
name: Optional[str] = None,
id: Optional[UUID] = None,
embedding_function: Optional[
EmbeddingFunction[Embeddable]
] = ef.DefaultEmbeddingFunction(), # type: ignore
embedding_function: Optional[EmbeddingFunction] = ef.DefaultEmbeddingFunction(),
) -> Collection:
"""Get a collection with the given name.
Args:
Expand All @@ -124,9 +119,7 @@ def get_or_create_collection(
self,
name: str,
metadata: Optional[CollectionMetadata] = None,
embedding_function: Optional[
EmbeddingFunction[Embeddable]
] = ef.DefaultEmbeddingFunction(), # type: ignore
embedding_function: Optional[EmbeddingFunction] = ef.DefaultEmbeddingFunction(),
) -> Collection:
"""Get or create a collection with the given name and metadata.
Args:
Expand Down Expand Up @@ -493,9 +486,7 @@ def create_collection(
self,
name: str,
metadata: Optional[CollectionMetadata] = None,
embedding_function: Optional[
EmbeddingFunction[Embeddable]
] = ef.DefaultEmbeddingFunction(), # type: ignore
embedding_function: Optional[EmbeddingFunction] = ef.DefaultEmbeddingFunction(),
get_or_create: bool = False,
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
Expand All @@ -506,11 +497,9 @@ def create_collection(
@override
def get_collection(
self,
name: str,
name: Optional[str] = None,
id: Optional[UUID] = None,
embedding_function: Optional[
EmbeddingFunction[Embeddable]
] = ef.DefaultEmbeddingFunction(), # type: ignore
embedding_function: Optional[EmbeddingFunction] = ef.DefaultEmbeddingFunction(),
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
) -> Collection:
Expand All @@ -522,9 +511,7 @@ def get_or_create_collection(
self,
name: str,
metadata: Optional[CollectionMetadata] = None,
embedding_function: Optional[
EmbeddingFunction[Embeddable]
] = ef.DefaultEmbeddingFunction(), # type: ignore
embedding_function: Optional[EmbeddingFunction] = ef.DefaultEmbeddingFunction(),
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
) -> Collection:
Expand Down
39 changes: 15 additions & 24 deletions chromadb/api/fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from chromadb.api.models.Collection import Collection
from chromadb.api.types import (
Documents,
Embeddable,
Embeddings,
EmbeddingFunction,
IDs,
Expand Down Expand Up @@ -220,9 +219,7 @@ def create_collection(
self,
name: str,
metadata: Optional[CollectionMetadata] = None,
embedding_function: Optional[
EmbeddingFunction[Embeddable]
] = ef.DefaultEmbeddingFunction(), # type: ignore
embedding_function: Optional[EmbeddingFunction] = ef.DefaultEmbeddingFunction(),
get_or_create: bool = False,
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
Expand Down Expand Up @@ -253,9 +250,9 @@ def create_collection(
@override
def get_collection(
self,
name: str,
name: Optional[str] = None,
id: Optional[UUID] = None,
embedding_function: Optional[EmbeddingFunction[Embeddable]] = ef.DefaultEmbeddingFunction(), # type: ignore
embedding_function: Optional[EmbeddingFunction] = ef.DefaultEmbeddingFunction(),
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
) -> Collection:
Expand Down Expand Up @@ -287,20 +284,17 @@ def get_or_create_collection(
self,
name: str,
metadata: Optional[CollectionMetadata] = None,
embedding_function: Optional[EmbeddingFunction[Embeddable]] = ef.DefaultEmbeddingFunction(), # type: ignore
embedding_function: Optional[EmbeddingFunction] = ef.DefaultEmbeddingFunction(),
tenant: str = DEFAULT_TENANT,
database: str = DEFAULT_DATABASE,
) -> Collection:
return cast(
Collection,
self.create_collection(
name,
metadata,
embedding_function,
get_or_create=True,
tenant=tenant,
database=database,
),
return self.create_collection(
name,
metadata,
embedding_function,
get_or_create=True,
tenant=tenant,
database=database,
)

@trace_method("FastAPI._modify", OpenTelemetryGranularity.OPERATION)
Expand Down Expand Up @@ -353,13 +347,10 @@ def _peek(
collection_id: UUID,
n: int = 10,
) -> GetResult:
return cast(
GetResult,
self._get(
collection_id,
limit=n,
include=["embeddings", "documents", "metadatas"],
),
return self._get(
collection_id,
limit=n,
include=["embeddings", "documents", "metadatas"],
)

@trace_method("FastAPI._get", OpenTelemetryGranularity.OPERATION)
Expand Down
Loading

0 comments on commit 69cd2ba

Please sign in to comment.