artificial-intelligence-usage 0.0.6__tar.gz → 0.0.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (13) hide show
  1. {artificial_intelligence_usage-0.0.6 → artificial_intelligence_usage-0.0.7}/PKG-INFO +3 -2
  2. {artificial_intelligence_usage-0.0.6 → artificial_intelligence_usage-0.0.7}/README.md +2 -1
  3. {artificial_intelligence_usage-0.0.6 → artificial_intelligence_usage-0.0.7}/pyproject.toml +1 -1
  4. {artificial_intelligence_usage-0.0.6 → artificial_intelligence_usage-0.0.7}/src/artificial_intelligence_usage.egg-info/PKG-INFO +3 -2
  5. {artificial_intelligence_usage-0.0.6 → artificial_intelligence_usage-0.0.7}/src/artificial_intelligence_usage.py +14 -0
  6. {artificial_intelligence_usage-0.0.6 → artificial_intelligence_usage-0.0.7}/tests/test_artificial_intelligence_usage.py +9 -3
  7. {artificial_intelligence_usage-0.0.6 → artificial_intelligence_usage-0.0.7}/setup.cfg +0 -0
  8. {artificial_intelligence_usage-0.0.6 → artificial_intelligence_usage-0.0.7}/src/artificial_intelligence_usage.egg-info/SOURCES.txt +0 -0
  9. {artificial_intelligence_usage-0.0.6 → artificial_intelligence_usage-0.0.7}/src/artificial_intelligence_usage.egg-info/dependency_links.txt +0 -0
  10. {artificial_intelligence_usage-0.0.6 → artificial_intelligence_usage-0.0.7}/src/artificial_intelligence_usage.egg-info/entry_points.txt +0 -0
  11. {artificial_intelligence_usage-0.0.6 → artificial_intelligence_usage-0.0.7}/src/artificial_intelligence_usage.egg-info/requires.txt +0 -0
  12. {artificial_intelligence_usage-0.0.6 → artificial_intelligence_usage-0.0.7}/src/artificial_intelligence_usage.egg-info/top_level.txt +0 -0
  13. {artificial_intelligence_usage-0.0.6 → artificial_intelligence_usage-0.0.7}/tests/test_publish_pypi.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: artificial-intelligence-usage
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: Analyze usage of artificial intelligence tool.
5
5
  Author: Kaizten Analytics
6
6
  License-Expression: LicenseRef-Proprietary
@@ -28,7 +28,8 @@ latest session followed by daily and per-session prompt, token, and rate-limit u
28
28
  reviews are excluded.
29
29
  - Shows a second table with one row per session, including its start time,
30
30
  finish time, session name (up to 10 characters), first-prompt preview (up to
31
- 20 characters), GitHub repository, usage, and language. A session is finished
31
+ 20 characters), model, GitHub repository, usage, and language. When a session
32
+ records multiple models, the table shows the first one. A session is finished
32
33
  when its final rollout event is `task_complete`; otherwise its finish value is
33
34
  `In progress`.
34
35
  - Reads session names from `~/.codex/session_index.jsonl`. Missing names and
@@ -16,7 +16,8 @@ latest session followed by daily and per-session prompt, token, and rate-limit u
16
16
  reviews are excluded.
17
17
  - Shows a second table with one row per session, including its start time,
18
18
  finish time, session name (up to 10 characters), first-prompt preview (up to
19
- 20 characters), GitHub repository, usage, and language. A session is finished
19
+ 20 characters), model, GitHub repository, usage, and language. When a session
20
+ records multiple models, the table shows the first one. A session is finished
20
21
  when its final rollout event is `task_complete`; otherwise its finish value is
21
22
  `In progress`.
22
23
  - Reads session names from `~/.codex/session_index.jsonl`. Missing names and
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "artificial-intelligence-usage"
7
- version = "0.0.6"
7
+ version = "0.0.7"
8
8
  description = "Analyze usage of artificial intelligence tool."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: artificial-intelligence-usage
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: Analyze usage of artificial intelligence tool.
5
5
  Author: Kaizten Analytics
6
6
  License-Expression: LicenseRef-Proprietary
@@ -28,7 +28,8 @@ latest session followed by daily and per-session prompt, token, and rate-limit u
28
28
  reviews are excluded.
29
29
  - Shows a second table with one row per session, including its start time,
30
30
  finish time, session name (up to 10 characters), first-prompt preview (up to
31
- 20 characters), GitHub repository, usage, and language. A session is finished
31
+ 20 characters), model, GitHub repository, usage, and language. When a session
32
+ records multiple models, the table shows the first one. A session is finished
32
33
  when its final rollout event is `task_complete`; otherwise its finish value is
33
34
  `In progress`.
34
35
  - Reads session names from `~/.codex/session_index.jsonl`. Missing names and
@@ -42,6 +42,7 @@ class SessionAnalysis:
42
42
  plan_prompts: int
43
43
  goal_prompts: int
44
44
  repository: str
45
+ model: str
45
46
  language: str
46
47
  session_id: str | None
47
48
  first_prompt: str | None
@@ -471,6 +472,7 @@ def analyze_session(session_file: Path) -> SessionAnalysis:
471
472
  total_tokens = 0
472
473
  prompt_counts: Counter[str] = Counter()
473
474
  repository = "Unknown"
475
+ model = "Unknown"
474
476
  session_id = None
475
477
  first_prompt = None
476
478
  last_event_is_task_complete = False
@@ -497,6 +499,11 @@ def analyze_session(session_file: Path) -> SessionAnalysis:
497
499
  git = payload.get("git") or {}
498
500
  repository = github_repository(git.get("repository_url"))
499
501
 
