File tree Expand file tree Collapse file tree 7 files changed +38
-7
lines changed
Expand file tree Collapse file tree 7 files changed +38
-7
lines changed Original file line number Diff line number Diff line change 1- # RubyLlm ::Docker
1+ # RubyLLM ::Docker
22
33TODO: Delete this and the text below, and describe your gem
44
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env ruby
2+
3+ # Example: Using RubyLLM with Docker ListContainers tool
4+ # This script creates a chat with OpenAI and asks about Docker containers
5+
6+ require_relative '../lib/ruby_llm/docker'
7+
8+ # Check if OpenAI API key is configured
9+ unless ENV [ 'OPENAI_API_KEY' ]
10+ puts 'Error: Please set OPENAI_API_KEY environment variable'
11+ puts "Example: export OPENAI_API_KEY='your-api-key-here'"
12+ exit 1
13+ end
14+
15+ begin
16+ # Create a new RubyLLM chat instance
17+ chat = RubyLLM . chat ( model : 'gpt-4' )
18+
19+ # Add the ListContainers tool
20+ chat . with_tool ( RubyLLM ::Docker ::ListContainers )
21+
22+ # Ask OpenAI how many containers there are
23+ puts 'Asking OpenAI about Docker containers...'
24+ response = chat . ask ( 'How many Docker containers are currently on this system?' )
25+
26+ puts "\n OpenAI Response:"
27+ puts response . content
28+ rescue StandardError => e
29+ puts "Error: #{ e . class } - #{ e . message } "
30+ puts 'This helps us see what needs to be fixed in the ListContainers tool'
31+ end
Original file line number Diff line number Diff line change 99
1010require_relative 'docker/version'
1111
12- module RubyLlm
12+ module RubyLLM
1313 module Docker
1414 class Error < StandardError ; end
1515 # Your code goes here...
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
3- module RubyLlm
3+ module RubyLLM
44 module Docker
55 VERSION = '0.0.1'
66 end
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ require_relative 'lib/ruby_llm/docker/version'
44
55Gem ::Specification . new do |spec |
66 spec . name = 'ruby_llm-docker'
7- spec . version = RubyLlm ::Docker ::VERSION
7+ spec . version = RubyLLM ::Docker ::VERSION
88 spec . authors = [ 'Aaron F Stanton' ]
99 spec . email = [ 'afstanton@gmail.com' ]
1010
Original file line number Diff line number Diff line change 1- module RubyLlm
1+ module RubyLLM
22 module Docker
33 VERSION: String
44 # See the writing guide of rbs: https://github.com/ruby/rbs#guides
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
3- RSpec . describe RubyLlm ::Docker do
3+ RSpec . describe RubyLLM ::Docker do
44 it 'has a version number' do
5- expect ( RubyLlm ::Docker ::VERSION ) . not_to be_nil
5+ expect ( RubyLLM ::Docker ::VERSION ) . not_to be_nil
66 end
77end
You can’t perform that action at this time.
0 commit comments