diff --git a/CHANGELOG.md b/CHANGELOG.md index f5c3f6f..a7145fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,3 +23,7 @@ ## [0.2.6] - 2025-03-07 - Fixed span for local adapter. + +## [0.2.7] - 2025-03-07 + +- Fixed generation update and model field in traces. diff --git a/Gemfile.lock b/Gemfile.lock index b62d5d8..849e3da 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - llm_eval_ruby (0.2.6) + llm_eval_ruby (0.2.7) httparty (~> 0.22.0) liquid (~> 5.5.0) diff --git a/lib/llm_eval_ruby/api_clients/langfuse.rb b/lib/llm_eval_ruby/api_clients/langfuse.rb index d0a2b8a..f4aa273 100644 --- a/lib/llm_eval_ruby/api_clients/langfuse.rb +++ b/lib/llm_eval_ruby/api_clients/langfuse.rb @@ -23,15 +23,19 @@ def fetch_prompt(name:, version:) response["prompt"] end + # We are using the same method for updating trace + # Langfuse does an upsert if id is given def create_trace(params = {}) body = { - id: params[:id], - name: params[:name], - input: params[:input], - sessionId: params[:session_id], - userId: params[:user_id], - metadata: params[:metadata] || {} + id: params[:id] } + body[:name] = params[:name] if params[:name] + body[:input] = params[:input] if params[:input] + body[:sessionId] = params[:session_id] if params[:session_id] + body[:userId] = params[:user_id] if params[:user_id] + body[:metadata] = params[:metadata] if params[:metadata] + body[:output] = params[:output] if params[:output] + create_event(type: "trace-create", body:) end @@ -67,6 +71,7 @@ def create_generation(params = {}) release: params[:release] || "UNKNOWN", version: params[:version] || "UNKNOWN", metadata: params[:metadata] || {}, + model: params[:model] || "UNKNOWN", promptName: params[:prompt_name], promptVersion: params[:prompt_version] } diff --git a/lib/llm_eval_ruby/trace_types.rb b/lib/llm_eval_ruby/trace_types.rb index 2c96a2c..b08167a 100644 --- a/lib/llm_eval_ruby/trace_types.rb +++ b/lib/llm_eval_ruby/trace_types.rb @@ -17,6 +17,7 @@ module TraceTypes :prompt_version, :usage, :metadata, + :model, keyword_init: true) do def end(output:, usage: nil) self.output = output diff --git a/lib/llm_eval_ruby/version.rb b/lib/llm_eval_ruby/version.rb index 869eb7c..150d32b 100644 --- a/lib/llm_eval_ruby/version.rb +++ b/lib/llm_eval_ruby/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module LlmEvalRuby - VERSION = "0.2.6" + VERSION = "0.2.7" end diff --git a/spec/llm_eval_ruby_spec.rb b/spec/llm_eval_ruby_spec.rb index c086bab..093096f 100644 --- a/spec/llm_eval_ruby_spec.rb +++ b/spec/llm_eval_ruby_spec.rb @@ -2,6 +2,6 @@ RSpec.describe LlmEvalRuby do it "has a version number" do - expect(LlmEvalRuby::VERSION).to be("0.2.6") + expect(LlmEvalRuby::VERSION).to be("0.2.7") end end