Gets the collection. Get embeddings and their associated data from the data store. If no constraints provided returns all embeddings up to limit. Args: constraints: A dict used to filter results by. E.g. `{"color" : ["==", "red"], "price": [">"
(
self,
collection_name: str,
constraints: Optional[Dict] = None,
limit: Optional[int] = None,
include: List[str] = ["metadata"],
)
| 883 | return vdms_collection |
| 884 | |
| 885 | def get( |
| 886 | self, |
| 887 | collection_name: str, |
| 888 | constraints: Optional[Dict] = None, |
| 889 | limit: Optional[int] = None, |
| 890 | include: List[str] = ["metadata"], |
| 891 | ) -> Tuple[Any, Any]: |
| 892 | """Gets the collection. |
| 893 | Get embeddings and their associated data from the data store. |
| 894 | If no constraints provided returns all embeddings up to limit. |
| 895 | |
| 896 | Args: |
| 897 | constraints: A dict used to filter results by. |
| 898 | E.g. `{"color" : ["==", "red"], "price": [">", 4.00]}`. Optional. |
| 899 | limit: The number of documents to return. Optional. |
| 900 | include: A list of what to include in the results. |
| 901 | Can contain `"embeddings"`, `"metadatas"`, `"documents"`. |
| 902 | Ids are always included. |
| 903 | Defaults to `["metadatas", "documents"]`. Optional. |
| 904 | """ |
| 905 | all_queries: List[Any] = [] |
| 906 | all_blobs: List[Any] = [] |
| 907 | |
| 908 | results: Dict[str, Any] = {"count": ""} |
| 909 | |
| 910 | if limit is not None: |
| 911 | results["limit"] = limit |
| 912 | |
| 913 | # Include metadata |
| 914 | if "metadata" in include: |
| 915 | collection_properties = self.__get_properties(collection_name) |
| 916 | results["list"] = collection_properties |
| 917 | |
| 918 | # Include embedding |
| 919 | if "embeddings" in include: |
| 920 | results["blob"] = True |
| 921 | |
| 922 | query = _add_descriptor( |
| 923 | "FindDescriptor", |
| 924 | collection_name, |
| 925 | k_neighbors=None, |
| 926 | constraints=constraints, |
| 927 | results=results, |
| 928 | ) |
| 929 | |
| 930 | all_queries.append(query) |
| 931 | |
| 932 | response, response_array = self.__run_vdms_query(all_queries, all_blobs) |
| 933 | return response, response_array |
| 934 | |
| 935 | def max_marginal_relevance_search( |
| 936 | self, |