renamed flows to aiflow
Browse files- ChromaDBFlow.py +2 -2
- ChromaDBFlow.yaml +1 -1
- README.md +3 -3
- VectorStoreFlow.py +2 -2
- VectorStoreFlow.yaml +1 -1
- demo.yaml +15 -15
- run.py +7 -7
ChromaDBFlow.py
CHANGED
|
@@ -7,7 +7,7 @@ from langchain.embeddings import OpenAIEmbeddings
|
|
| 7 |
|
| 8 |
from chromadb import Client as ChromaClient
|
| 9 |
|
| 10 |
-
from
|
| 11 |
|
| 12 |
import hydra
|
| 13 |
|
|
@@ -20,7 +20,7 @@ class ChromaDBFlow(AtomicFlow):
|
|
| 20 |
- `description` (str): A description of the flow. This description is used to generate the help message of the flow.
|
| 21 |
Default: "ChromaDB is a document store that uses vector embeddings to store and retrieve documents."
|
| 22 |
- `backend` (Dict[str, Any]): The configuration of the backend which is used to fetch api keys. Default: LiteLLMBackend with the
|
| 23 |
-
default parameters of LiteLLMBackend (see
|
| 24 |
- `api_infos` (List[Dict[str, Any]]): The list of api infos. Default: No default value, this parameter is required.
|
| 25 |
- `model_name` (str): The name of the model. Default: "". In the current implementation, this parameter is not used.
|
| 26 |
- `n_results` (int): The number of results to retrieve when reading from the database. Default: 5
|
|
|
|
| 7 |
|
| 8 |
from chromadb import Client as ChromaClient
|
| 9 |
|
| 10 |
+
from aiflows.base_flows import AtomicFlow
|
| 11 |
|
| 12 |
import hydra
|
| 13 |
|
|
|
|
| 20 |
- `description` (str): A description of the flow. This description is used to generate the help message of the flow.
|
| 21 |
Default: "ChromaDB is a document store that uses vector embeddings to store and retrieve documents."
|
| 22 |
- `backend` (Dict[str, Any]): The configuration of the backend which is used to fetch api keys. Default: LiteLLMBackend with the
|
| 23 |
+
default parameters of LiteLLMBackend (see aiflows.backends.LiteLLMBackend). Except for the following parameter whose default value is overwritten:
|
| 24 |
- `api_infos` (List[Dict[str, Any]]): The list of api infos. Default: No default value, this parameter is required.
|
| 25 |
- `model_name` (str): The name of the model. Default: "". In the current implementation, this parameter is not used.
|
| 26 |
- `n_results` (int): The number of results to retrieve when reading from the database. Default: 5
|
ChromaDBFlow.yaml
CHANGED
|
@@ -2,7 +2,7 @@ name: chroma_db
|
|
| 2 |
description: ChromaDB is a document store that uses vector embeddings to store and retrieve documents
|
| 3 |
|
| 4 |
backend:
|
| 5 |
-
_target_:
|
| 6 |
api_infos: ???
|
| 7 |
model_name: "" #Not used in current implementation
|
| 8 |
input_interface:
|
|
|
|
| 2 |
description: ChromaDB is a document store that uses vector embeddings to store and retrieve documents
|
| 3 |
|
| 4 |
backend:
|
| 5 |
+
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
| 6 |
api_infos: ???
|
| 7 |
model_name: "" #Not used in current implementation
|
| 8 |
input_interface:
|
README.md
CHANGED
|
@@ -42,7 +42,7 @@ A flow that uses the ChromaDB model to write and read memories stored in a datab
|
|
| 42 |
- `description` (str): A description of the flow. This description is used to generate the help message of the flow.
|
| 43 |
Default: "ChromaDB is a document store that uses vector embeddings to store and retrieve documents."
|
| 44 |
- `backend` (Dict[str, Any]): The configuration of the backend which is used to fetch api keys. Default: LiteLLMBackend with the
|
| 45 |
-
default parameters of LiteLLMBackend (see
|
| 46 |
- `api_infos` (List[Dict[str, Any]]): The list of api infos. Default: No default value, this parameter is required.
|
| 47 |
- `model_name` (str): The name of the model. Default: "". In the current implementation, this parameter is not used.
|
| 48 |
- `n_results` (int): The number of results to retrieve when reading from the database. Default: 5
|
|
@@ -147,7 +147,7 @@ A flow that uses the VectorStore model to write and read memories stored in a da
|
|
| 147 |
- `description` (str): A description of the flow. This description is used to generate the help message of the flow.
|
| 148 |
Default: "VectorStoreFlow"
|
| 149 |
- `backend` (Dict[str, Any]): The configuration of the backend which is used to fetch api keys. Default: LiteLLMBackend with the
|
| 150 |
-
default parameters of LiteLLMBackend (see
|
| 151 |
- `api_infos` (List[Dict[str, Any]]): The list of api infos. Default: No default value, this parameter is required.
|
| 152 |
- `model_name` (str): The name of the model. Default: "". In the current implementation, this parameter is not used.
|
| 153 |
- `type` (str): The type of the vector store. It can be "chroma" or "faiss". Default: "chroma"
|
|
@@ -169,7 +169,7 @@ default parameters of LiteLLMBackend (see flows.backends.LiteLLMBackend). Except
|
|
| 169 |
- `backend` (`LiteLLMBackend`): The backend of the flow (used to retrieve the API key)
|
| 170 |
- `vector_db` (`VectorStoreRetriever`): The vector store retriever
|
| 171 |
- `type` (`str`): The type of the vector store
|
| 172 |
-
- `\**kwargs`: Additional arguments to pass to the flow. See :class:`
|
| 173 |
|
| 174 |
<a id="VectorStoreFlow.VectorStoreFlow.instantiate_from_config"></a>
|
| 175 |
|
|
|
|
| 42 |
- `description` (str): A description of the flow. This description is used to generate the help message of the flow.
|
| 43 |
Default: "ChromaDB is a document store that uses vector embeddings to store and retrieve documents."
|
| 44 |
- `backend` (Dict[str, Any]): The configuration of the backend which is used to fetch api keys. Default: LiteLLMBackend with the
|
| 45 |
+
default parameters of LiteLLMBackend (see aiflows.backends.LiteLLMBackend). Except for the following parameter whose default value is overwritten:
|
| 46 |
- `api_infos` (List[Dict[str, Any]]): The list of api infos. Default: No default value, this parameter is required.
|
| 47 |
- `model_name` (str): The name of the model. Default: "". In the current implementation, this parameter is not used.
|
| 48 |
- `n_results` (int): The number of results to retrieve when reading from the database. Default: 5
|
|
|
|
| 147 |
- `description` (str): A description of the flow. This description is used to generate the help message of the flow.
|
| 148 |
Default: "VectorStoreFlow"
|
| 149 |
- `backend` (Dict[str, Any]): The configuration of the backend which is used to fetch api keys. Default: LiteLLMBackend with the
|
| 150 |
+
default parameters of LiteLLMBackend (see aiflows.backends.LiteLLMBackend). Except for the following parameter whose default value is overwritten:
|
| 151 |
- `api_infos` (List[Dict[str, Any]]): The list of api infos. Default: No default value, this parameter is required.
|
| 152 |
- `model_name` (str): The name of the model. Default: "". In the current implementation, this parameter is not used.
|
| 153 |
- `type` (str): The type of the vector store. It can be "chroma" or "faiss". Default: "chroma"
|
|
|
|
| 169 |
- `backend` (`LiteLLMBackend`): The backend of the flow (used to retrieve the API key)
|
| 170 |
- `vector_db` (`VectorStoreRetriever`): The vector store retriever
|
| 171 |
- `type` (`str`): The type of the vector store
|
| 172 |
+
- `\**kwargs`: Additional arguments to pass to the flow. See :class:`aiflows.base_flows.AtomicFlow` for more details.
|
| 173 |
|
| 174 |
<a id="VectorStoreFlow.VectorStoreFlow.instantiate_from_config"></a>
|
| 175 |
|
VectorStoreFlow.py
CHANGED
|
@@ -9,7 +9,7 @@ from langchain.schema import Document
|
|
| 9 |
from langchain.vectorstores import Chroma, FAISS
|
| 10 |
from langchain.vectorstores.base import VectorStoreRetriever
|
| 11 |
|
| 12 |
-
from
|
| 13 |
import hydra
|
| 14 |
|
| 15 |
|
|
@@ -45,7 +45,7 @@ class VectorStoreFlow(AtomicFlow):
|
|
| 45 |
:type vector_db: VectorStoreRetriever
|
| 46 |
:param type: The type of the vector store
|
| 47 |
:type type: str
|
| 48 |
-
:param \**kwargs: Additional arguments to pass to the flow. See :class:`
|
| 49 |
"""
|
| 50 |
REQUIRED_KEYS_CONFIG = ["type"]
|
| 51 |
|
|
|
|
| 9 |
from langchain.vectorstores import Chroma, FAISS
|
| 10 |
from langchain.vectorstores.base import VectorStoreRetriever
|
| 11 |
|
| 12 |
+
from aiflows.base_flows import AtomicFlow
|
| 13 |
import hydra
|
| 14 |
|
| 15 |
|
|
|
|
| 45 |
:type vector_db: VectorStoreRetriever
|
| 46 |
:param type: The type of the vector store
|
| 47 |
:type type: str
|
| 48 |
+
:param \**kwargs: Additional arguments to pass to the flow. See :class:`aiflows.base_flows.AtomicFlow` for more details.
|
| 49 |
"""
|
| 50 |
REQUIRED_KEYS_CONFIG = ["type"]
|
| 51 |
|
VectorStoreFlow.yaml
CHANGED
|
@@ -2,7 +2,7 @@ name: "VectorStoreFlow"
|
|
| 2 |
description: "VectorStoreFlow"
|
| 3 |
|
| 4 |
backend:
|
| 5 |
-
_target_:
|
| 6 |
api_infos: ???
|
| 7 |
model_name: "" #Not used in current implementation
|
| 8 |
|
|
|
|
| 2 |
description: "VectorStoreFlow"
|
| 3 |
|
| 4 |
backend:
|
| 5 |
+
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
| 6 |
api_infos: ???
|
| 7 |
model_name: "" #Not used in current implementation
|
| 8 |
|
demo.yaml
CHANGED
|
@@ -4,29 +4,29 @@ chroma_demo_flow:
|
|
| 4 |
- "content"
|
| 5 |
output_interface:
|
| 6 |
- "retrieved"
|
| 7 |
-
_target_:
|
| 8 |
name: "demoChromaDBFlow"
|
| 9 |
description: "An example flow of how to read and writed in a ChromaDBFlowModule."
|
| 10 |
subflows_config:
|
| 11 |
chroma_db:
|
| 12 |
input_interface:
|
| 13 |
-
_target_:
|
| 14 |
keys_to_select: ["operation","content"]
|
| 15 |
-
_target_: aiflows.VectorStoreFlowModule.ChromaDBFlow.instantiate_from_default_config
|
| 16 |
|
| 17 |
backend:
|
| 18 |
-
_target_:
|
| 19 |
api_infos: ???
|
| 20 |
model_name: "" #Not used in current implementation
|
| 21 |
n_results: 1 # number of results to retrieve when query
|
| 22 |
topology:
|
| 23 |
- goal: Write content to the ChromaDB
|
| 24 |
input_interface:
|
| 25 |
-
_target_:
|
| 26 |
keys_to_select: ["operation","content"]
|
| 27 |
flow: chroma_db
|
| 28 |
output_interface:
|
| 29 |
-
_target_:
|
| 30 |
keys_to_set:
|
| 31 |
operation: "read"
|
| 32 |
keys_to_rename:
|
|
@@ -35,11 +35,11 @@ chroma_demo_flow:
|
|
| 35 |
|
| 36 |
- goal: Read content from the ChromaDB
|
| 37 |
input_interface:
|
| 38 |
-
_target_:
|
| 39 |
keys_to_select: ["operation","content"]
|
| 40 |
flow: chroma_db
|
| 41 |
output_interface:
|
| 42 |
-
_target_:
|
| 43 |
keys_to_select: ["retrieved"]
|
| 44 |
|
| 45 |
vector_store_demo_flow:
|
|
@@ -50,24 +50,24 @@ vector_store_demo_flow:
|
|
| 50 |
- "retrieved"
|
| 51 |
name: "demoVectorStoreFlow"
|
| 52 |
description: "An example flow of how to read and write in a VectorStoreFlowModule."
|
| 53 |
-
_target_:
|
| 54 |
subflows_config:
|
| 55 |
|
| 56 |
vs_db:
|
| 57 |
-
_target_: aiflows.VectorStoreFlowModule.VectorStoreFlow.instantiate_from_default_config
|
| 58 |
backend:
|
| 59 |
-
_target_:
|
| 60 |
api_infos: ???
|
| 61 |
model_name: "" #Not used in current implementation
|
| 62 |
|
| 63 |
topology:
|
| 64 |
- goal: Write content to the VectorStore
|
| 65 |
input_interface:
|
| 66 |
-
_target_:
|
| 67 |
keys_to_select: ["operation","content"]
|
| 68 |
flow: vs_db
|
| 69 |
output_interface:
|
| 70 |
-
_target_:
|
| 71 |
keys_to_set:
|
| 72 |
operation: "read"
|
| 73 |
keys_to_rename:
|
|
@@ -76,10 +76,10 @@ vector_store_demo_flow:
|
|
| 76 |
|
| 77 |
- goal: Read content from the VectorStore
|
| 78 |
input_interface:
|
| 79 |
-
_target_:
|
| 80 |
keys_to_select: ["operation","content"]
|
| 81 |
flow: vs_db
|
| 82 |
output_interface:
|
| 83 |
-
_target_:
|
| 84 |
keys_to_select: ["retrieved"]
|
| 85 |
|
|
|
|
| 4 |
- "content"
|
| 5 |
output_interface:
|
| 6 |
- "retrieved"
|
| 7 |
+
_target_: aiflows.base_flows.SequentialFlow.instantiate_from_default_config
|
| 8 |
name: "demoChromaDBFlow"
|
| 9 |
description: "An example flow of how to read and writed in a ChromaDBFlowModule."
|
| 10 |
subflows_config:
|
| 11 |
chroma_db:
|
| 12 |
input_interface:
|
| 13 |
+
_target_: aiflows.interfaces.KeyInterface
|
| 14 |
keys_to_select: ["operation","content"]
|
| 15 |
+
_target_: flow_modules.aiflows.VectorStoreFlowModule.ChromaDBFlow.instantiate_from_default_config
|
| 16 |
|
| 17 |
backend:
|
| 18 |
+
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
| 19 |
api_infos: ???
|
| 20 |
model_name: "" #Not used in current implementation
|
| 21 |
n_results: 1 # number of results to retrieve when query
|
| 22 |
topology:
|
| 23 |
- goal: Write content to the ChromaDB
|
| 24 |
input_interface:
|
| 25 |
+
_target_: aiflows.interfaces.KeyInterface
|
| 26 |
keys_to_select: ["operation","content"]
|
| 27 |
flow: chroma_db
|
| 28 |
output_interface:
|
| 29 |
+
_target_: aiflows.interfaces.KeyInterface
|
| 30 |
keys_to_set:
|
| 31 |
operation: "read"
|
| 32 |
keys_to_rename:
|
|
|
|
| 35 |
|
| 36 |
- goal: Read content from the ChromaDB
|
| 37 |
input_interface:
|
| 38 |
+
_target_: aiflows.interfaces.KeyInterface
|
| 39 |
keys_to_select: ["operation","content"]
|
| 40 |
flow: chroma_db
|
| 41 |
output_interface:
|
| 42 |
+
_target_: aiflows.interfaces.KeyInterface
|
| 43 |
keys_to_select: ["retrieved"]
|
| 44 |
|
| 45 |
vector_store_demo_flow:
|
|
|
|
| 50 |
- "retrieved"
|
| 51 |
name: "demoVectorStoreFlow"
|
| 52 |
description: "An example flow of how to read and write in a VectorStoreFlowModule."
|
| 53 |
+
_target_: aiflows.base_flows.SequentialFlow.instantiate_from_default_config
|
| 54 |
subflows_config:
|
| 55 |
|
| 56 |
vs_db:
|
| 57 |
+
_target_: flow_modules.aiflows.VectorStoreFlowModule.VectorStoreFlow.instantiate_from_default_config
|
| 58 |
backend:
|
| 59 |
+
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
| 60 |
api_infos: ???
|
| 61 |
model_name: "" #Not used in current implementation
|
| 62 |
|
| 63 |
topology:
|
| 64 |
- goal: Write content to the VectorStore
|
| 65 |
input_interface:
|
| 66 |
+
_target_: aiflows.interfaces.KeyInterface
|
| 67 |
keys_to_select: ["operation","content"]
|
| 68 |
flow: vs_db
|
| 69 |
output_interface:
|
| 70 |
+
_target_: aiflows.interfaces.KeyInterface
|
| 71 |
keys_to_set:
|
| 72 |
operation: "read"
|
| 73 |
keys_to_rename:
|
|
|
|
| 76 |
|
| 77 |
- goal: Read content from the VectorStore
|
| 78 |
input_interface:
|
| 79 |
+
_target_: aiflows.interfaces.KeyInterface
|
| 80 |
keys_to_select: ["operation","content"]
|
| 81 |
flow: vs_db
|
| 82 |
output_interface:
|
| 83 |
+
_target_: aiflows.interfaces.KeyInterface
|
| 84 |
keys_to_select: ["retrieved"]
|
| 85 |
|
run.py
CHANGED
|
@@ -3,12 +3,12 @@ import os
|
|
| 3 |
|
| 4 |
import hydra
|
| 5 |
|
| 6 |
-
import
|
| 7 |
-
from
|
| 8 |
-
from
|
| 9 |
-
from
|
| 10 |
-
from
|
| 11 |
-
from
|
| 12 |
|
| 13 |
CACHING_PARAMETERS.do_caching = False # Set to True to enable caching
|
| 14 |
# clear_cache() # Uncomment this line to clear the cache
|
|
@@ -18,7 +18,7 @@ logging.set_verbosity_debug()
|
|
| 18 |
dependencies = [
|
| 19 |
{"url": "aiflows/VectorStoreFlowModule", "revision": os.getcwd()},
|
| 20 |
]
|
| 21 |
-
from
|
| 22 |
flow_verse.sync_dependencies(dependencies)
|
| 23 |
|
| 24 |
if __name__ == "__main__":
|
|
|
|
| 3 |
|
| 4 |
import hydra
|
| 5 |
|
| 6 |
+
import aiflows
|
| 7 |
+
from aiflows.flow_launchers import FlowLauncher
|
| 8 |
+
from aiflows.utils.general_helpers import read_yaml_file
|
| 9 |
+
from aiflows.backends.api_info import ApiInfo
|
| 10 |
+
from aiflows import logging
|
| 11 |
+
from aiflows.flow_cache import CACHING_PARAMETERS, clear_cache
|
| 12 |
|
| 13 |
CACHING_PARAMETERS.do_caching = False # Set to True to enable caching
|
| 14 |
# clear_cache() # Uncomment this line to clear the cache
|
|
|
|
| 18 |
dependencies = [
|
| 19 |
{"url": "aiflows/VectorStoreFlowModule", "revision": os.getcwd()},
|
| 20 |
]
|
| 21 |
+
from aiflows import flow_verse
|
| 22 |
flow_verse.sync_dependencies(dependencies)
|
| 23 |
|
| 24 |
if __name__ == "__main__":
|