llm_meta_client 0.5.0 → 0.6.1

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: 60116965474267f22c077da1849611c0b6c4490a876a98deebfa243d2f9aef49
4
- data.tar.gz: 748fdc1631edcb65c7792b1dc13a3ae8d0625422c05d4e4a47732f9c8167a7d9
3
+ metadata.gz: 931f6b078e6df954f5ab32218cb31c4c743112ed6ae037c3e027102cec3089d4
4
+ data.tar.gz: 52febe0e221d964ad286ce8ad7ebb0ad595a8d80b87a4afa55af54e82e82873d
5
5
  SHA512:
6
- metadata.gz: c87684a604a914fe6097a1277948d009530f83a07ec7991aa5b6caa92ce8d2eb9568b4a55b648ba2b50f12e06bb9df95e31333bd211a56289cad4c3c3c8ddc33
7
- data.tar.gz: 6ba2df271d37e40be53981e40c8c416239318872118019da88bdd35a845607d28e95d9f33e53328442b85f309448e30e6d7b8a874dcbd68996760be61ea97cb3
6
+ metadata.gz: 6216c95f340ae0ef1b3e9ee54bd8a0906c2001d50ac45139df4f8da584c856962b462182e7fcc20e94c8785e6923f50f04882bf534da300bc8946fef5308cfa1
7
+ data.tar.gz: 2223f1a7381b9bdb484a1ec8fade18c5b83789b007b6f078680887a81db4c6a5854572310a108864eba89656cff980359b9602e14a9cdae752d8d0ad98d7a48e
data/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.6.1] - 2026-03-19
9
+
10
+ ### Fixed
11
+
12
+ - Fix remaining `prompt_manager_prompt_execution` reference in chat model template (renamed to `prompt_navigator_prompt_execution`)
13
+
14
+ ## [0.6.0] - 2026-03-18
15
+
16
+ ### Changed
17
+
18
+ - Rename `prompt_manager` references to `prompt_navigator` across all scaffold templates (models, controllers, views, migrations, generator config)
19
+ - Refactor chat template to use `PromptExecution#build_context` instead of manual message iteration
20
+ - Update `prompt_navigator` gem to 0.3.0
21
+
8
22
  ## [0.5.0] - 2026-03-17
9
23
 
10
24
  ### Added
@@ -97,8 +97,8 @@ module LlmMetaClient
97
97
 
98
98
  def configure_asset_paths
99
99
  inject_into_class "config/application.rb", "Application", <<-RUBY
100
- # Add asset paths for prompt_manager gem
101
- config.assets.paths << Rails.root.join("../prompt_manager/app/assets/stylesheets")
100
+ # Add asset paths for prompt_navigator gem
101
+ config.assets.paths << Rails.root.join("../prompt_navigator/app/assets/stylesheets")
102
102
  # Add asset paths for chat_manager gem
103
103
  config.assets.paths << Rails.root.join("../chat_manager/app/assets/stylesheets")
104
104
  RUBY
@@ -1,7 +1,7 @@
1
1
  class ChatsController < ApplicationController
2
2
  include ChatManager::ChatManageable
3
3
  include ChatManager::CsvDownloadable
4
- include PromptManager::HistoryManageable
4
+ include PromptNavigator::HistoryManageable
5
5
  # Allow access without login
6
6
  skip_before_action :authenticate_user!, raise: false
7
7
  before_action :authenticate_user!, only: [ :update_title, :download_csv, :download_all_csv ]
@@ -1,10 +1,10 @@
1
1
  class PromptsController < ApplicationController
2
2
  include ChatManager::ChatManageable
3
- include PromptManager::HistoryManageable
3
+ include PromptNavigator::HistoryManageable
4
4
  skip_before_action :authenticate_user!, raise: false
5
5
 
6
6
  def show
7
- @prompt_execution = PromptManager::PromptExecution.includes(:messages).find_by(execution_id: params[:id])
7
+ @prompt_execution = PromptNavigator::PromptExecution.includes(:messages).find_by(execution_id: params[:id])
8
8
  @message = @prompt_execution.messages.first
9
9
  @chat = @message.chat
10
10
  @messages = @chat.ordered_messages
@@ -51,16 +51,16 @@ class Chat < ApplicationRecord
51
51
  # Add a user message to the chat
52
52
  def add_user_message(message, model, branch_from_uuid = nil)
53
53
  parent_message = branch_from_uuid.present? ? messages.find_by(uuid: branch_from_uuid) : nil
