Commit ·
7680f06
1
Parent(s): c3862ba
First commit.
Browse filesFiles changed (5)
- .gitignoreAdded+73
- README.md+25-3
- __init__.pyAdded+9
- pip_requirements.pyAdded
- run.pyAdded+63
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273### Linux ###*~
# temporary files which can be created if a process still has a handle open of a deleted file.fuse_hidden*
# KDE directory preferences.directory
# Linux trash folder which might appear on any partition or disk.Trash-*
# .nfs files are created when an open file is removed but is still being accessed.nfs*
### macOS #### General.DS_Store.AppleDouble.LSOverride
# Icon must end with two \rIcon
# Thumbnails._*
# Files that might appear in the root of a volume.DocumentRevisions-V100.fseventsd.Spotlight-V100.TemporaryItems.Trashes.VolumeIcon.icns.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share.AppleDB.AppleDesktopNetwork Trash FolderTemporary Items.apdisk
### macOS Patch #### iCloud generated files*.icloud
### Windows #### Windows thumbnail cache filesThumbs.dbThumbs.db:encryptableehthumbs.dbehthumbs_vista.db
# Dump file*.stackdump
# Folder config file[Dd]esktop.ini
# Recycle Bin used on file shares$RECYCLE.BIN/
# Windows Installer files*.cab*.msi*.msix*.msm*.msp
# Windows shortcuts*.lnk123---license: mit---12345678910111213141516171819202122232425## Description< Flow description >## Configuration parameters< Name 1 > (< Type 1 >): < Description 1 >. Required parameter.< Name 2 > (< Type 2 >): < Description 2 >. Default value is: < value 2 >## Input interface< Name 1 > (< Type 1 >): < Description 1 >.(Note that the interface might depend on the state of the Flow.)## Output interface< Name 1 > (< Type 1 >): < Description 1 >.(Note that the interface might depend on the state of the Flow.)### LicenceMIT
123456789# ~~~ Specify the dependencies ~~~# e.g.,# dependencies = [# {"url": "aiflows/AutoGPTFlowModule", "revision": "main"},# ]# Revision can correspond toa branch, commit hash or a absolute path to a local directory (ideal for development)# from flows import flow_verse
# flow_verse.sync_dependencies(dependencies)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263"""A simple script to run a Flow that can be used for development and debugging."""
import os
import hydra
import flowsfrom flows.flow_launchers import FlowLauncher, ApiInfofrom flows.utils.general_helpers import read_yaml_file
from flows import loggingfrom flows.flow_cache import CACHING_PARAMETERS, clear_cache
CACHING_PARAMETERS.do_caching = False # Set to True to enable caching# clear_cache() # Uncomment this line to clear the cache
logging.set_verbosity_debug()
if __name__ == "__main__": # ~~~ Set the API information ~~~ # OpenAI backend # api_information = ApiInfo("openai", os.getenv("OPENAI_API_KEY")) # Azure backend api_information = ApiInfo("azure", os.getenv("AZURE_OPENAI_KEY"), os.getenv("AZURE_OPENAI_ENDPOINT"))
# ~~~ Instantiate the Flow ~~~ root_dir = "." cfg_path = os.path.join(root_dir, "FlowName.yaml") cfg = read_yaml_file(cfg_path)
flow_with_interfaces = { "flow": hydra.utils.instantiate(cfg['flow'], _recursive_=False, _convert_="partial"), "input_interface": ( None if getattr(cfg, "input_interface", None) is None else hydra.utils.instantiate(cfg['input_interface'], _recursive_=False) ), "output_interface": ( None if getattr(cfg, "output_interface", None) is None else hydra.utils.instantiate(cfg['output_interface'], _recursive_=False) ), }
# ~~~ Get the data ~~~ # This can be a list of samples data = {"id": 0} # Add your data here
# ~~~ Run inference ~~~ path_to_output_file = None # path_to_output_file = "output.jsonl" # Uncomment this line to save the output to disk
_, outputs = FlowLauncher.launch( flow_with_interfaces=flow_with_interfaces, data=data, path_to_output_file=path_to_output_file, api_information=api_information, )
# ~~~ Print the output ~~~ flow_output_data = outputs[0] print(flow_output_data).gitignoreAdded+73
README.md+25-3
__init__.pyAdded+9
pip_requirements.pyAdded
run.pyAdded+63