aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-06-06 09:38:48 +0800
committerGitHub <noreply@github.com>2024-06-06 09:38:48 +0800
commitd8eeb55578543b7e35c8ea7c38a46b0786e71052 (patch)
treea8f9a1df2ef837f7c65d02e282a39b4d511ceb7f
parent4052bc944eea096d66bbfe23ded12f8d853cb848 (diff)
downloadllm-functions-docker-d8eeb55578543b7e35c8ea7c38a46b0786e71052.tar.gz
feat: remove ruby (#20)
-rw-r--r--.github/workflows/ci.yaml5
-rw-r--r--Argcfile.sh2
-rw-r--r--README.md31
-rwxr-xr-xrun/tool.rb71
-rw-r--r--tools/may_execute_rb_code.rb22
5 files changed, 1 insertions, 130 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 645dc8b..7fcea51 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -40,10 +40,5 @@ jobs:
with:
python-version: '3.11'
- - name: Setup Ruby
- uses: ruby/setup-ruby@v1
- with:
- ruby-version: '3.3'
-
- name: Run Test
run: argc test \ No newline at end of file
diff --git a/Argcfile.sh b/Argcfile.sh
index 09686b6..a57debd 100644
--- a/Argcfile.sh
+++ b/Argcfile.sh
@@ -9,7 +9,6 @@ LANG_CMDS=( \
"sh:bash" \
"js:node" \
"py:python" \
- "rb:ruby" \
)
# @cmd Call the function
@@ -142,7 +141,6 @@ test-functions() {
'sh#may_execute_command#{"command":"echo \"✓\""}' \
'js#may_execute_js_code#{"code":"console.log(\"✓\")"}' \
'py#may_execute_py_code#{"code":"print(\"✓\")"}' \
- 'rb#may_execute_rb_code#{"code":"puts \"✓\""}' \
)
for test_case in "${test_cases[@]}"; do
diff --git a/README.md b/README.md
index 26693d5..435e005 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# LLM Functions
-This project allows you to enhance large language models (LLMs) with custom functions written in bash/js/python/ruby. Imagine your LLM being able to execute system commands, access web APIs, or perform other complex tasks – all triggered by simple, natural language prompts.
+This project allows you to enhance large language models (LLMs) with custom functions written in bash/js/python. Imagine your LLM being able to execute system commands, access web APIs, or perform other complex tasks – all triggered by simple, natural language prompts.
## Prerequisites
@@ -165,35 +165,6 @@ def execute(data):
exec(data["code"])
```
-### Ruby
-
-Create a new ruby script in the [./tools/](./tools/) directory (e.g., `may_execute_rb_code.rb`).
-
-```rb
-def declarate
- {
- "name": "may_execute_rb_code",
- "description": "Runs the ruby code.",
- "parameters": {
- "type": "object",
- "properties": {
- "code": {
- "type": "string",
- "description": "Ruby code to execute, such as `puts \"hello world\"`"
- }
- },
- "required": [
- "code"
- ]
- }
- }
-end
-
-def execute(data)
- eval(data["code"])
-end
-```
-
## License
The project is under the MIT License, Refer to the [LICENSE](https://github.com/sigoden/llm-functions/blob/main/LICENSE) file for detailed information. \ No newline at end of file
diff --git a/run/tool.rb b/run/tool.rb
deleted file mode 100755
index 2b47788..0000000
--- a/run/tool.rb
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'json'
-require 'pathname'
-
-def parse_argv
- func_file = __FILE__
- func_data = nil
-
- if func_file.end_with?("tool.rb")
- func_file = ARGV[0]
- func_data = ARGV[1]
- else
- func_file = File.basename(func_file)
- func_data = ARGV[0]
- end
-
- func_file += '.rb' unless func_file.end_with?(".rb")
-
- [func_file, func_data]
-end
-
-def load_func(func_file)
- func_path = File.expand_path("../tools/#{func_file}", __dir__)
-
- begin
- require func_path
- rescue LoadError
- puts "Invalid function: #{func_file}"
- exit 1
- end
-end
-
-def load_env(file_path)
- return unless File.exist?(file_path)
-
- File.readlines(file_path).each do |line|
- line = line.strip
- next if line.empty? || line.start_with?('#')
-
- key, *value = line.split('=', 2)
- ENV[key.strip] = value.join('=').strip
- end
-rescue StandardError
-end
-
-ENV['LLM_FUNCTIONS_DIR'] = Pathname.new(__dir__).join('..').expand_path.to_s
-
-load_env(Pathname.new(ENV['LLM_FUNCTIONS_DIR']).join('.env').to_s)
-
-func_file, func_data = parse_argv
-
-if ENV["LLM_FUNCTION_ACTION"] == "declarate"
- load_func(func_file)
- puts JSON.pretty_generate(declarate)
-else
- if func_data.nil?
- puts "No json data"
- exit 1
- end
-
- begin
- args = JSON.parse(func_data)
- rescue JSON::ParserError
- puts "Invalid json data"
- exit 1
- end
-
- load_func(func_file)
- execute(args)
-end \ No newline at end of file
diff --git a/tools/may_execute_rb_code.rb b/tools/may_execute_rb_code.rb
deleted file mode 100644
index a1f9821..0000000
--- a/tools/may_execute_rb_code.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-def declarate
- {
- "name": "may_execute_rb_code",
- "description": "Runs the ruby code.",
- "parameters": {
- "type": "object",
- "properties": {
- "code": {
- "type": "string",
- "description": "Ruby code to execute, such as `puts \"hello world\"`"
- }
- },
- "required": [
- "code"
- ]
- }
- }
-end
-
-def execute(data)
- eval(data["code"])
-end