--- license: mit --- # Table of Contents * [run](#run) * [ChromaDBFlow](#ChromaDBFlow) * [ChromaDBFlow](#ChromaDBFlow.ChromaDBFlow) * [instantiate\_from\_config](#ChromaDBFlow.ChromaDBFlow.instantiate_from_config) * [get\_input\_keys](#ChromaDBFlow.ChromaDBFlow.get_input_keys) * [get\_output\_keys](#ChromaDBFlow.ChromaDBFlow.get_output_keys) * [run](#ChromaDBFlow.ChromaDBFlow.run) * [VectorStoreFlow](#VectorStoreFlow) * [VectorStoreFlow](#VectorStoreFlow.VectorStoreFlow) * [instantiate\_from\_config](#VectorStoreFlow.VectorStoreFlow.instantiate_from_config) * [package\_documents](#VectorStoreFlow.VectorStoreFlow.package_documents) * [run](#VectorStoreFlow.VectorStoreFlow.run) * [\_\_init\_\_](#__init__) # run # ChromaDBFlow ## ChromaDBFlow Objects ```python class ChromaDBFlow(AtomicFlow) ``` A flow that uses the ChromaDB model to write and read memories stored in a database *Configuration Parameters*: - `name` (str): The name of the flow. Default: "chroma_db" - `description` (str): A description of the flow. This description is used to generate the help message of the flow. Default: "ChromaDB is a document store that uses vector embeddings to store and retrieve documents." - `backend` (Dict[str, Any]): The configuration of the backend which is used to fetch api keys. Default: LiteLLMBackend with the default parameters of LiteLLMBackend (see aiflows.backends.LiteLLMBackend). Except for the following parameter whose default value is overwritten: - `api_infos` (List[Dict[str, Any]]): The list of api infos. Default: No default value, this parameter is required. - `model_name` (str): The name of the model. Default: "". In the current implementation, this parameter is not used. - `n_results` (int): The number of results to retrieve when reading from the database. Default: 5 - Other parameters are inherited from the default configuration of AtomicFlow (see AtomicFlow) *Input Interface*: - `operation` (str): The operation to perform. It can be "write" or "read". - `content` (str or List[str]): The content to write or read. If operation is "write", it must be a string or a list of strings. If operation is "read", it must be a string. *Output Interface*: - `retrieved` (str or List[str]): The retrieved content. If operation is "write", it is an empty string. If operation is "read", it is a string or a list of strings. **Arguments**: - `backend` (`LiteLLMBackend`): The backend of the flow (used to retrieve the API key) - `\**kwargs`: Additional arguments to pass to the flow. #### instantiate\_from\_config ```python @classmethod def instantiate_from_config(cls, config) ``` This method instantiates the flow from a configuration file **Arguments**: - `config` (`Dict[str, Any]`): The configuration of the flow. **Returns**: `ChromaDBFlow`: The instantiated flow. #### get\_input\_keys ```python def get_input_keys() -> List[str] ``` This method returns the input keys of the flow. **Returns**: `List[str]`: The input keys of the flow. #### get\_output\_keys ```python def get_output_keys() -> List[str] ``` This method returns the output keys of the flow. **Returns**: `List[str]`: The output keys of the flow. #### run ```python def run(input_data: Dict[str, Any]) -> Dict[str, Any] ``` This method runs the flow. It runs the ChromaDBFlow. It either writes or reads memories from the database. **Arguments**: - `input_data` (`Dict[str, Any]`): The input data of the flow. **Returns**: `Dict[str, Any]`: The output data of the flow. # VectorStoreFlow ## VectorStoreFlow Objects ```python class VectorStoreFlow(AtomicFlow) ``` A flow that uses the VectorStore model to write and read memories stored in a database (see VectorStoreFlow.yaml for the default configuration) *Configuration Parameters*: - `name` (str): The name of the flow. Default: "VecotrStoreFlow" - `description` (str): A description of the flow. This description is used to generate the help message of the flow. Default: "VectorStoreFlow" - `backend` (Dict[str, Any]): The configuration of the backend which is used to fetch api keys. Default: LiteLLMBackend with the default parameters of LiteLLMBackend (see aiflows.backends.LiteLLMBackend). Except for the following parameter whose default value is overwritten: - `api_infos` (List[Dict[str, Any]]): The list of api infos. Default: No default value, this parameter is required. - `model_name` (str): The name of the model. Default: "". In the current implementation, this parameter is not used. - `type` (str): The type of the vector store. It can be "chroma" or "faiss". Default: "chroma" - `embedding_size` (int): The size of the embeddings (only for faiss). Default: 1536 - `retriever_config` (Dict[str, Any]): The configuration of the retriever. Default: empty dictionary - Other parameters are inherited from the default configuration of AtomicFlow (see AtomicFlow) *Input Interface*: - `operation` (str): The operation to perform. It can be "write" or "read". - `content` (str or List[str]): The content to write or read. If operation is "write", it must be a string or a list of strings. If operation is "read", it must be a string. *Output Interface*: - `retrieved` (str or List[str]): The retrieved content. If operation is "write", it is an empty string. If operation is "read", it is a string or a list of strings. **Arguments**: - `backend` (`LiteLLMBackend`): The backend of the flow (used to retrieve the API key) - `vector_db` (`VectorStoreRetriever`): The vector store retriever - `type` (`str`): The type of the vector store - `\**kwargs`: Additional arguments to pass to the flow. See :class:`aiflows.base_flows.AtomicFlow` for more details. #### instantiate\_from\_config ```python @classmethod def instantiate_from_config(cls, config: Dict[str, Any]) ``` This method instantiates the flow from a configuration file **Arguments**: - `config` (`Dict[str, Any]`): The configuration of the flow. **Returns**: `VectorStoreFlow`: The instantiated flow. #### package\_documents ```python @staticmethod def package_documents(documents: List[str]) -> List[Document] ``` This method packages the documents in a list of Documents. **Arguments**: - `documents` (`List[str]`): The documents to package. **Returns**: `List[Document]`: The packaged documents. #### run ```python def run(input_data: Dict[str, Any]) -> Dict[str, Any] ``` This method runs the flow. It either writes or reads memories from the database. **Arguments**: - `input_data` (`Dict[str, Any]`): The input data of the flow. **Returns**: `Dict[str, Any]`: The output data of the flow. # \_\_init\_\_