mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-08-05 19:17:43 +00:00
CI checks that can be automatically repaired (#119)
* fix isort & black & toml-sort & sphinx error * fix ci error * fix ci error * add comments * Update Makefile * change sphinx build command * add auto-lint * add black args * format with black * Auto Linting document * fix ci error --------- Co-authored-by: you-n-g <you-n-g@users.noreply.github.com> Co-authored-by: Young <afe.young@gmail.com>
This commit is contained in:
@@ -3,8 +3,8 @@ The output of a agent is very important.
|
||||
|
||||
We think this part can be shared.
|
||||
"""
|
||||
from abc import abstractclassmethod
|
||||
import re
|
||||
from abc import abstractclassmethod
|
||||
from typing import Any
|
||||
|
||||
from rdagent.utils.agent.tpl import T
|
||||
|
||||
+10
-10
@@ -4,13 +4,12 @@ Here are some infrastruture to build a agent
|
||||
The motivation of tempalte and AgentOutput Design
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
from jinja2 import Environment, StrictUndefined
|
||||
|
||||
import inspect
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import yaml
|
||||
import inspect
|
||||
from jinja2 import Environment, StrictUndefined
|
||||
|
||||
from rdagent.core.utils import SingletonBaseClass
|
||||
|
||||
@@ -21,9 +20,10 @@ PROJ_PATH = DIRNAME.parent.parent
|
||||
# class T(SingletonBaseClass): TODO: singleton does not support args now.
|
||||
class T:
|
||||
"""Use the simplest way to (C)reate a Template and (r)ender it!!"""
|
||||
|
||||
def __init__(self, uri: str):
|
||||
"""
|
||||
here are some uri usages
|
||||
here are some uri usages
|
||||
case 1) "a.b.c:x.y.z"
|
||||
It will load DIRNAME/a/b/c.yaml as `yaml` and load yaml[x][y][z]
|
||||
case 2) ".c:x.y.z"
|
||||
@@ -38,16 +38,16 @@ class T:
|
||||
caller_dir = Path(caller_module.__file__).parent
|
||||
|
||||
# Parse the URI
|
||||
path_part, yaml_path = uri.split(':')
|
||||
yaml_keys = yaml_path.split('.')
|
||||
path_part, yaml_path = uri.split(":")
|
||||
yaml_keys = yaml_path.split(".")
|
||||
|
||||
if path_part.startswith('.'):
|
||||
if path_part.startswith("."):
|
||||
yaml_file_path = caller_dir / f"{path_part[1:].replace('.', '/')}.yaml"
|
||||
else:
|
||||
yaml_file_path = (PROJ_PATH / path_part.replace('.', '/')).with_suffix('.yaml')
|
||||
yaml_file_path = (PROJ_PATH / path_part.replace(".", "/")).with_suffix(".yaml")
|
||||
|
||||
# Load the YAML file
|
||||
with open(yaml_file_path, 'r') as file:
|
||||
with open(yaml_file_path, "r") as file:
|
||||
yaml_content = yaml.safe_load(file)
|
||||
|
||||
# Traverse the YAML content to get the desired template
|
||||
|
||||
Reference in New Issue
Block a user