langgraph_rb 0.1.9 → 0.1.10

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: 299430b38fa98a9d82a902479bfd22256192300a9aa57635f8fc3240bbb662d6
4
- data.tar.gz: 9dddfa3c24e5425fee43718aa06df70258cc3659ee624a5e5303f7eb59aa8f21
3
+ metadata.gz: 4db933d491b92e89ffd2520c1b1c9912f076510c8a5ee2e2bea3cdb7706b123e
4
+ data.tar.gz: b4bcc52d2863d2101cea6e26c5e4082ad35129c676f942e1bed18ed80adadf73
5
5
  SHA512:
6
- metadata.gz: 65eb35f3aba912b4aa69513c02561d9a953349a20475ecec254ed078e708cb19c603b13e154cd0145e05a50c55bfdefe006283bfaf0f397c6e53c834fa033954
7
- data.tar.gz: 03ac84c5bfed8b1bc67ee51517d243a743e09dfb671d3fce75cb3e79af299098253f65d8d73e1df10ec3041a4d995fbec4c3497245299b33b9bf7721878daae3
6
+ metadata.gz: 2ab4b6b056843d7608c7a45c71d99097158365ddc6a1226d03590cf6e2bb28207cf47a4309cc5c2696b263372c8646b777051cd5f0a4582707a4fb7b54d66990
7
+ data.tar.gz: 70fa2be9a71cb51291e6dd05c6278cbb201bb1227a0ca8a24d947de626ab5b179ff241bc67583c9c23526952eb9d11127d254478115839aa3f3383f5ef0e32ed
data/Gemfile CHANGED
@@ -2,7 +2,6 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'openai', '~> 0.24.0'
6
5
 
7
6
  group :development, :test do
8
7
  gem 'rspec', '~> 3.0'
data/Gemfile.lock CHANGED
@@ -1,9 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- langgraph_rb (0.1.4)
4
+ langgraph_rb (0.1.9)
5
5
  json (~> 2.0)
6
- openai (~> 0.24.0)
7
6
 
8
7
  GEM
9
8
  remote: https://rubygems.org/
@@ -12,22 +11,19 @@ GEM
12
11
  byebug (12.0.0)
13
12
  coderay (1.1.3)
14
13
  concurrent-ruby (1.3.5)
15
- connection_pool (2.5.4)
16
14
  diff-lcs (1.6.2)
17
- json (2.13.2)
15
+ json (2.15.1)
18
16
  langfuse (0.1.1)
19
17
  concurrent-ruby (~> 1.2)
20
18
  sorbet-runtime (~> 0.5)
21
19
  language_server-protocol (3.17.0.5)
22
20
  lint_roller (1.1.0)
23
21
  method_source (1.1.0)
24
- openai (0.24.0)
25
- connection_pool
26
22
  parallel (1.27.0)
27
23
  parser (3.3.9.0)
28
24
  ast (~> 2.4.1)
29
25
  racc
30
- prism (1.4.0)
26
+ prism (1.5.1)
31
27
  pry (0.15.2)
32
28
  coderay (~> 1.1)
33
29
  method_source (~> 1.0)
@@ -37,7 +33,7 @@ GEM
37
33
  racc (1.8.1)
38
34
  rainbow (3.1.1)
39
35
  rake (13.3.0)
40
- regexp_parser (2.11.1)
36
+ regexp_parser (2.11.3)
41
37
  rspec (3.13.1)
42
38
  rspec-core (~> 3.13.0)
43
39
  rspec-expectations (~> 3.13.0)
@@ -50,8 +46,8 @@ GEM
50
46
  rspec-mocks (3.13.5)
51
47
  diff-lcs (>= 1.2.0, < 2.0)
52
48
  rspec-support (~> 3.13.0)
53
- rspec-support (3.13.4)
54
- rubocop (1.79.2)
49
+ rspec-support (3.13.6)
50
+ rubocop (1.81.1)
55
51
  json (~> 2.3)
56
52
  language_server-protocol (~> 3.17.0.2)
57
53
  lint_roller (~> 1.1.0)
@@ -59,17 +55,17 @@ GEM
59
55
  parser (>= 3.3.0.2)
60
56
  rainbow (>= 2.2.2, < 4.0)
61
57
  regexp_parser (>= 2.9.3, < 3.0)
62
- rubocop-ast (>= 1.46.0, < 2.0)
58
+ rubocop-ast (>= 1.47.1, < 2.0)
63
59
  ruby-progressbar (~> 1.7)
64
60
  unicode-display_width (>= 2.4.0, < 4.0)
65
- rubocop-ast (1.46.0)
61
+ rubocop-ast (1.47.1)
66
62
  parser (>= 3.3.7.2)
