helicone-rb 0.2.1 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac034e0153e6ec01bbe008066b48c58c754a103b56461fdc24c4e0d1bc05d4d4
4
- data.tar.gz: c95390c56a649b16fde96f7be81a1ef537671a19a129039d23d272ea391cfdaf
3
+ metadata.gz: a118f742137f788207fb3e4b724ec2420884ef5610776d1437385cd2fa963649
4
+ data.tar.gz: 44b4d16c5295b974afa28d2b9f694bf0c2b0cb95ba810826eaa5a72b141cd1e1
5
5
  SHA512:
6
- metadata.gz: a4726d935f0db71a01ece1db9f29d758f2c4f47e04b79cb62ed986f1180abf6415576ccfa94e1de6e6d73671d21448c8067b1c74b6b55052195548c67533f64b
7
- data.tar.gz: 1b1b93d6cffe0e19a41dbbefec03ab019bda992c4eb7a0dfc7770c60852f7dfde8d879d634aeeec10ca75837e799919be2ecc14f9f601efbb4b63636922b43ec
6
+ metadata.gz: b689d259dbc4f8b583a62d5b95e84053aa58f41d594cf03fb5b681dc10d180e4d3ab5d86844d9875821c3d6b8c3270ff7e5faf5660c89501a8e72e8e7bf9d1b0
7
+ data.tar.gz: 6aa3ef6dda08bccd058deb550c23a0059693f759476b8394fa0d0c5f24497475decd2beb81a7f5818c6a58e243b8d8484bda22e405fcd965ae602bd789451904
@@ -4,7 +4,7 @@ module Helicone
4
4
  class Agent
5
5
  MAX_ITERATIONS = 10
6
6
 
7
- attr_reader :client, :tools, :messages, :context, :turn_model, :response_model
7
+ attr_reader :client, :tools, :messages, :context, :model
8
8
 
9
9
  # Create an agent with tools and optional context
10
10
  #
@@ -14,14 +14,12 @@ module Helicone
14
14
  # @param context [Object] Context object passed to tool#initialize
15
15
  # @param system_prompt [String] System prompt
16
16
  # @param messages [Array<Helicone::Message>] Initial messages (for continuing conversations)
17
- # @param turn_model [String] Model for tool-calling turns (defaults to Helicone.configuration.default_model)
18
- # @param response_model [String] Model for final response (defaults to turn_model)
19
- def initialize(client: nil, session: nil, tools: [], context: nil, system_prompt: nil, messages: [], turn_model: nil, response_model: nil)
17
+ # @param model [String] Model to use (defaults to Helicone.configuration.default_model)
18
+ def initialize(client: nil, session: nil, tools: [], context: nil, system_prompt: nil, messages: [], model: nil)
20
19
  @client = client || build_client(session: session)
21
20
  @tools = tools
22
21
  @context = context
23
- @turn_model = turn_model
24
- @response_model = response_model || turn_model
22
+ @model = model
25
23
  @messages = messages.dup
26
24
 
27
25
  # Add system message at the start if provided and not already present
@@ -40,7 +38,7 @@ module Helicone
40
38
 
41
39
  iterations = 0
42
40
  while iterations < max_iterations
43
- response = call_llm(model: @turn_model)
41
+ response = call_llm
44
42
 
45
43
  tool_calls = response.tool_calls
46
44
  if tool_calls && !tool_calls.empty?
@@ -59,17 +57,7 @@ module Helicone
59
57
 
60
58
  iterations += 1
61
59
  else
62
- # No tool calls - if response_model differs, make final call with it
63
- if @response_model && @response_model != @turn_model
64
- final_response = @client.chat(messages: @messages, model: @response_model)
65
- return AgentResult.new(
66
- content: final_response.content,
67
- messages: @messages,
68
- iterations: iterations,
69
- response: final_response
70
- )
71
- end
72
-
60
+ # No tool calls - we're done
73
61
  return AgentResult.new(
74
62
  content: response.content,
75
63
  messages: @messages,
@@ -80,7 +68,7 @@ module Helicone
80
68
  end
81
69
 
82
70
  # Max iterations reached - make one final call without tools to get a response
83
- final_response = @client.chat(messages: @messages, model: @response_model)
71
+ final_response = @client.chat(messages: @messages, model: @model)
84
72
 
85
73
  AgentResult.new(
86
74
  content: final_response.content,
@@ -106,10 +94,10 @@ module Helicone
106
94
  Helicone.configuration.logger
107
95
  end
108
96
 
109
- def call_llm(model: nil)
97
+ def call_llm
110
98
  @client.chat(
111
99
  messages: @messages,
112
- model: model,
100
+ model: @model,
113
101
  tools: tools_for_api,
114
102
  tool_choice: "auto"
115
103
  )
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Helicone
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: helicone-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genevere