Skip to content

Commit 30b9116

Browse files
committed
RubyLLM
1 parent 72de319 commit 30b9116

File tree

7 files changed

+38
-7
lines changed

7 files changed

+38
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# RubyLlm::Docker
1+
# RubyLLM::Docker
22

33
TODO: Delete this and the text below, and describe your gem
44

examples/list_containers.rb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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 "\nOpenAI 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

lib/ruby_llm/docker.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
require_relative 'docker/version'
1111

12-
module RubyLlm
12+
module RubyLLM
1313
module Docker
1414
class Error < StandardError; end
1515
# Your code goes here...

lib/ruby_llm/docker/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
module RubyLlm
3+
module RubyLLM
44
module Docker
55
VERSION = '0.0.1'
66
end

ruby_llm-docker.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ require_relative 'lib/ruby_llm/docker/version'
44

55
Gem::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

sig/ruby_llm/docker.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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

spec/ruby_llm/docker_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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
77
end

0 commit comments

Comments
 (0)