decision-model / example.py
gparitosh007's picture
v1: experimental base model, seed 42
9b7e9d1 verified
Raw History Blame Contribute Delete
861 Bytes
"""Example: load the model in this folder and predict.
Run: python example.py
The flow needs the decision-model package (see the How to use section of
README.md).
"""
import json
from pathlib import Path
from decision_model.model import DecisionModel
HERE = Path(__file__).resolve().parent
REQUEST = {
"state": "Refactor the auth module and add tests. The repo has 40 files.",
"preferences": {"cost": "low cost before speed"},
"questions": [
{"id": "model", "type": "choice", "instructions": "Which model must handle this request?",
"criteria": {"haiku": "Short and simple tasks", "sonnet": "Normal coding tasks", "opus": "Long or difficult tasks"}},
],
}
def main():
model = DecisionModel.load(HERE)
result = model.predict(REQUEST)
print(json.dumps(result, indent=2))
if __name__ == "__main__":
main()