openlayer 0.7.0 → 0.8.0
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 +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +1 -1
- data/lib/openlayer/integrations/google_conversational_search_tracer.rb +24 -3
- data/lib/openlayer/internal/util.rb +7 -2
- data/lib/openlayer/version.rb +1 -1
- data/rbi/openlayer/integrations.rbi +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d27be2afe4632dccf14077f8fecaf96b1e67d6cf81fb4bca4917d9a31a6bd66b
|
|
4
|
+
data.tar.gz: ba4f55cf2470fcad21b26531a3adfc0d59cdfae106cdd7ca65ad0d072093d618
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0313bd3321521fb207a7aa14844cb4e5f91131457baaff2b8451b5b0ec750f646e747694301c9b284d4ca86e49dc61bac63e63db0bcbe62a58abbf7e4d97e2d9
|
|
7
|
+
data.tar.gz: 1da5a6642fb3493d2484c67314f6ded8d619edab534b6d455a382caba85fdd6ec61839dabfabaff2c8be2c5ba38643680d4196fbc24316f685be460ba0430598
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.0 (2026-01-05)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.7.1...v0.8.0](https://github.com/openlayer-ai/openlayer-ruby/compare/v0.7.1...v0.8.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **closes OPEN-8574:** session and user id support for the ConversationalSearchService tracer ([9157c52](https://github.com/openlayer-ai/openlayer-ruby/commit/9157c528195ae1a3c56ba652b8b598a2c2e53eab))
|
|
10
|
+
|
|
11
|
+
## 0.7.1 (2025-12-19)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v0.7.0...v0.7.1](https://github.com/openlayer-ai/openlayer-ruby/compare/v0.7.0...v0.7.1)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* issue where json.parse errors when receiving HTTP 204 with nobody ([cd07b68](https://github.com/openlayer-ai/openlayer-ruby/commit/cd07b686e5ab45fb20726638181f1c9b6590a181))
|
|
18
|
+
|
|
3
19
|
## 0.7.0 (2025-12-17)
|
|
4
20
|
|
|
5
21
|
Full Changelog: [v0.6.0...v0.7.0](https://github.com/openlayer-ai/openlayer-ruby/compare/v0.6.0...v0.7.0)
|
data/README.md
CHANGED
|
@@ -38,8 +38,12 @@ module Openlayer
|
|
|
38
38
|
# The Openlayer client instance for sending traces
|
|
39
39
|
# @param inference_pipeline_id [String]
|
|
40
40
|
# The Openlayer inference pipeline ID to send traces to
|
|
41
|
+
# @param session_id [String, nil]
|
|
42
|
+
# Optional session ID to use for all traces. Takes precedence over auto-extracted sessions.
|
|
43
|
+
# @param user_id [String, nil]
|
|
44
|
+
# Optional user ID to use for all traces.
|
|
41
45
|
# @return [void]
|
|
42
|
-
def self.trace_client(client, openlayer_client:, inference_pipeline_id:)
|
|
46
|
+
def self.trace_client(client, openlayer_client:, inference_pipeline_id:, session_id: nil, user_id: nil)
|
|
43
47
|
# Store original method reference
|
|
44
48
|
original_answer_query = client.method(:answer_query)
|
|
45
49
|
|
|
@@ -63,7 +67,9 @@ module Openlayer
|
|
|
63
67
|
start_time: start_time,
|
|
64
68
|
end_time: end_time,
|
|
65
69
|
openlayer_client: openlayer_client,
|
|
66
|
-
inference_pipeline_id: inference_pipeline_id
|
|
70
|
+
inference_pipeline_id: inference_pipeline_id,
|
|
71
|
+
session_id: session_id,
|
|
72
|
+
user_id: user_id
|
|
67
73
|
)
|
|
68
74
|
rescue StandardError => e
|
|
69
75
|
# Never break the user's application due to tracing errors
|
|
@@ -87,8 +93,10 @@ module Openlayer
|
|
|
87
93
|
# @param end_time [Time] Request end time
|
|
88
94
|
# @param openlayer_client [Openlayer::Client] Openlayer client instance
|
|
89
95
|
# @param inference_pipeline_id [String] Pipeline ID
|
|
96
|
+
# @param session_id [String, nil] Optional session ID (takes precedence over auto-extracted)
|
|
97
|
+
# @param user_id [String, nil] Optional user ID
|
|
90
98
|
# @return [void]
|
|
91
|
-
def self.send_trace(args:, kwargs:, response:, start_time:, end_time:, openlayer_client:, inference_pipeline_id:)
|
|
99
|
+
def self.send_trace(args:, kwargs:, response:, start_time:, end_time:, openlayer_client:, inference_pipeline_id:, session_id: nil, user_id: nil)
|
|
92
100
|
# Calculate latency
|
|
93
101
|
latency_ms = ((end_time - start_time) * 1000).round(2)
|
|
94
102
|
|
|
@@ -145,6 +153,19 @@ module Openlayer
|
|
|
145
153
|
]
|
|
146
154
|
}
|
|
147
155
|
|
|
156
|
+
# Determine which session to use (kwarg takes precedence over auto-extracted)
|
|
157
|
+
final_session = session_id || metadata[:session]
|
|
158
|
+
if final_session
|
|
159
|
+
trace_data[:rows][0][:session_id] = final_session
|
|
160
|
+
trace_data[:config][:sessionIdColumnName] = "session_id"
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Add user_id if provided
|
|
164
|
+
if user_id
|
|
165
|
+
trace_data[:rows][0][:user_id] = user_id
|
|
166
|
+
trace_data[:config][:userIdColumnName] = "user_id"
|
|
167
|
+
end
|
|
168
|
+
|
|
148
169
|
# Send to Openlayer
|
|
149
170
|
openlayer_client
|
|
150
171
|
.inference_pipelines
|
|
@@ -657,7 +657,8 @@ module Openlayer
|
|
|
657
657
|
def decode_content(headers, stream:, suppress_error: false)
|
|
658
658
|
case (content_type = headers["content-type"])
|
|
659
659
|
in Openlayer::Internal::Util::JSON_CONTENT
|
|
660
|
-
json = stream.to_a.join
|
|
660
|
+
return nil if (json = stream.to_a.join).empty?
|
|
661
|
+
|
|
661
662
|
begin
|
|
662
663
|
JSON.parse(json, symbolize_names: true)
|
|
663
664
|
rescue JSON::ParserError => e
|
|
@@ -667,7 +668,11 @@ module Openlayer
|
|
|
667
668
|
in Openlayer::Internal::Util::JSONL_CONTENT
|
|
668
669
|
lines = decode_lines(stream)
|
|
669
670
|
chain_fused(lines) do |y|
|
|
670
|
-
lines.each
|
|
671
|
+
lines.each do
|
|
672
|
+
next if _1.empty?
|
|
673
|
+
|
|
674
|
+
y << JSON.parse(_1, symbolize_names: true)
|
|
675
|
+
end
|
|
671
676
|
end
|
|
672
677
|
in %r{^text/event-stream}
|
|
673
678
|
lines = decode_lines(stream)
|
data/lib/openlayer/version.rb
CHANGED
|
@@ -8,13 +8,17 @@ module Openlayer
|
|
|
8
8
|
params(
|
|
9
9
|
client: T.untyped,
|
|
10
10
|
openlayer_client: Openlayer::Client,
|
|
11
|
-
inference_pipeline_id: String
|
|
11
|
+
inference_pipeline_id: String,
|
|
12
|
+
session_id: T.nilable(String),
|
|
13
|
+
user_id: T.nilable(String)
|
|
12
14
|
).void
|
|
13
15
|
end
|
|
14
16
|
def self.trace_client(
|
|
15
17
|
client,
|
|
16
18
|
openlayer_client:,
|
|
17
|
-
inference_pipeline_id
|
|
19
|
+
inference_pipeline_id:,
|
|
20
|
+
session_id: nil,
|
|
21
|
+
user_id: nil
|
|
18
22
|
)
|
|
19
23
|
end
|
|
20
24
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: openlayer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Openlayer
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-01-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: connection_pool
|