File size: 7,240 Bytes
692f5d1 c415e05 bfb6e70 c415e05 bfb6e70 c415e05 bfb6e70 c415e05 bfb6e70 c415e05 bfb6e70 c415e05 bfb6e70 c415e05 bfb6e70 c415e05 bfb6e70 c415e05 bfb6e70 c415e05 0b084fa c415e05 0b084fa c415e05 0b084fa c415e05 bfb6e70 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
---
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__)
<a id="run"></a>
# run
<a id="ChromaDBFlow"></a>
# ChromaDBFlow
<a id="ChromaDBFlow.ChromaDBFlow"></a>
## 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.
<a id="ChromaDBFlow.ChromaDBFlow.instantiate_from_config"></a>
#### 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.
<a id="ChromaDBFlow.ChromaDBFlow.get_input_keys"></a>
#### 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.
<a id="ChromaDBFlow.ChromaDBFlow.get_output_keys"></a>
#### 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.
<a id="ChromaDBFlow.ChromaDBFlow.run"></a>
#### 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.
<a id="VectorStoreFlow"></a>
# VectorStoreFlow
<a id="VectorStoreFlow.VectorStoreFlow"></a>
## 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.
<a id="VectorStoreFlow.VectorStoreFlow.instantiate_from_config"></a>
#### 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.
<a id="VectorStoreFlow.VectorStoreFlow.package_documents"></a>
#### 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.
<a id="VectorStoreFlow.VectorStoreFlow.run"></a>
#### 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.
<a id="__init__"></a>
# \_\_init\_\_
|