Skip to content

Commit

Permalink
add tool calls
Browse files Browse the repository at this point in the history
  • Loading branch information
ThejasNU committed Feb 11, 2025
1 parent 9db12f1 commit 2ef2c50
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
4 changes: 2 additions & 2 deletions libs/agentc_core/agentc_core/analytics/udfs/exchanges.sqlpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Note: all_sessions.sqlpp should be run before this script.
-- WIP
CREATE OR REPLACE FUNCTION `[BUCKET_NAME]`.`[SCOPE_NAME]`.QueryLatestMessages() AS
WITH LM AS
(
WITH msgs AS (
Expand All @@ -11,7 +11,7 @@ WITH msgs AS (
s.grouping,
s.session,
ROW_NUMBER() OVER (PARTITION BY s.grouping, s.session ORDER BY s.timestamp) AS row_num
FROM umc.agent_activity.raw_logs AS s
FROM `[BUCKET_NAME]`.`[SCOPE_NAME]`.`[LOG_COLLECTION_NAME]` AS s
WHERE s.grouping IS NOT NULL
),
first_human AS (
Expand Down
34 changes: 33 additions & 1 deletion libs/agentc_core/agentc_core/analytics/udfs/tool_calls.sqlpp
Original file line number Diff line number Diff line change
@@ -1,2 +1,34 @@
-- Note: all_sessions.sqlpp should be run before this script.
WIP
CREATE OR REPLACE FUNCTION `[BUCKET_NAME]`.`[SCOPE_NAME]`.QueryToolCalls()
SELECT
s1.sid AS sid,
s1.vid AS vid,
tool_calls AS tool_calls
FROM
`[BUCKET_NAME]`.`[SCOPE_NAME]`.QuerySessions() AS s1,
s1.msgs AS m1,
m1.content.dump.kwargs.tool_calls AS tc1,
`[BUCKET_NAME]`.`[SCOPE_NAME]`.QuerySessions() AS s2,
s2.msgs AS m2
WHERE
m1.kind = "llm" AND
m2.kind = "tool" AND
tc1.id = m2.content.dump.kwargs.tool_call_id
GROUP BY
s1, s2
GROUP AS
g
LETTING
tool_calls = (
FROM
g AS gi
SELECT
gi.tc1.name AS tool_name,
gi.tc1.args AS tool_args,
gi.tc1.id AS tool_call_id,
gi.m2.content.dump.kwargs.content AS tool_result,
gi.m2.content.dump.kwargs.status AS tool_status
)
ORDER BY
vid.timestamp DESC
;

0 comments on commit 2ef2c50

Please sign in to comment.