llmed 0.1.2 → 0.1.4
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/exe/llmed +5 -4
- data/lib/llmed.rb +17 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a61be7faed3b0912b3ef21f91348292043bef4c85f7535571bfd140914c4f2d
|
4
|
+
data.tar.gz: 6b57183e11024ed1f5185d119e14b7641f6da1d203b054e2005509966b1b1354
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 003015253626ccf664e33155b9bfe588a124ce61fd86cd9235a0172a7290b824dfa74311d4c6727c39ba35989a8b34d0c7f20eba0bad44e0aeb1542b24cd7e3c
|
7
|
+
data.tar.gz: e76a304f75db013c484babcabde8808eb3f13ee2abf03167eb30ae867b606a3fe625461ed81c9625281b3c0596dc5327ddbe114e8b96674e071ae9f5158868fe
|
data/exe/llmed
CHANGED
@@ -10,17 +10,18 @@ release_dir = output_dir
|
|
10
10
|
template = <<-TMP
|
11
11
|
set_llm provider: :openai, api_key: ENV['OPENAI_API_KEY'], model: 'gpt-4o'
|
12
12
|
|
13
|
-
|
13
|
+
# Increment the RELEASE number once you approve the output.
|
14
|
+
application "hi world", release: nil, language: '<HERE LANGUAGE>', output_file: "<HERE NAME>.ollmed" do
|
14
15
|
context "main" do
|
15
16
|
<<-LLM
|
16
|
-
|
17
|
+
Show to user 'hi world!'.
|
17
18
|
LLM
|
18
19
|
end
|
19
20
|
end
|
20
21
|
TMP
|
21
22
|
|
22
23
|
OptionParser.new do |parser|
|
23
|
-
parser.banner = "Usage: llmed [options]"
|
24
|
+
parser.banner = "Usage: llmed [options] <application file .llmed or stdin>"
|
24
25
|
parser.on_tail("-h", "--help", "Show this message") do
|
25
26
|
puts parser
|
26
27
|
exit
|
@@ -38,7 +39,7 @@ OptionParser.new do |parser|
|
|
38
39
|
parser.on('--release-dir DIR', String) do |path|
|
39
40
|
release_dir = path
|
40
41
|
end
|
41
|
-
end
|
42
|
+
end.parse!
|
42
43
|
|
43
44
|
source_path = ARGF.read
|
44
45
|
if ARGF.respond_to?(:path)
|
data/lib/llmed.rb
CHANGED
@@ -36,26 +36,30 @@ class LLMed
|
|
36
36
|
not (@message.nil? || @message.empty?)
|
37
37
|
end
|
38
38
|
|
39
|
-
|
39
|
+
# Example:
|
40
|
+
# context("application") { from_file("application.cllmed") }
|
40
41
|
def from_file(path)
|
41
42
|
File.read(path)
|
42
43
|
end
|
43
44
|
|
45
|
+
# Example:
|
46
|
+
# context("source") { from_source_code("sourcepathtoinclude") }
|
44
47
|
def from_source_code(path)
|
45
48
|
code = File.read(path)
|
46
|
-
"
|
49
|
+
" Given the following source code: #{code}\n\n\n"
|
47
50
|
end
|
48
51
|
end
|
49
52
|
|
50
53
|
class Configuration
|
51
54
|
def initialize
|
52
55
|
@prompt = Langchain::Prompt::PromptTemplate.new(template: "
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
56
|
+
You are a software developer and only have knowledge of the programming language {language}.
|
57
|
+
Your response must contain only the generated source code, with no additional text.
|
58
|
+
All source code must be written in a single file, and you must ensure it runs correctly on the first attempt.
|
59
|
+
Always include the properly escaped comment: LLMED-COMPILED.
|
57
60
|
|
58
|
-
|
61
|
+
You must only modify the following source code:
|
62
|
+
{source_code}
|
59
63
|
|
60
64
|
", input_variables: ["language", "source_code"])
|
61
65
|
end
|
@@ -64,10 +68,16 @@ Debes solo modificar el siguiente codigo fuente: {source_code}.
|
|
64
68
|
@prompt.format(language: language, source_code: source_code)
|
65
69
|
end
|
66
70
|
|
71
|
+
# Change the default prompt, input variables: language, source_code
|
72
|
+
# Example:
|
73
|
+
# set_prompt "my new prompt"
|
67
74
|
def set_prompt(prompt)
|
68
75
|
@prompt = Langchain::Prompt::PromptTemplate.new(template: prompt, input_variables: ["language", "source_code"])
|
69
76
|
end
|
70
77
|
|
78
|
+
# Set default language used for all applications.
|
79
|
+
# Example:
|
80
|
+
# set_langugage :ruby
|
71
81
|
def set_language(language)
|
72
82
|
@language = language
|
73
83
|
end
|