Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/import path colang 2 #835

Merged
merged 3 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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