502
+ if event.get("type") == "turn_context" and model == "Unknown":
503
+ candidate_model = payload.get("model")
504
+ if isinstance(candidate_model, str) and candidate_model:
505
+ model = candidate_model
506
+
500
507
  if (
501
508
  event.get("type") == "event_msg"
502
509
  and payload.get("type") == "task_started"
@@ -532,6 +539,7 @@ def analyze_session(session_file: Path) -> SessionAnalysis:
532
539
  plan_prompts=prompt_counts["plan"],
533
540
  goal_prompts=prompt_counts["goal"],
534
541
  repository=repository,
542
+ model=model,
535
543
  language=detect_language(first_prompt),
536
544
  session_id=session_id,
537
545
  first_prompt=first_prompt,
@@ -688,6 +696,10 @@ def run_report(
688
696
  len("Repository"),
689
697
  *(len(analysis.repository) for _date, _path, analysis in session_rows),
690
698
  )
699
+ model_width = max(
700
+ len("Model"),
701
+ *(len(analysis.model) for _date, _path, analysis in session_rows),
702
+ )
691
703
  session_header = (
692
704
  f"{'Date':<12} "
693
705
  f"{'Start':<8} "
@@ -695,6 +707,7 @@ def run_report(
695
707
  f"{'Repository':<{repository_width}} "
696
708
  f"{'Name':<10} "
697
709
  f"{'First prompt':<20} "
710
+ f"{'Model':<{model_width}} "
698
711
  f"{'Turns':>8} "
699
712
  f"{'Normal':>8} "
700
713
  f"{'Plan':>8} "
@@ -723,6 +736,7 @@ def run_report(
723
736
  f"{analysis.repository:<{repository_width}} "
724
737
  f"{session_name:<10} "
725
738
  f"{prompt_preview:<20} "
739
+ f"{analysis.model:<{model_width}} "
726
740
  f"{analysis.turns:>8} "
727
741
  f"{analysis.normal_prompts:>8} "
728
742
  f"{analysis.plan_prompts:>8} "
@@ -166,6 +166,7 @@ class ArtificialIntelligenceUsageTests(unittest.TestCase):
166
166
  plan_prompts=0,
167
167
  goal_prompts=0,
168
168
  repository="Unknown",
169
+ model="Unknown",
169
170
  language="Unknown",
170
171
  session_id=None,
171
172
  first_prompt=None,
@@ -223,6 +224,7 @@ class ArtificialIntelligenceUsageTests(unittest.TestCase):
223
224
  plan_prompts=1,
224
225
  goal_prompts=1,
225
226
  repository="Unknown",
227
+ model="Unknown",
226
228
  language="Unknown",
227
229
  session_id=None,
228
230
  first_prompt=None,
@@ -246,6 +248,8 @@ class ArtificialIntelligenceUsageTests(unittest.TestCase):
246
248
  }
247
249
  },
248
250
  },
251
+ {"type": "turn_context", "payload": {"model": "gpt-test"}},
252
+ {"type": "turn_context", "payload": {"model": "gpt-later"}},
249
253
  {
250
254
  "type": "response_item",
251
255
  "payload": {
@@ -294,6 +298,7 @@ class ArtificialIntelligenceUsageTests(unittest.TestCase):
294
298
  analysis = artificial_intelligence_usage.analyze_session(session_file)
295
299
 
296
300
  self.assertEqual(analysis.repository, "kaizten/example")
301
+ self.assertEqual(analysis.model, "gpt-test")
297
302
  self.assertEqual(analysis.language, "Spanish")
298
303
  self.assertEqual(analysis.session_id, "session-example")
299
304
  self.assertEqual(
@@ -576,14 +581,15 @@ class ArtificialIntelligenceUsageTests(unittest.TestCase):
576
581
  self.assertRegex(report, r"Start\s+Finish\s+Repository")
577
582
  self.assertIn("Name", report)
578
583
  self.assertIn("First prompt", report)
584
+ self.assertRegex(report, r"First prompt\s+Model\s+Turns")
579
585
  self.assertIn("Repository", report)
580
586
  self.assertRegex(
581
587
  report,
582
- r"2026-10-04\s+09:00:00\s+10:05:06\s+kaizten/example\s+Updated se\s+Please update the us\s+1\s+1\s+1\s+1\s+English\s+100",
588
+ r"2026-10-04\s+09:00:00\s+10:05:06\s+kaizten/example\s+Updated se\s+Please update the us\s+gpt-test\s+1\s+1\s+1\s+1\s+English\s+100",
583
589
  )
584
590
  self.assertRegex(
585
591
  report,
586
- r"2026-10-04\s+10:00:00\s+In progress\s+Unknown\s+Unknown\s+Please update the us\s+2\s+1\s+0\s+0\s+English\s+250",
592
+ r"2026-10-04\s+10:00:00\s+In progress\s+Unknown\s+Unknown\s+Please update the us\s+Unknown\s+2\s+1\s+0\s+0\s+English\s+250",
587
593
  )
588
594
  self.assertLess(report.index("09:00:00"), report.index("10:00:00"))
589
595
  daily_report = report[report.index("Date") :]
@@ -639,7 +645,7 @@ class ArtificialIntelligenceUsageTests(unittest.TestCase):
639
645
  session_table = output.getvalue()[output.getvalue().index("Sessions") :]
640
646
  self.assertRegex(
641
647
  session_table,
642
- r"11:00:00\s+In progress\s+Unknown\s+Unknown\s+Run the existing tes\s+0\s+0\s+0\s+1\s+Unknown\s+75",
648
+ r"11:00:00\s+In progress\s+Unknown\s+Unknown\s+Run the existing tes\s+Unknown\s+0\s+0\s+0\s+1\s+Unknown\s+75",
643
649
  )
644
650
 
645
651
  def test_main_can_be_called_repeatedly(self):