Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.
Python aiburrchatbot-frameworkdagsgenerative-aigraphshacktoberfestllmopsllmsmlopspersistent-data-structurestate-machinestate-managementvisibility
Updates model_type -> type
elijahbenizzyb5a9638b6233
diff --git a/burr/tracking/models.py b/burr/tracking/models.pyindex 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: strclass ActionModel(IdentifyingModel):@@ -28,7 +28,7 @@ class ActionModel(IdentifyingModel):reads: list[str]writes: list[str]code: str- model_type: str = "action"+ type: str = "action"@staticmethoddef from_action(action: Action) -> "ActionModel":@@ -55,7 +55,7 @@ class TransitionModel(IdentifyingModel):from_: strto: strcondition: str- model_type: str = "transition"+ type: str = "transition"@staticmethoddef from_transition(transition: Transition) -> "TransitionModel":@@ -70,7 +70,7 @@ class ApplicationModel(IdentifyingModel):entrypoint: stractions: list[ActionModel]transitions: list[TransitionModel]- model_type: str = "application"+ type: str = "application"@staticmethoddef from_application_graph(application_graph: ApplicationGraph) -> "ApplicationModel":@@ -90,7 +90,7 @@ class BeginEntryModel(IdentifyingModel):start_time: datetime.datetimeaction: strinputs: 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.pyindex 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) == 3assert 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) == 2assert len(post_run) == 2