67
63
  prism (~> 1.4)
68
64
  ruby-progressbar (1.13.0)
69
- sorbet-runtime (0.6.12534)
70
- unicode-display_width (3.1.4)
71
- unicode-emoji (~> 4.0, >= 4.0.4)
72
- unicode-emoji (4.0.4)
65
+ sorbet-runtime (0.6.12627)
66
+ unicode-display_width (3.2.0)
67
+ unicode-emoji (~> 4.1)
68
+ unicode-emoji (4.1.0)
73
69
 
74
70
  PLATFORMS
75
71
  arm64-darwin-22
@@ -79,7 +75,6 @@ DEPENDENCIES
79
75
  bundler (~> 2.0)
80
76
  langfuse (~> 0.1)
81
77
  langgraph_rb!
82
- openai (~> 0.24.0)
83
78
  pry (~> 0.14)
84
79
  pry-byebug
85
80
  rake (~> 13.0)
@@ -87,4 +82,4 @@ DEPENDENCIES
87
82
  rubocop (~> 1.0)
88
83
 
89
84
  BUNDLED WITH
90
- 2.6.7
85
+ 2.7.2
data/examples/Gemfile ADDED
@@ -0,0 +1 @@
1
+ gem 'ruby-openai', '~> 8.1.0'
@@ -3,9 +3,10 @@ require 'pry'
3
3
  require 'pry-byebug'
4
4
  require 'langfuse'
5
5
  require_relative '../lib/langgraph_rb'
6
- require 'openai'
7
- require_relative '../lib/langgraph_rb/chat_openai'
8
-
6
+ #require 'openai'
7
+ #require_relative '../lib/langgraph_rb/chat_openai'
8
+ require "openai"
9
+ require_relative '../lib/langgraph_rb/chat_ruby_openai'
9
10
 
10
11
  url = 'https://us.cloud.langfuse.com'
11
12
 
@@ -43,7 +44,8 @@ end
43
44
  def run_chat_openai_tools
44
45
  tools = [Tool::MovieInfoTool.new(api_key: ENV['TMDB_API_KEY'] || 'demo')]
45
46
 
46
- chat = LangGraphRB::ChatOpenAI.new(model: ENV.fetch('OPENAI_MODEL', 'gpt-4o-mini'), temperature: 0)
47
+ #chat = LangGraphRB::ChatOpenAI.new(model: ENV.fetch('OPENAI_MODEL', 'gpt-4o-mini'), temperature: 0)
48
+ chat = LangGraphRB::ChatRubyOpenAI.new(model: ENV.fetch('OPENAI_MODEL', 'gpt-4o-mini'), temperature: 0)
47
49
  chat = chat.bind_tools(tools)
48
50
 
49
51
  observers = [LangGraphRB::Observers::LangfuseObserver.new(name: 'chat-openai-tools-example')]
@@ -47,15 +47,15 @@ module LangGraphRB
47
47
  name: 'OpenAI::ChatCompletion',
48
48
  model: @model,
49
49
  model_parameters: { temperature: @temperature },
50
- input: request_payload[:messages]
50
+ input: request_payload
51
51
  })
52
52
 
53
53
  # ruby-openai 8.1.x: client.chat(parameters: {...}) returns a Hash
54
54
  response = @client.chat(parameters: request_payload)
55
55
 
56
56
  message = extract_message_from_response(response)
57
- tool_calls = message[:tool_calls]
58
- text_content = message[:content]
57
+ tool_calls = message["tool_calls"]
58
+ text_content = message["content"]
59
59
 
60
60
  usage = extract_usage_from_response(response)
61
61
  notify_llm_response({
@@ -68,9 +68,9 @@ module LangGraphRB
68
68
  if tool_calls && !tool_calls.empty?
69
69
  normalized_calls = tool_calls.map do |tc|
70
70
  {
71
- id: tc[:id],
72
- name: tc[:function][:name],
73
- arguments: parse_tool_arguments(tc[:function][:arguments])
71
+ id: tc["id"],
72
+ name: tc["function"]["name"],
73
+ arguments: parse_tool_arguments(tc["function"]["arguments"])
74
74
  }
75
75
  end
76
76
  { tool_calls: normalized_calls }
@@ -1,3 +1,3 @@
1
1
  module LangGraphRB
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: langgraph_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Toro
@@ -109,6 +109,7 @@ files:
109
109
  - Gemfile.lock
110
110
  - README.md
111
111
  - SUMMARY.md
112
+ - examples/Gemfile
112
113
  - examples/advanced_example.rb
113
114
  - examples/basic_example.rb
114
115
  - examples/chat_openai_tools_example.rb