diff --git a/libs/agentc_cli/agentc_cli/cmds/status.py b/libs/agentc_cli/agentc_cli/cmds/status.py index 3d5ebf78..de3a99fa 100644 --- a/libs/agentc_cli/agentc_cli/cmds/status.py +++ b/libs/agentc_cli/agentc_cli/cmds/status.py @@ -108,7 +108,7 @@ def db_catalog_status(kind, bucket, cluster, compare): GROUP BY b.catalog_identifier ) AS subquery ON a.version.identifier = subquery.catalog_identifier - ORDER BY a.version.timestamp DESC LIMIT 1; + ORDER BY STR_TO_MILLIS(a.version.timestamp) DESC LIMIT 1; """ else: # Query to get the metadata based on the kind of catalog diff --git a/libs/agentc_core/agentc_core/analytics/ddls/all_sessions.sqlpp b/libs/agentc_core/agentc_core/analytics/ddls/all_sessions.sqlpp index 472ae1df..9cf4fa6f 100644 --- a/libs/agentc_core/agentc_core/analytics/ddls/all_sessions.sqlpp +++ b/libs/agentc_core/agentc_core/analytics/ddls/all_sessions.sqlpp @@ -18,7 +18,7 @@ WITH PARTITION BY _id ORDER BY - rsli.timestamp ASC + STR_TO_MILLIS(rsli.timestamp) ASC ) AS rn ) FROM @@ -39,7 +39,7 @@ LETTING SELECT VALUE gii ORDER BY - gii.rsl.timestamp ASC + STR_TO_MILLIS(gii.rsl.timestamp) ASC ) AS gi SELECT gi.rsl.content AS content, @@ -59,7 +59,7 @@ SELECT SELECT VALUE gi.rsl.timestamp ORDER BY - gi.rsl.timestamp ASC + STR_TO_MILLIS(gi.rsl.timestamp) ASC LIMIT 1 )[0] AS start_t, vid, diff --git a/libs/agentc_core/agentc_core/analytics/ddls/exchanges.sqlpp b/libs/agentc_core/agentc_core/analytics/ddls/exchanges.sqlpp index e0d1388e..1b03d0d6 100644 --- a/libs/agentc_core/agentc_core/analytics/ddls/exchanges.sqlpp +++ b/libs/agentc_core/agentc_core/analytics/ddls/exchanges.sqlpp @@ -30,7 +30,7 @@ WITH LatestGenerations AS ( msgsi.content, msgsi.row_num ORDER BY - msgsi.timestamp ASC + STR_TO_MILLIS(msgsi.timestamp) ASC LIMIT 1 )[0], last_message = ( @@ -40,7 +40,7 @@ WITH LatestGenerations AS ( COALESCE(msgsi.content, msgsi.tool_calls) AS content, msgsi.row_num ORDER BY - msgsi.timestamp DESC + STR_TO_MILLIS(msgsi.timestamp) DESC LIMIT 1 )[0], context = ( diff --git a/libs/agentc_core/agentc_core/analytics/ddls/last_session.sqlpp b/libs/agentc_core/agentc_core/analytics/ddls/last_session.sqlpp index d9a2d881..021ec750 100644 --- a/libs/agentc_core/agentc_core/analytics/ddls/last_session.sqlpp +++ b/libs/agentc_core/agentc_core/analytics/ddls/last_session.sqlpp @@ -7,7 +7,7 @@ CREATE OR REPLACE ANALYTICS FUNCTION SELECT VALUE s.sid ORDER BY - s.start_t DESC + STR_TO_MILLIS(s.start_t) DESC LIMIT 1 )[0] }; diff --git a/libs/agentc_core/agentc_core/analytics/ddls/tool_calls.sqlpp b/libs/agentc_core/agentc_core/analytics/ddls/tool_calls.sqlpp index 8f97465c..bdbf6fcb 100644 --- a/libs/agentc_core/agentc_core/analytics/ddls/tool_calls.sqlpp +++ b/libs/agentc_core/agentc_core/analytics/ddls/tool_calls.sqlpp @@ -32,5 +32,5 @@ SELECT s1.vid AS vid, tool_calls AS tool_calls ORDER BY - vid.timestamp DESC + STR_TO_MILLIS(vid.timestamp) DESC ; diff --git a/libs/agentc_core/agentc_core/analytics/ddls/trajectories.sqlpp b/libs/agentc_core/agentc_core/analytics/ddls/trajectories.sqlpp index d60b2ec3..3170be03 100644 --- a/libs/agentc_core/agentc_core/analytics/ddls/trajectories.sqlpp +++ b/libs/agentc_core/agentc_core/analytics/ddls/trajectories.sqlpp @@ -15,7 +15,7 @@ LETTING SELECT VALUE gi.msg ORDER BY - gi.msg.timestamp ASC + STR_TO_MILLIS(gi.msg.timestamp) ASC ) SELECT s.sid AS sid, diff --git a/libs/agentc_core/agentc_core/catalog/catalog/db.py b/libs/agentc_core/agentc_core/catalog/catalog/db.py index ac17448a..39990033 100644 --- a/libs/agentc_core/agentc_core/catalog/catalog/db.py +++ b/libs/agentc_core/agentc_core/catalog/catalog/db.py @@ -237,7 +237,7 @@ def version(self) -> VersionDescriptor: ts_query = f""" FROM `{self.bucket}`.`{DEFAULT_CATALOG_SCOPE}`.`{self.kind}{DEFAULT_META_COLLECTION_NAME}` AS t SELECT VALUE t.version - ORDER BY t.version.timestamp DESC + ORDER BY STR_TO_MILLIS(t.version.timestamp) DESC LIMIT 1 """ res, err = execute_query(self.cluster, ts_query) diff --git a/libs/agentc_core/agentc_core/learned/embedding.py b/libs/agentc_core/agentc_core/learned/embedding.py index 896f4a72..b641243c 100644 --- a/libs/agentc_core/agentc_core/learned/embedding.py +++ b/libs/agentc_core/agentc_core/learned/embedding.py @@ -94,7 +94,7 @@ def validate_embedding_model(self) -> "EmbeddingModel": SELECT VALUE mc.embedding_model ORDER BY - mc.version.timestamp DESC + STR_TO_MILLIS(mc.version.timestamp) DESC LIMIT 1 """ ] diff --git a/templates/agents/with_controlflow/notebook.ipynb b/templates/agents/with_controlflow/notebook.ipynb index 395b89a1..698104be 100644 --- a/templates/agents/with_controlflow/notebook.ipynb +++ b/templates/agents/with_controlflow/notebook.ipynb @@ -96,7 +96,7 @@ " msgsi.content,\n", " msgsi.row_num\n", " ORDER BY\n", - " msgsi.timestamp ASC\n", + " STR_TO_MILLIS(msgsi.timestamp) ASC\n", " LIMIT 1\n", " )[0],\n", " last_message = (\n", @@ -106,7 +106,7 @@ " COALESCE(msgsi.content, msgsi.tool_calls) AS content,\n", " msgsi.row_num\n", " ORDER BY \n", - " msgsi.timestamp DESC\n", + " STR_TO_MILLIS(msgsi.timestamp) DESC\n", " LIMIT 1\n", " )[0],\n", " context = (\n",