Spaces:
Runtime error
Runtime error
File size: 1,211 Bytes
82a7a28 |
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 |
import json
import os
def load_example_agent_specification(name:str):
"""
Load an example agent specification.
Args:
name (str): The name of the agent.
Returns:
dict: The agent specification.
"""
return json.load(open(os.path.join(os.path.dirname(__file__), f'./agents/{name}.agent.json')))
def load_example_fragment_specification(name:str):
"""
Load an example fragment specification.
Args:
name (str): The name of the fragment.
Returns:
dict: The fragment specification.
"""
return json.load(open(os.path.join(os.path.dirname(__file__), f'./fragments/{name}.fragment.json')))
def list_example_agents():
"""
List the available example agents.
Returns:
list: A list of the available example agents.
"""
return [f.replace('.agent.json', '') for f in os.listdir(os.path.join(os.path.dirname(__file__), './agents'))]
def list_example_fragments():
"""
List the available example fragments.
Returns:
list: A list of the available example fragments.
"""
return [f.replace('.fragment.json', '') for f in os.listdir(os.path.join(os.path.dirname(__file__), './fragments'))] |