sylvia 0.2.5 → 0.2.6
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 +4 -4
- data/lib/sylvia/llm.rb +2 -3
- data/lib/sylvia/version.rb +1 -1
- data/sylvia.rb +24 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8783c3724ed736abf502fe3a02e41e2216e6ec3a961a4472a864b66f243a2a0c
|
4
|
+
data.tar.gz: 1d9da5a2034b12694486606972a6443489787a0941b25408a350699aa394f681
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae40c8d17067ff2f2d81c4562de5d1d6ecb31e72df2525ec3b03d2c494bc78a4ba8e714f62b6e8e340d6704e5636b960978da628461bd96a2e40bcd0cd3f8601
|
7
|
+
data.tar.gz: a1e14069c41b86718fd70948358c6c0deebf7f0d154a1d7819ce3b1b5ea98a4ad95d9e75371662532affde136bbdc07478c0eaac73c2877c2428d1327b23e407
|
data/lib/sylvia/llm.rb
CHANGED
@@ -35,12 +35,11 @@ PROMPT
|
|
35
35
|
puts "Created #{FILE_NAME}"
|
36
36
|
|
37
37
|
if File.exist?(GITIGNORE_FILE)
|
38
|
-
gitignore_content = File.read(GITIGNORE_FILE)
|
39
|
-
gitignore_content += "\n" unless gitignore_content.end_with?("\n")
|
38
|
+
gitignore_content = File.read(GITIGNORE_FILE).split("\n")
|
40
39
|
if gitignore_content.include?(FILE_NAME)
|
41
40
|
puts "#{FILE_NAME} is already in #{GITIGNORE_FILE}"
|
42
41
|
else
|
43
|
-
File.open(GITIGNORE_FILE, 'a') { |f| f.puts FILE_NAME }
|
42
|
+
File.open(GITIGNORE_FILE, 'a') { |f| f.puts "\n#{FILE_NAME}" }
|
44
43
|
puts "Added #{FILE_NAME} to #{GITIGNORE_FILE}"
|
45
44
|
end
|
46
45
|
else
|
data/lib/sylvia/version.rb
CHANGED
data/sylvia.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'ruby_llm'
|
2
|
+
require 'tty-markdown'
|
3
|
+
|
4
|
+
api_key = 'xxx'
|
5
|
+
model_ai = 'gemini-2.0-flash'
|
6
|
+
|
7
|
+
RubyLLM.configure do |config|
|
8
|
+
config.gemini_api_key = api_key
|
9
|
+
end
|
10
|
+
|
11
|
+
chat = RubyLLM.chat(model: model_ai)
|
12
|
+
|
13
|
+
response = chat.ask <<~PROMPT, with: ["assets/example.rb", "assets/example2.rb"]
|
14
|
+
Please review the following Ruby code and suggest improvements:
|
15
|
+
|
16
|
+
1. Use descriptive variable names.
|
17
|
+
2. Follow Ruby style conventions.
|
18
|
+
3. Optimize loops and iterators.
|
19
|
+
4. Avoid unnecessary complexity.
|
20
|
+
PROMPT
|
21
|
+
|
22
|
+
markdown = response.content.to_s
|
23
|
+
|
24
|
+
puts TTY::Markdown.parse(markdown)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sylvia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- whdzera
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- spec/spec_helper.rb
|
96
96
|
- spec/sylvia_spec.rb
|
97
97
|
- sylvia.gemspec
|
98
|
+
- sylvia.rb
|
98
99
|
homepage: https://github.com/whdzera/sylvia
|
99
100
|
licenses:
|
100
101
|
- MIT
|