Skip to content

Commit 71bab3a

Browse files
committed
Initial install of ruby-llm.
1 parent b45215e commit 71bab3a

109 files changed

Lines changed: 4137 additions & 4 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,20 @@ gem 'image_processing', '~> 1.2'
4242
gem 'action_policy'
4343
gem 'blanks' # ActiveRecord-like forms.
4444
gem 'cocina_display'
45+
gem 'commonmarker' # For rendering markdown in system and tool messages.
4546
gem 'config'
4647
gem 'csv'
4748
gem 'dor-services-client', '~> 15.1'
4849
gem 'dry-monads'
50+
gem 'googleauth' # For Vertex AI authentication
51+
gem 'hashdiff' # For showing differences between original and updated cocina descriptions.
4952
gem 'honeybadger'
5053
gem 'mission_control-jobs'
5154
gem 'okcomputer'
5255
gem 'roo' # work with newer Excel files and other types (xlsx, ods, csv).
5356
# Note that dropping roo-xls for older xls support since not updated for roo 3.x.
5457
gem 'rsolr'
58+
gem 'ruby_llm'
5559
gem 'sdr_view_components'
5660
gem 'view_component'
5761

Gemfile.lock

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/agents/.gitkeep

Whitespace-only changes.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
# Agent that determines the Cocina field that is being updated based on the user's request.
4+
class CocinaDescriptionClassifierAgent < RubyLLM::Agent
5+
model 'gemini-3.1-flash-lite-preview', provider: Rails.env.production? ? :vertexai : :gemini
6+
7+
instructions
8+
schema do
9+
string :field,
10+
enum: %w[title contributor event form language note identifier subject access geographic
11+
relatedResource adminMetadata marcEncodedData valueAt none]
12+
end
13+
thinking effort: :low
14+
temperature 1.0 # With Gemini 3+, recommended to keep >= 1.0
15+
end
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# frozen_string_literal: true
2+
3+
# Agent that updates a Cocina description based on the user's request.
4+
class CocinaDescriptionEditorAgent < RubyLLM::Agent
5+
# model 'gemini-3-flash-preview', provider: Rails.env.production? ? :vertexai : :gemini
6+
model 'gemini-3.1-flash-lite-preview', provider: Rails.env.production? ? :vertexai : :gemini
7+
chat_model Chat
8+
tools UrlFetchTool, ModelTool
9+
params generationConfig: { responseMimeType: 'application/json' }
10+
temperature 1.0 # With Gemini 3+, recommended to keep >= 1.0
11+
thinking effort: :medium
12+
end

app/assets/stylesheets/application.bootstrap.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
@import 'bl_facets';
44
@import 'search';
55
@import 'show';
6+
@import 'show_editor';
67

78
/* Header color */
89
.stone-dark {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Styles for the show editor page
2+
3+
.container:has(div[data-description-changed="true"]) #save-btn {
4+
display: block;
5+
}
6+
7+
#save-btn {
8+
display: none;
9+
}
10+
11+
.container:has(#system-and-tool-messages div) #system-messages-btn {
12+
display: inline-block;
13+
}
14+
15+
#system-messages-btn {
16+
display: none;
17+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<div class="card" id="cocina-description-card">
2+
<div class="card-body">
3+
<%= render Elements::JsonViewerComponent.new(hash: cocina_description_hash, expanded: 1, show_tip: true) %>
4+
</div>
5+
</div>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# frozen_string_literal: true
2+
3+
module DescriptionEditor
4+
class CocinaDescriptionCardComponent < ApplicationComponent
5+
def initialize(cocina_description_hash:)
6+
@cocina_description_hash = cocina_description_hash
7+
super()
8+
end
9+
10+
private
11+
12+
attr_reader :cocina_description_hash
13+
end
14+
end
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<div class="fst-italic fw-semibold"><%= change_type %> at <%= path %>:</div>
2+
<%= render Elements::JsonViewerComponent.new(hash: change_value, show_toolbar: false) %>

0 commit comments

Comments
 (0)