54
- prompt_execution = PromptManager::PromptExecution.create!(
54
+ prompt_execution = PromptNavigator::PromptExecution.create!(
55
55
  prompt: message,
56
56
  model: model,
57
57
  configuration: "",
58
- previous_id: parent_message&.prompt_manager_prompt_execution_id
58
+ previous_id: parent_message&.prompt_navigator_prompt_execution_id
59
59
  )
60
60
 
61
61
  new_message = messages.create!(
62
62
  role: "user",
63
- prompt_manager_prompt_execution: prompt_execution
63
+ prompt_navigator_prompt_execution: prompt_execution
64
64
  )
65
65
 
66
66
  [ prompt_execution, new_message ]
@@ -75,7 +75,7 @@ class Chat < ApplicationRecord
75
75
  )
76
76
  new_message = messages.create!(
77
77
  role: "assistant",
78
- prompt_manager_prompt_execution: prompt_execution
78
+ prompt_navigator_prompt_execution: prompt_execution
79
79
  )
80
80
 
81
81
  new_message
@@ -84,18 +84,18 @@ class Chat < ApplicationRecord
84
84
  # Get all messages in order
85
85
  def ordered_messages
86
86
  messages
87
- .includes(:prompt_manager_prompt_execution)
87
+ .includes(:prompt_navigator_prompt_execution)
88
88
  .order(:created_at)
89
89
  end
90
90
 
91
91
  def ordered_by_descending_prompt_executions
92
92
  messages
93
93
  .where(role: "user")
94
- .includes(:prompt_manager_prompt_execution)
94
+ .includes(:prompt_navigator_prompt_execution)
95
95
  .order(created_at: :desc)
96
96
  .to_a
97
- .select { |msg| msg.prompt_manager_prompt_execution }
98
- .map(&:prompt_manager_prompt_execution)
97
+ .select { |msg| msg.prompt_navigator_prompt_execution }
98
+ .map(&:prompt_navigator_prompt_execution)
99
99
  end
100
100
 
101
101
  # Check if chat needs to be reset due to LLM or model change
@@ -129,20 +129,16 @@ class Chat < ApplicationRecord
129
129
  # Error if no LLM is available
130
130
  raise LlmMetaClient::Exceptions::OllamaUnavailableError, "No LLM available" if llm_options.empty?
131
131
 
132
- # Prepare messages for LLM
133
- all_messages = ordered_messages.to_a
134
- last_msg = all_messages.last
132
+ # Build prompt and context from direct lineage via PromptExecution
133
+ last_msg = ordered_messages.last
134
+ pe = last_msg.prompt_navigator_prompt_execution
135
135
 
136
- # Prepare prompt and context
137
- prompt = { role: last_msg.role, prompt: last_msg.prompt_manager_prompt_execution.prompt }
138
- context = all_messages[0...-1].last(Rails.configuration.summarize_conversation_count).map do |msg|
139
- { role: msg.role, prompt: msg.prompt_manager_prompt_execution.prompt, response: msg.prompt_manager_prompt_execution&.response }
140
- end
136
+ prompt = { role: last_msg.role, prompt: pe.prompt }
137
+ context = pe.build_context(limit: Rails.configuration.summarize_conversation_count)
141
138
 
142
139
  if context.empty?
143
140
  summarized_context = "No context available."
144
141
  else
145
- # Summarize context
146
142
  summarized_context = LlmMetaClient::ServerQuery.new.call(jwt_token, llm_uuid, model, context, "Please summarize the context")
147
143
  end
148
144
 
@@ -1,7 +1,7 @@
1
1
  class Message < ApplicationRecord
2
2
  belongs_to :chat
3
- belongs_to :prompt_manager_prompt_execution,
4
- class_name: "PromptManager::PromptExecution",
3
+ belongs_to :prompt_navigator_prompt_execution,
4
+ class_name: "PromptNavigator::PromptExecution",
5
5
  optional: false
6
6
 
7
7
  validates :role, presence: true, inclusion: { in: %w[user assistant] }
@@ -3,14 +3,14 @@
3
3
  <%% if message.role == 'user' %>
4
4
  👤 You
5
5
  <%% else %>
6
- 🤖 <%%= message.prompt_manager_prompt_execution.llm_platform&.capitalize || 'LLM' %>
6
+ 🤖 <%%= message.prompt_navigator_prompt_execution.llm_platform&.capitalize || 'LLM' %>
7
7
  <%% end %>
8
8
  </div>
