-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactors the naming of constitutions to princeples
adds methods for comparison data generation adds example principles for comparison
- Loading branch information
Showing
17 changed files
with
826 additions
and
428 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
ConstitutionalAiTuning/constitution_loader/constitution_loader.py
This file was deleted.
Oops, something went wrong.
250 changes: 195 additions & 55 deletions
250
ConstitutionalAiTuning/interaction/model_interactor.py
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Initialize the principles_loader package. | ||
|
||
# Import and expose functions or classes, if necessary. | ||
from .principles_loader import load_principles |
18 changes: 18 additions & 0 deletions
18
ConstitutionalAiTuning/principles_loader/principles_loader.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import json | ||
|
||
def load_principles(file_path): | ||
""" | ||
Loads a constitutioal principles file (JSON format) and returns the parsed content. | ||
:param file_path: The path to the JSON file containing the principles. | ||
:return: A dictionary representing the loaded principles. | ||
""" | ||
try: | ||
with open(file_path, 'r') as f: | ||
principles = json.load(f) | ||
except FileNotFoundError: | ||
raise FileNotFoundError(f"Principles file not found at: {file_path}") | ||
except json.JSONDecodeError: | ||
raise ValueError(f"Invalid JSON format in file: {file_path}") | ||
|
||
return principles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.