Skip to content

armgit / burr

Public Imported from GitHub
0

Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.

Updates model_type -> type

elijahbenizzyb5a9638b6233
diff --git a/burr/tracking/models.py b/burr/tracking/models.py
index 935b9af3..008c2f27 100644
--- a/burr/tracking/models.py
+++ b/burr/tracking/models.py
@@ -18,7 +18,7 @@ except ImportError as e:
class IdentifyingModel(pydantic.BaseModel):
- model_type: str
+ type: str
class ActionModel(IdentifyingModel):
@@ -28,7 +28,7 @@ class ActionModel(IdentifyingModel):
reads: list[str]
writes: list[str]
code: str
- model_type: str = "action"
+ type: str = "action"
@staticmethod
def from_action(action: Action) -> "ActionModel":
@@ -55,7 +55,7 @@ class TransitionModel(IdentifyingModel):
from_: str
to: str
condition: str
- model_type: str = "transition"
+ type: str = "transition"
@staticmethod
def from_transition(transition: Transition) -> "TransitionModel":
@@ -70,7 +70,7 @@ class ApplicationModel(IdentifyingModel):
entrypoint: str
actions: list[ActionModel]
transitions: list[TransitionModel]
- model_type: str = "application"
+ type: str = "application"
@staticmethod
def from_application_graph(application_graph: ApplicationGraph) -> "ApplicationModel":
@@ -90,7 +90,7 @@ class BeginEntryModel(IdentifyingModel):
start_time: datetime.datetime
action: str
inputs: Dict[str, Any]
- model_type: str = "begin_entry"
+ type: str = "begin_entry"
class EndEntryModel(IdentifyingModel):
@@ -101,4 +101,4 @@ class EndEntryModel(IdentifyingModel):
result: Optional[dict]
exception: Optional[str]
state: Dict[str, Any] # TODO -- consider logging updates to the state so we can recreate
- model_type: str = "end_entry"
+ type: str = "end_entry"
diff --git a/tests/tracking/test_local_tracking_client.py b/tests/tracking/test_local_tracking_client.py
index d8b62259..10bf6aad 100644
--- a/tests/tracking/test_local_tracking_client.py
+++ b/tests/tracking/test_local_tracking_client.py
@@ -52,18 +52,16 @@ def test_application_tracks_end_to_end(tmpdir: str):
log_contents = [json.loads(item) for item in f.readlines()]
with open(graph_output) as f:
graph_contents = json.load(f)
- assert graph_contents["model_type"] == "application"
+ assert graph_contents["type"] == "application"
app_model = ApplicationModel.parse_obj(graph_contents)
assert app_model.entrypoint == "counter"
assert app_model.actions[0].name == "counter"
assert app_model.actions[1].name == "result"
pre_run = [
- BeginEntryModel.parse_obj(line)
- for line in log_contents
- if line["model_type"] == "begin_entry"
+ BeginEntryModel.parse_obj(line) for line in log_contents if line["type"] == "begin_entry"
]
post_run = [
- EndEntryModel.parse_obj(line) for line in log_contents if line["model_type"] == "end_entry"
+ EndEntryModel.parse_obj(line) for line in log_contents if line["type"] == "end_entry"
]
assert len(pre_run) == 3
assert len(post_run) == 3
@@ -87,18 +85,16 @@ def test_application_tracks_end_to_end_broken(tmpdir: str):
log_contents = [json.loads(item) for item in f.readlines()]
with open(graph_output) as f:
graph_contents = json.load(f)
- assert graph_contents["model_type"] == "application"
+ assert graph_contents["type"] == "application"
app_model = ApplicationModel.parse_obj(graph_contents)
assert app_model.entrypoint == "counter"
assert app_model.actions[0].name == "counter"
assert app_model.actions[1].name == "result"
pre_run = [
- BeginEntryModel.parse_obj(line)
- for line in log_contents
- if line["model_type"] == "begin_entry"
+ BeginEntryModel.parse_obj(line) for line in log_contents if line["type"] == "begin_entry"
]
post_run = [
- EndEntryModel.parse_obj(line) for line in log_contents if line["model_type"] == "end_entry"
+ EndEntryModel.parse_obj(line) for line in log_contents if line["type"] == "end_entry"
]
assert len(pre_run) == 2
assert len(post_run) == 2