Skip to content

Commit 4c8f4e7

Browse files
authored
fix(sdk): support content as an array (#13)
1 parent 4873264 commit 4c8f4e7

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

sample-app/Gemfile.lock

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ GEM
44
addressable (2.8.7)
55
public_suffix (>= 2.0.2, < 7.0)
66
aws-eventstream (1.3.0)
7-
aws-partitions (1.987.0)
8-
aws-sdk-bedrockruntime (1.26.0)
9-
aws-sdk-core (~> 3, >= 3.207.0)
7+
aws-partitions (1.1003.0)
8+
aws-sdk-bedrockruntime (1.31.0)
9+
aws-sdk-core (~> 3, >= 3.210.0)
1010
aws-sigv4 (~> 1.5)
11-
aws-sdk-core (3.209.1)
11+
aws-sdk-core (3.212.0)
1212
aws-eventstream (~> 1, >= 1.3.0)
13-
aws-partitions (~> 1, >= 1.651.0)
13+
aws-partitions (~> 1, >= 1.992.0)
1414
aws-sigv4 (~> 1.9)
1515
jmespath (~> 1, >= 1.6.1)
16-
aws-sigv4 (1.10.0)
16+
aws-sigv4 (1.10.1)
1717
aws-eventstream (~> 1, >= 1.0.2)
1818
base64 (0.2.0)
1919
ethon (0.16.0)
@@ -42,21 +42,21 @@ GEM
4242
google-protobuf (3.25.5-arm64-darwin)
4343
googleapis-common-protos-types (1.16.0)
4444
google-protobuf (>= 3.18, < 5.a)
45-
googleauth (1.11.1)
45+
googleauth (1.11.2)
4646
faraday (>= 1.0, < 3.a)
4747
google-cloud-env (~> 2.1)
4848
jwt (>= 1.4, < 3.0)
4949
multi_json (~> 1.11)
5050
os (>= 0.9, < 2.0)
5151
signet (>= 0.16, < 2.a)
5252
jmespath (1.6.2)
53-
json (2.7.2)
53+
json (2.8.1)
5454
jwt (2.9.3)
5555
base64
5656
logger (1.6.1)
5757
multi_json (1.15.0)
5858
multipart-post (2.4.1)
59-
net-http (0.4.1)
59+
net-http (0.5.0)
6060
uri
6161
opentelemetry-api (1.4.0)
6262
opentelemetry-common (0.21.0)
@@ -81,7 +81,7 @@ GEM
8181
opentelemetry-api (~> 1.0)
8282
os (1.1.4)
8383
public_suffix (6.0.1)
84-
ruby-openai (7.1.0)
84+
ruby-openai (7.3.1)
8585
event_stream_parser (>= 0.3.0, < 2.0.0)
8686
faraday (>= 1)
8787
faraday-multipart (>= 1)
@@ -90,13 +90,13 @@ GEM
9090
faraday (>= 0.17.5, < 3.a)
9191
jwt (>= 1.5, < 3.0)
9292
multi_json (~> 1.10)
93-
traceloop-sdk (0.1.4)
93+
traceloop-sdk (0.1.5)
9494
opentelemetry-exporter-otlp (~> 0.26.1)
9595
opentelemetry-sdk (~> 1.3.1)
9696
opentelemetry-semantic_conventions_ai (~> 0.0.3)
9797
typhoeus (1.4.1)
9898
ethon (>= 0.9.0)
99-
uri (0.13.1)
99+
uri (1.0.1)
100100

101101
PLATFORMS
102102
arm64-darwin-23

traceloop-sdk/lib/traceloop/sdk.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
require "opentelemetry/sdk"
32
require "opentelemetry/exporter/otlp"
43
require 'opentelemetry-semantic_conventions_ai'
@@ -31,9 +30,10 @@ def initialize(span, provider, model)
3130

3231
def log_messages(messages)
3332
messages.each_with_index do |message, index|
33+
content = message[:content].is_a?(Array) ? message[:content].to_json : (message[:content] || "")
3434
@span.add_attributes({
3535
"#{OpenTelemetry::SemanticConventionsAi::SpanAttributes::LLM_PROMPTS}.#{index}.role" => message[:role] || "user",
36-
"#{OpenTelemetry::SemanticConventionsAi::SpanAttributes::LLM_PROMPTS}.#{index}.content" => message[:content] || "",
36+
"#{OpenTelemetry::SemanticConventionsAi::SpanAttributes::LLM_PROMPTS}.#{index}.content" => content,
3737
})
3838
end
3939
end

traceloop-sdk/traceloop-sdk.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |spec|
22
spec.name = 'traceloop-sdk'
3-
spec.version = '0.1.4'
3+
spec.version = '0.1.5'
44
spec.authors = ["Traceloop"]
55
spec.email = ['[email protected]']
66

0 commit comments

Comments
 (0)