helicone-rb 0.1.2 → 0.1.3
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/lib/helicone/agent.rb +12 -2
- data/lib/helicone/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 210ac6dc40e739a7ee0ff0478dfec18c300f786afd0b4f149a57048b1bd46ce9
|
|
4
|
+
data.tar.gz: a11ef6687f94ebdf9c9adcc56635256388718be341941fe13258ec8930c8fe29
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a9b4f50614b0f88b150f5a6457f0fb0c8fef5046451a59a5963225202af5f72b6f72602df6b54c10996cd271ce192c1c5e6902198e744b2dafe06021964ab913
|
|
7
|
+
data.tar.gz: f887ebe7105b9287cdfaa94df8af657c69af7d28e8bc5760c5dc1aabfd5c9ddad7a3297efe9b713542e58fcfd640780079ffddc044e78fb6b203e38eb3111b31
|
data/lib/helicone/agent.rb
CHANGED
|
@@ -9,12 +9,13 @@ module Helicone
|
|
|
9
9
|
# Create an agent with tools and optional context
|
|
10
10
|
#
|
|
11
11
|
# @param client [Helicone::Client] Optional client (creates new one if not provided)
|
|
12
|
+
# @param session [Hash] Session config for Helicone tracking (id:, name:) - creates client if no client provided
|
|
12
13
|
# @param tools [Array<Class>] Array of Tool subclasses
|
|
13
14
|
# @param context [Object] Context object passed to tool#initialize
|
|
14
15
|
# @param system_prompt [String] System prompt
|
|
15
16
|
# @param messages [Array<Helicone::Message>] Initial messages (for continuing conversations)
|
|
16
|
-
def initialize(client: nil, tools: [], context: nil, system_prompt: nil, messages: [])
|
|
17
|
-
@client = client ||
|
|
17
|
+
def initialize(client: nil, session: nil, tools: [], context: nil, system_prompt: nil, messages: [])
|
|
18
|
+
@client = client || build_client(session: session)
|
|
18
19
|
@tools = tools
|
|
19
20
|
@context = context
|
|
20
21
|
@messages = messages.dup
|
|
@@ -130,5 +131,14 @@ module Helicone
|
|
|
130
131
|
def find_tool_class(name)
|
|
131
132
|
@tools.find { |t| t.function_name == name }
|
|
132
133
|
end
|
|
134
|
+
|
|
135
|
+
def build_client(session:)
|
|
136
|
+
return Client.new unless session
|
|
137
|
+
|
|
138
|
+
Client.new(
|
|
139
|
+
session_id: session[:id],
|
|
140
|
+
session_name: session[:name]
|
|
141
|
+
)
|
|
142
|
+
end
|
|
133
143
|
end
|
|
134
144
|
end
|
data/lib/helicone/version.rb
CHANGED