Skip to content

Commit c1655d0

Browse files
committed
Use tool forge
1 parent bda6f53 commit c1655d0

24 files changed

Lines changed: 38 additions & 22 deletions

examples/docker_chat.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
require 'io/console'
2525

2626
# rubocop:disable Metrics/ClassLength
27+
28+
# Interactive Docker chat interface using RubyLLM and OpenAI.
29+
# Provides natural language interaction with Docker containers, images, networks, and volumes.
2730
class DockerChat
2831
def initialize
2932
check_environment

lib/ruby_llm/docker.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
require 'ruby_llm'
44
require 'docker'
55
require 'shellwords'
6+
require 'tool_forge'
67
require 'zeitwerk'
78

89
loader = Zeitwerk::Loader.for_gem_extension(RubyLLM)
@@ -11,6 +12,18 @@
1112
require_relative 'docker/version'
1213

1314
module RubyLLM
15+
# Docker tools module providing comprehensive Docker management capabilities for RubyLLM.
16+
#
17+
# This module contains 22 Docker management tools organized into four categories:
18+
# - Container Management (10 tools)
19+
# - Image Management (6 tools)
20+
# - Network Management (3 tools)
21+
# - Volume Management (3 tools)
22+
#
23+
# @example Basic usage
24+
# chat = RubyLLM::Chat.new(api_key: 'your-key', model: 'gpt-4')
25+
# RubyLLM::Docker.add_all_tools_to_chat(chat)
26+
# response = chat.ask("How many containers are running?")
1427
module Docker
1528
class Error < StandardError; end
1629

lib/ruby_llm/docker/build_image.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ module Docker
7373
#
7474
# @see Docker::Image.build_from_dir
7575
# @since 0.1.0
76-
BUILD_IMAGE_DEFINITION = ::ToolForge.define(:build_image) do
76+
BUILD_IMAGE_DEFINITION = ToolForge.define(:build_image) do
7777
description 'Build a Docker image'
7878

7979
param :dockerfile,

lib/ruby_llm/docker/copy_to_container.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ module Docker
6363
#
6464
# @see Docker::Container#archive_in_stream
6565
# @since 0.1.0
66-
COPY_TO_CONTAINER_DEFINITION = ::ToolForge.define(:copy_to_container) do
66+
COPY_TO_CONTAINER_DEFINITION = ToolForge.define(:copy_to_container) do
6767
description 'Copy a file or directory from the local filesystem into a running Docker container. ' \
6868
'The source path is on the local machine, and the destination path is inside the container.'
6969

lib/ruby_llm/docker/create_container.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ module Docker
6161
#
6262
# @see Docker::Container.create
6363
# @since 0.1.0
64-
CREATE_CONTAINER_DEFINITION = ::ToolForge.define(:create_container) do
64+
CREATE_CONTAINER_DEFINITION = ToolForge.define(:create_container) do
6565
description 'Create a Docker container'
6666

6767
param :image,

lib/ruby_llm/docker/create_network.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ module Docker
7474
#
7575
# @see Docker::Network.create
7676
# @since 0.1.0
77-
CREATE_NETWORK_DEFINITION = ::ToolForge.define(:create_network) do
77+
CREATE_NETWORK_DEFINITION = ToolForge.define(:create_network) do
7878
description 'Create a Docker network'
7979

8080
param :name,

lib/ruby_llm/docker/create_volume.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ module Docker
7373
#
7474
# @see Docker::Volume.create
7575
# @since 0.1.0
76-
CREATE_VOLUME_DEFINITION = ::ToolForge.define(:create_volume) do
76+
CREATE_VOLUME_DEFINITION = ToolForge.define(:create_volume) do
7777
description 'Create a Docker volume'
7878

7979
param :name,

lib/ruby_llm/docker/exec_container.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ module Docker
7373
#
7474
# @see Docker::Container#exec
7575
# @since 0.1.0
76-
EXEC_CONTAINER_DEFINITION = ::ToolForge.define(:exec_container) do
76+
EXEC_CONTAINER_DEFINITION = ToolForge.define(:exec_container) do
7777
description 'Execute a command inside a running Docker container. ' \
7878
'WARNING: This provides arbitrary command execution within the container. ' \
7979
'Ensure proper security measures are in place.'

lib/ruby_llm/docker/fetch_container_logs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module Docker
5757
#
5858
# @see Docker::Container#logs
5959
# @since 0.1.0
60-
FETCH_CONTAINER_LOGS_DEFINITION = ::ToolForge.define(:fetch_container_logs) do
60+
FETCH_CONTAINER_LOGS_DEFINITION = ToolForge.define(:fetch_container_logs) do
6161
description 'Fetch Docker container logs'
6262

6363
param :id,

lib/ruby_llm/docker/list_containers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module Docker
4646
#
4747
# @see Docker::Container.all
4848
# @since 0.1.0
49-
LIST_CONTAINERS_DEFINITION = ::ToolForge.define(:list_containers) do
49+
LIST_CONTAINERS_DEFINITION = ToolForge.define(:list_containers) do
5050
description 'List Docker containers'
5151

5252
param :all,

0 commit comments

Comments
 (0)