diff --git a/dev/sql/20230420_average_token_usage_per_query.sql b/dev/sql/20230420_average_token_usage_per_query.sql deleted file mode 100644 index 1a92779..0000000 --- a/dev/sql/20230420_average_token_usage_per_query.sql +++ /dev/null @@ -1,15 +0,0 @@ -SELECT - AVG(Prompt), - AVG(Completion) - FROM ( - SELECT - queries.id, - SUM(json_extract(value, '$.usage.prompt_tokens')) AS "Prompt", - SUM(json_extract(value, '$.usage.completion_tokens')) AS "Completion" - FROM queries, json_each(queries.response_json, '$') - WHERE queries.response_json LIKE "[{%" - AND queries.response_json NOT LIKE "%""]" -- filter out lists w/ an error message at the end - GROUP BY queries.id - ORDER BY queries.id DESC - LIMIT 2500 - ) diff --git a/dev/sql/20240613_select_testcases.sql b/dev/sql/20240613_select_testcases.sql new file mode 100644 index 0000000..08288ce --- /dev/null +++ b/dev/sql/20240613_select_testcases.sql @@ -0,0 +1,10 @@ +.mode csv +.headers on + +SELECT queries.id, queries.query_time, queries.language, queries.code, queries.error, queries.issue, json_extract(queries.response_text, '$.main') as main_response, json_extract(queries.response_text, '$.insufficient') as insufficient_response + FROM queries + JOIN roles ON queries.role_id = roles.id + WHERE query_time > date("2023-09-30") -- only once it was in use in real classes + AND roles.role = "student" -- only queries from students in a class + ORDER BY RANDOM() + LIMIT 100; diff --git a/dev/sql/avg_tokens_per_query.sql b/dev/sql/avg_tokens_per_query.sql new file mode 100644 index 0000000..41a8a1f --- /dev/null +++ b/dev/sql/avg_tokens_per_query.sql @@ -0,0 +1,15 @@ +.mode box +SELECT + AVG(Prompt) AS Prompt_avg, + AVG(Completion) AS Completion_avg + FROM ( + SELECT + q.id, + SUM(json_extract(value, '$.usage.prompt_tokens')) AS "Prompt", + SUM(json_extract(value, '$.usage.completion_tokens')) AS "Completion" + FROM queries AS q, json_each(q.response_json, '$') + WHERE json_valid(value) + GROUP BY q.id + ORDER BY q.id DESC + LIMIT 10000 + ) diff --git a/dev/sql/20230306_code_filter_failures.sql b/dev/sql/code_in_outputs.sql similarity index 77% rename from dev/sql/20230306_code_filter_failures.sql rename to dev/sql/code_in_outputs.sql index 3e18f43..6f4867e 100644 --- a/dev/sql/20230306_code_filter_failures.sql +++ b/dev/sql/code_in_outputs.sql @@ -12,8 +12,9 @@ SELECT -- Extract examples w/ code still in SELECT - id, json_extract(response_json, '$[1].choices[0].message.content') + id, response_text FROM queries WHERE id >= 935 AND - json_extract(response_json, '$[2].choices[0].message.content') LIKE "%```%" + response_text LIKE "%```%" + --json_extract(response_json, '$[2].choices[0].message.content') LIKE "%```%" ;