9
9
  <div class="message-content">
10
10
  <%% if message.role == 'user' %>
11
- <%%= simple_format(message.prompt_manager_prompt_execution&.prompt) %>
11
+ <%%= simple_format(message.prompt_navigator_prompt_execution&.prompt) %>
12
12
  <%% else %>
13
- <%%= simple_format(message.prompt_manager_prompt_execution&.response) %>
13
+ <%%= simple_format(message.prompt_navigator_prompt_execution&.response) %>
14
14
  <%% end %>
15
15
  </div>
16
16
  </div>
@@ -36,14 +36,14 @@
36
36
  <div id="history-content">
37
37
  <h2>History</h2>
38
38
  <div class="history-stack" id="history-stack" data-controller="history">
39
- <%%= render 'prompt_manager/history_card', locals: {
39
+ <%%= render 'prompt_navigator/history_card', locals: {
40
40
  ann: @prompt_execution,
41
41
  next_ann: nil,
42
42
  is_active: @prompt_execution.execution_id == @active_message_uuid,
43
43
  card_path: ->(uuid) { prompt_path(uuid) }
44
44
  } %>
45
45
  <%% (@chat&.ordered_by_descending_prompt_executions || []).drop(1).each_with_index do |ann, idx| %>
46
- <%%= render 'prompt_manager/history_card', locals: {
46
+ <%%= render 'prompt_navigator/history_card', locals: {
47
47
  ann: ann,
48
48
  next_ann: @chat.ordered_by_descending_prompt_executions[idx + 2],
49
49
  is_active: ann.execution_id == @active_message_uuid,
@@ -30,14 +30,14 @@
30
30
  <div id="history-content">
31
31
  <h2>History</h2>
32
32
  <div class="history-stack" id="history-stack" data-controller="history">
33
- <%%= render 'prompt_manager/history_card', locals: {
33
+ <%%= render 'prompt_navigator/history_card', locals: {
34
34
  ann: @prompt_execution,
35
35
  next_ann: nil,
36
36
  is_active: @prompt_execution.execution_id == @active_message_uuid,
37
37
  card_path: ->(uuid) { prompt_path(uuid) }
38
38
  } %>
39
39
  <%% (@chat&.ordered_by_descending_prompt_executions || []).drop(1).each_with_index do |ann, idx| %>
40
- <%%= render 'prompt_manager/history_card', locals: {
40
+ <%%= render 'prompt_navigator/history_card', locals: {
41
41
  ann: ann,
42
42
  next_ann: @chat.ordered_by_descending_prompt_executions[idx + 2],
43
43
  is_active: ann.execution_id == @active_message_uuid,
@@ -12,7 +12,7 @@
12
12
  <%% if history.present? %>
13
13
  <div class="history-stack" id="history-stack" data-controller="history">
14
14
  <%% history.each_with_index do |ann, idx| %>
15
- <%%= render 'prompt_manager/history_card', locals: {
15
+ <%%= render 'prompt_navigator/history_card', locals: {
16
16
  ann: ann,
17
17
  next_ann: history[idx + 1],
18
18
  is_active: ann.uuid == active_uuid,
@@ -20,7 +20,7 @@
20
20
 
21
21
  <%% # Includes all stylesheet files in app/assets/stylesheets %>
22
22
  <%%= stylesheet_link_tag :app %>
23
- <%%= stylesheet_link_tag "prompt_manager/history", "data-turbo-track": "reload" %>
23
+ <%%= stylesheet_link_tag "prompt_navigator/history", "data-turbo-track": "reload" %>
24
24
  <%%= stylesheet_link_tag "chat_manager/chat", "data-turbo-track": "reload" %>
25
25
  <%%= javascript_importmap_tags %>
26
26
  </head>
@@ -3,7 +3,7 @@ class CreateMessages < ActiveRecord::Migration[8.1]
3
3
  create_table :messages do |t|
4
4
  t.references :chat, null: false, foreign_key: true
5
5
  # t.references :parent, foreign_key: { to_table: :messages }, index: true, null: true
6
- t.references :prompt_manager_prompt_execution, null: true, foreign_key: { to_table: :prompt_manager_prompt_executions }
6
+ t.references :prompt_navigator_prompt_execution, null: true, foreign_key: { to_table: :prompt_navigator_prompt_executions }
7
7
  t.string :role
8
8
 
9
9
  t.timestamps
@@ -1,3 +1,3 @@
1
1
  module LlmMetaClient
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llm_meta_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - dhq_boiler