llm_logs 0.2.3 → 0.2.6

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: 947886386e7977dfd28f610d7878e44439eecf34a8094b2b1c3f4ed2a731bf01
4
- data.tar.gz: 5181dbc0013dcbe2b86b7ca5237bdcb029b791fc761bf370fb1ac93e50862318
3
+ metadata.gz: 2d74b0f40702d1e844d16656a8c3e9c48f6f8f6fc6114097153b4d93389cd123
4
+ data.tar.gz: 20287a2481a84ed43c6967801b09c40ec4e533a78c87e10f315e9dbc37f866d1
5
5
  SHA512:
6
- metadata.gz: 19b3b958e89a72e3739d328c11a2c6ff19ff1ef622ee6ad1c065395c312364f580548377413c400079c040f6981fe95fd9e5befaae1ba4ab4ce018e881c68a5f
7
- data.tar.gz: 66739a855a5a631959ae6e50a47538319db5464b221a327da94c8ff797e30f725bc3199cf7fcad7666cc41cc871cf6474c816da2fbf4320ecfddbedc8c470474
6
+ metadata.gz: 0f24855ed39f9e45b2c734ee66195045846bf6ba6b2834e83ff7f1b91a51af1d6f5042a31053a85ca662913743275d355f4e30616fa60cc6fc0255412c44afdd
7
+ data.tar.gz: 1ce3ee37439dfa90986394cf39e85bd67c6631d6d96a9c7138e0c2224af9a27a5d6d7c8661cb7c71950a8ed640f12f0396d7656bf073e4033d31632129cb87ea
data/README.md CHANGED
@@ -267,6 +267,7 @@ LlmLogs.setup do |config|
267
267
  config.prompt_subfolders = %w[skills fragments templates]
268
268
  config.batch_enabled = true # enable the batch API integration
269
269
  config.batch_provider = :openai_responses # batch backend
270
+ config.page_size = 50 # rows per page on all index pages
270
271
  end
271
272
  ```
272
273
 
@@ -4,12 +4,12 @@ module LlmLogs
4
4
  @batches = Batch.recent
5
5
  @batches = @batches.where(purpose: params[:purpose]) if params[:purpose].present?
6
6
  @batches = @batches.where(status: params[:status]) if params[:status].present?
7
- @batches = @batches.page(params[:page]).per(50)
7
+ @batches = @batches.page(params[:page]).per(LlmLogs.page_size)
8
8
  end
9
9
 
10
10
  def show
11
11
  @batch = Batch.find(params[:id])
12
- @requests = @batch.requests.order(:created_at).page(params[:page]).per(100)
12
+ @requests = @batch.requests.order(:created_at).page(params[:page]).per(LlmLogs.page_size)
13
13
  end
14
14
  end
15
15
  end
@@ -8,7 +8,7 @@ module LlmLogs
8
8
  @direction = params[:direction] == "desc" ? "desc" : "asc"
9
9
  scope = Prompt.order(SORT_COLUMNS.fetch(@sort) => @direction.to_sym).includes(:versions)
10
10
  scope = scope.with_tag(tag) if tag
11
- @prompts = scope.page(params[:page]).per(25)
11
+ @prompts = scope.page(params[:page]).per(LlmLogs.page_size)
12
12
  @active_tag = tag
13
13
  @all_tags = Prompt.pluck(:tags).flatten.compact.uniq.sort
14
14
  end
@@ -7,7 +7,7 @@ module LlmLogs
7
7
  @traces = @traces.where(prompt_version_id: params[:prompt_version_id])
8
8
  @filter_version = PromptVersion.find_by(id: params[:prompt_version_id])
9
9
  end
10
- @traces = @traces.page(params[:page]).per(50)
10
+ @traces = @traces.page(params[:page]).per(LlmLogs.page_size)
11
11
  end
12
12
 
13
13
  def show
@@ -44,8 +44,23 @@ module LlmLogs
44
44
 
45
45
  def self.batchable?(model)
46
46
  return false unless LlmLogs.batch_enabled?
47
+ return false unless defined?(RubyLLM::Providers::OpenAIResponses)
47
48
 
48
- !defined?(RubyLLM::Providers::OpenAIResponses).nil?
49
+ servable_by_batch_provider?(model)
50
+ end
51
+
52
+ # The batch path submits via RubyLLM.batch(provider: batch_provider). A model is
53
+ # only batchable if that provider can actually serve it -- i.e. the model resolves
54
+ # under batch_provider. Models that belong to a different provider (e.g. Bedrock /
55
+ # Anthropic) don't resolve there, so they return false and the caller runs them
56
+ # synchronously instead of enqueueing work that would fail at submit time.
57
+ def self.servable_by_batch_provider?(model)
58
+ RubyLLM::Models.resolve(
59
+ model, provider: LlmLogs.batch_provider, assume_exists: false, config: RubyLLM.config
60
+ )
61
+ true
62
+ rescue RubyLLM::ModelNotFoundError
63
+ false
49
64
  end
50
65
  end
51
66
  end
@@ -1,7 +1,7 @@
1
1
  module LlmLogs
2
2
  class Configuration
3
3
  attr_accessor :enabled, :auto_instrument, :retention_days, :prompts_source_path, :prompt_subfolders,
4
- :batch_enabled, :batch_provider
4
+ :batch_enabled, :batch_provider, :page_size
5
5
 
6
6
  def initialize
7
7
  @enabled = true
@@ -11,6 +11,7 @@ module LlmLogs
11
11
  @prompt_subfolders = %w[skills fragments templates]
12
12
  @batch_enabled = true
13
13
  @batch_provider = :openai_responses
14
+ @page_size = 50
14
15
  end
15
16
  end
16
17
 
@@ -1,3 +1,3 @@
1
1
  module LlmLogs
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.6"
3
3
  end
data/lib/llm_logs.rb CHANGED
@@ -38,6 +38,14 @@ module LlmLogs
38
38
  configuration.retention_days = retention_days
39
39
  end
40
40
 
41
+ def self.page_size
42
+ configuration.page_size
43
+ end
44
+
45
+ def self.page_size=(page_size)
46
+ configuration.page_size = page_size
47
+ end
48
+
41
49
  def self.batch_enabled?
42
50
  configuration.batch_enabled
43
51
  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.3
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton