llm_logs 0.2.2 → 0.2.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5eb2c037f1c19d83e843722bd9ca664324311e7fb6b75de47a96569919cae05b
4
- data.tar.gz: 0db8f27945ce97dd74f9e4fedb5c337b68af537a83ab17dfc3f6bcd9ad18d360
3
+ metadata.gz: 947886386e7977dfd28f610d7878e44439eecf34a8094b2b1c3f4ed2a731bf01
4
+ data.tar.gz: 5181dbc0013dcbe2b86b7ca5237bdcb029b791fc761bf370fb1ac93e50862318
5
5
  SHA512:
6
- metadata.gz: fa82e4b390f8528a1d89c386ffb92b3c51f7e2f496ecec4061d4357dac679eb880dec648f6ca2d8885c256b3f175c8821a96143e318ac4e875dfa39aea4fe578
7
- data.tar.gz: 8f3c2ae33e33667c3b4d1afa60a3afbe3154e6f5f6c9982892e772d4c8d7c60f5b5fa7c437ab5c597f79f9eefe9a0ecafea1642f6280e0508143d91ee20d50b2
6
+ metadata.gz: 19b3b958e89a72e3739d328c11a2c6ff19ff1ef622ee6ad1c065395c312364f580548377413c400079c040f6981fe95fd9e5befaae1ba4ab4ce018e881c68a5f
7
+ data.tar.gz: 66739a855a5a631959ae6e50a47538319db5464b221a327da94c8ff797e30f725bc3199cf7fcad7666cc41cc871cf6474c816da2fbf4320ecfddbedc8c470474
@@ -1,7 +1,7 @@
1
1
  module LlmLogs
2
2
  class TracesController < ApplicationController
3
3
  def index
4
- @traces = Trace.recent
4
+ @traces = Trace.recent.includes(batch_request: :batch)
5
5
  @traces = @traces.by_status(params[:status]) if params[:status].present?
6
6
  if params[:prompt_version_id].present?
7
7
  @traces = @traces.where(prompt_version_id: params[:prompt_version_id])
@@ -1,6 +1,7 @@
1
1
  module LlmLogs
2
2
  class Trace < ApplicationRecord
3
3
  has_many :spans, dependent: :destroy
4
+ has_one :batch_request, class_name: "LlmLogs::BatchRequest", dependent: :nullify
4
5
  belongs_to :prompt_version, class_name: "LlmLogs::PromptVersion", optional: true
5
6
 
6
7
  validates :name, presence: true
@@ -15,6 +15,7 @@
15
15
  <table class="min-w-full divide-y divide-gray-200">
16
16
  <thead class="bg-gray-50">
17
17
  <tr>
18
+ <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">ID</th>
18
19
  <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">Purpose</th>
19
20
  <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">Model</th>
20
21
  <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">OpenAI Batch</th>
@@ -27,6 +28,7 @@
27
28
  <% status_colors = { "pending" => "bg-gray-100 text-gray-800", "submitted" => "bg-yellow-100 text-yellow-800", "completed" => "bg-blue-100 text-blue-800", "reconciled" => "bg-green-100 text-green-800", "failed" => "bg-red-100 text-red-800", "expired" => "bg-red-100 text-red-800" } %>
28
29
  <% @batches.each do |batch| %>
29
30
  <tr class="hover:bg-gray-50">
31
+ <td class="px-4 py-3 text-sm"><%= link_to "##{batch.id}", batch_path(batch), class: "text-indigo-600 hover:text-indigo-900 font-mono" %></td>
30
32
  <td class="px-4 py-3 text-sm"><%= link_to batch.purpose, batch_path(batch), class: "text-indigo-600 hover:text-indigo-900 font-medium" %></td>
31
33
  <td class="px-4 py-3 text-sm text-gray-500"><%= batch.model %></td>
32
34
  <td class="px-4 py-3 text-sm text-gray-500 font-mono"><%= batch.openai_batch_id %></td>
@@ -38,7 +40,7 @@
38
40
  </tr>
39
41
  <% end %>
40
42
  <% if @batches.empty? %>
41
- <tr><td colspan="6" class="px-4 py-8 text-center text-sm text-gray-500">No batches found.</td></tr>
43
+ <tr><td colspan="7" class="px-4 py-8 text-center text-sm text-gray-500">No batches found.</td></tr>
42
44
  <% end %>
43
45
  </tbody>
44
46
  </table>
@@ -35,7 +35,7 @@
35
35
  </dl>
36
36
  </td>
37
37
  <td class="px-4 py-3 text-sm">
38
- <%= link_to "trace", trace_path(request.trace_id), class: "text-indigo-600 hover:text-indigo-900" if request.trace_id %>
38
+ <%= link_to "##{request.trace_id}", trace_path(request.trace_id), class: "text-indigo-600 hover:text-indigo-900 font-mono" if request.trace_id %>
39
39
  </td>
40
40
  <td class="px-4 py-3 text-xs text-red-600"><%= request.error %></td>
41
41
  </tr>
@@ -28,6 +28,7 @@
28
28
  <table class="min-w-full divide-y divide-gray-200">
29
29
  <thead class="bg-gray-50">
30
30
  <tr>
31
+ <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">ID</th>
31
32
  <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">Name</th>
32
33
  <th class="px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase">Spans</th>
33
34
  <th class="px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase">Tokens</th>
@@ -40,8 +41,12 @@
40
41
  <tbody class="divide-y divide-gray-200">
41
42
  <% @traces.each do |trace| %>
42
43
  <tr class="hover:bg-gray-50">
44
+ <td class="px-4 py-3 text-sm"><%= link_to "##{trace.id}", trace_path(trace), class: "text-indigo-600 hover:text-indigo-900 font-mono" %></td>
43
45
  <td class="px-4 py-3 text-sm">
44
46
  <%= link_to trace.name, trace_path(trace), class: "text-indigo-600 hover:text-indigo-900 font-medium" %>
47
+ <% if (batch = trace.batch_request&.batch) %>
48
+ <%= link_to "##{batch.id}", batch_path(batch), class: "ml-1 text-xs text-gray-400 hover:text-indigo-900", title: "Batch #{batch.purpose}" %>
49
+ <% end %>
45
50
  </td>
46
51
  <td class="px-4 py-3 text-sm text-gray-500 text-right"><%= trace.spans_count %></td>
47
52
  <td class="px-4 py-3 text-sm text-gray-500 text-right">
@@ -68,7 +73,7 @@
68
73
 
69
74
  <% if @traces.empty? %>
70
75
  <tr>
71
- <td colspan="7" class="px-4 py-8 text-center text-sm text-gray-500">No traces found.</td>
76
+ <td colspan="8" class="px-4 py-8 text-center text-sm text-gray-500">No traces found.</td>
72
77
  </tr>
73
78
  <% end %>
74
79
  </tbody>
@@ -1,3 +1,3 @@
1
1
  module LlmLogs
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llm_logs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton