Skip to content

Commit

Permalink
Merge pull request #835 from NVIDIA/fix/import-path-colang-2
Browse files Browse the repository at this point in the history
  • Loading branch information
Pouyanpi authored Nov 1, 2024
2 parents 543b446 + 5d6e547 commit cfdd335
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import guardrails
import nemoguardrails.library
import nemoguardrails.library.self_check.output_check
import nemoguardrails.library.self_check.input_check

flow input rails $input_text
self check input
Expand Down
11 changes: 10 additions & 1 deletion nemoguardrails/rails/llm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@
standard_library_path = os.path.normpath(
os.path.join(os.path.dirname(__file__), "..", "..", "colang", "v2_x", "library")
)

# nemoguardrails/lobrary
guardrails_stdlib_path = os.path.normpath(
os.path.join(os.path.dirname(__file__), "..", "..", "..")
)
colang_path_dirs.append(standard_library_path)
colang_path_dirs.append(guardrails_stdlib_path)


class Model(BaseModel):
Expand Down Expand Up @@ -653,7 +659,10 @@ def _load_imported_paths(raw_config: dict, colang_files: List[Tuple[str, str]]):
actual_path = import_path

if actual_path is None:
raise ValueError(f"Import path `{import_path}` could not be resolved.")
formated_import_path = import_path.replace("/", ".")
raise ValueError(
f"Import path '{formated_import_path}' could not be resolved.",
)

_raw_config, _colang_files = _load_path(actual_path)

Expand Down

0 comments on commit cfdd335

Please sign in to comment.