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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/exe/llmed +5 -4
  3. data/lib/llmed.rb +17 -7
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 419988eff810e2622c08990a432aa3629a03db74be5735ff5826de27b93d8bd1
4
- data.tar.gz: 7f51c0f7bf24e72b2eedfb06e0dee4381f24a20b0326cc5072de8658e10b27fd
3
+ metadata.gz: 0a61be7faed3b0912b3ef21f91348292043bef4c85f7535571bfd140914c4f2d
4
+ data.tar.gz: 6b57183e11024ed1f5185d119e14b7641f6da1d203b054e2005509966b1b1354
5
5
  SHA512:
6
- metadata.gz: aa8bf3b2fc9349aee970c6e89100e3136e332c0e9f595e910882c8fc8091c698f3565a051617dd9850f8421a1e533ef09bfbcb418dd4bb3f055de20ab1297512
7
- data.tar.gz: bc8afe2b441dd588b211de1379471f87549934b3e3af05c6bcc83b10516423532b342afa465a278b16bd27f58c287a60363b2f74ffbbff2607b8c827c7494a02
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
- application "hi world", language: '<HERE LANGUAGE>', output_file: "<HERE NAME>.rb" do
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
- Application do print 'hi world!'.
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
- "Dado el codigo fuente: #{code}\n\n\n"
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
- Eres desarrollador de software y solo conoces del lenguage de programacion {language}.
54
- La respuesta no debe contener texto adicional al codigo fuente generado.
55
- Todo el codigo fuente se genera en un unico archivo y debes asegurarte de que se ejecute correctamente desde el primer intento.
56
- Siempre adicionas el comentario de codigo correctamente escapado LLMED-COMPILED.
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
- Debes solo modificar el siguiente codigo fuente: {source_code}.
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llmed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jovany Leandro G.C