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.

Fixes loading up state from tracker for new app

elijahbenizzy91a3c2893583
diff --git a/burr/tracking/client.py b/burr/tracking/client.py
index 6c6f0930..a7040d82 100644
--- a/burr/tracking/client.py
+++ b/burr/tracking/client.py
@@ -302,11 +302,11 @@ class LocalTrackingClient(
sequence_id = -1 # get the last one
path = os.path.join(self.storage_dir, app_id, self.LOG_FILENAME)
if not os.path.exists(path):
- raise ValueError(
- f"No logs found for {self.project_id}/{app_id} under {self.storage_dir}"
- )
+ return None
with open(path, "r") as f:
json_lines = f.readlines()
+ if len(json_lines) == 0:
+ return None # in this case we have not logged anything yet
# load as JSON
json_lines = [json.loads(js_line) for js_line in json_lines]
# filter to only end_entry
diff --git a/burr/tracking/server/examples/chatbot.py b/burr/tracking/server/examples/chatbot.py
index b2d988a4..2b378c3f 100644
--- a/burr/tracking/server/examples/chatbot.py
+++ b/burr/tracking/server/examples/chatbot.py
@@ -44,7 +44,7 @@ async def create_new_application(request: Request, project_id: str, app_id: str)
"""Quick helper to create a new application. Just returns true, you'll want to fetch afterwards.
In a better chatbot you'd want to either have the frontend store this and create on demand or return
the actual application model"""
- # side-effect is to create the application
+ # side-effect creates the logging so it exists
chat_application.application(use_hamilton=False, app_id=app_id, project_id=project_id)
return app_id # just return it for now