Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@
## [0.2.4] - 2024-12-12

- [Hotfix] prompts could not compile with variables having nested hashes with keys as symbols.

## [0.2.5] - 2024-12-16

- Added metadata field to traces.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
llm_eval_ruby (0.2.4)
llm_eval_ruby (0.2.5)
httparty (~> 0.22.0)
liquid (~> 5.5.0)

Expand Down
14 changes: 9 additions & 5 deletions lib/llm_eval_ruby/api_clients/langfuse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def create_trace(params = {})
name: params[:name],
input: params[:input],
sessionId: params[:session_id],
userId: params[:user_id]
userId: params[:user_id],
metadata: params[:metadata] || {}
}
create_event(type: "trace-create", body:)
end
Expand All @@ -39,7 +40,8 @@ def create_span(params = {})
id: params[:id],
name: params[:name],
input: params[:input],
traceId: params[:trace_id]
traceId: params[:trace_id],
metadata: params[:metadata] || {}
}
create_event(type: "span-create", body:)
end
Expand All @@ -48,7 +50,8 @@ def update_span(params = {})
body = {
id: params[:id],
output: params[:output],
endTime: params[:end_time]
endTime: params[:end_time],
metadata: params[:metadata] || {}
}
create_event(type: "span-update", body:)
end
Expand All @@ -75,7 +78,8 @@ def update_generation(params = {})
id: params[:id],
output: params[:output],
endTime: params[:end_time],
usage: convert_keys_to_camel_case(params[:usage])
usage: convert_keys_to_camel_case(params[:usage]),
metadata: params[:metadata] || {}
}
create_event(type: "generation-update", body:)
end
Expand All @@ -86,7 +90,7 @@ def create_event(type:, body:)
{
id: SecureRandom.uuid,
type:,
body:,
body: body.deep_stringify_keys,
timestamp: Time.now.utc.iso8601,
metadata: {}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/llm_eval_ruby/trace_adapters/langfuse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def span(**kwargs)

return span unless block_given?

result = yield
result = yield span

end_span(span, result)

Expand Down
5 changes: 3 additions & 2 deletions lib/llm_eval_ruby/trace_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

module LlmEvalRuby
module TraceTypes
Trace = Struct.new(:id, :name, :input, :output, :session_id, :user_id, keyword_init: true)
Trace = Struct.new(:id, :name, :input, :output, :session_id, :user_id, :metadata, keyword_init: true)

Span = Struct.new(:id, :name, :trace_id, :input, :output, :end_time, keyword_init: true)
Span = Struct.new(:id, :name, :trace_id, :input, :output, :end_time, :metadata, keyword_init: true)

Generation = Struct.new(:tracer,
:id,
Expand All @@ -16,6 +16,7 @@ module TraceTypes
:prompt_name,
:prompt_version,
:usage,
:metadata,
keyword_init: true) do
def end(output:, usage: nil)
self.output = output
Expand Down
2 changes: 1 addition & 1 deletion lib/llm_eval_ruby/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module LlmEvalRuby
VERSION = "0.2.4"
VERSION = "0.2.5"
end
2 changes: 1 addition & 1 deletion spec/llm_eval_ruby_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

RSpec.describe LlmEvalRuby do
it "has a version number" do
expect(LlmEvalRuby::VERSION).to be("0.2.4")
expect(LlmEvalRuby::VERSION).to be("0.2.5")
end
end
Loading