llmed 0.3.18 → 0.3.19

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2d293c8ee975eb321825f0e913ae677ac82a637e17eb5ec937f2cc787e60f00
4
- data.tar.gz: c452a909758522e6a9a802f04fd65d20bb1e0afbc126045a7ddd54e2254109d5
3
+ metadata.gz: 26f64ce9f1d2a1fb5bf48f03b29d8655e920fbf35bc52d7f88dd62b0484e46bc
4
+ data.tar.gz: 225854a7506247a8ef9de98d63c3615b8fe92caeb79dc5a6228739102652560a
5
5
  SHA512:
6
- metadata.gz: 27c0f743139d321d6eef06fc26a7bc9c0ba2a6a0cbae25e0796d17f2b2f6b01871972ba4dd1be856e86663bf1f4de4dae8a426bc01184a7296f38c090ee6b4a7
7
- data.tar.gz: 30044ce1bc97933d40b739309805983243129fbb2985a7bdfb14e57a5e2ccd0e3b18495ed9d635a97e9c25c040d7000a444f2dce3b2fadcace7cd5d4b97698b6
6
+ metadata.gz: 5a317a663ed4c396469c4c7e082b19ab92d8633ce31ed022b8b1a3c90cc61635bac218d42eaf942c6508a643fffb5906d9a682a8962b11d151358dcb104975d4
7
+ data.tar.gz: 4c1347a274c421b2a9b7f04d5a2d7f63e78f8397d71be39ad34e3288c78c935e60a75a2f3c38bf6470d1bba11c3ab4be3c7e7712bcf4d984070f576fbb65d7de
@@ -0,0 +1,24 @@
1
+ #<llmed-code context='Library LLMed::LiterateProgramming::Markdown' digest='18aa5391a8a334f24a80542620a277bb9c085762cb88b7dbcafa26a532a48027' after=''>
2
+ class LLMed::LiterateProgramming::Markdown
3
+ def parse(input)
4
+ contexts = []
5
+ current_context = { type: :context, title: "_default", content: [] }
6
+
7
+ input.each_line do |line|
8
+ if line.strip =~ /^# (.+)$/
9
+ contexts << current_context unless current_context[:content].empty?
10
+ current_context = { type: :context, title: Regexp.last_match(1), content: [] }
11
+ elsif line.strip =~ /^\[(.+)\]\((.+)\)$/
12
+ current_context[:content] << { type: :link, content: Regexp.last_match(1), reference: Regexp.last_match(2) }
13
+ elsif line.strip =~ /^#% (.+)$/
14
+ current_context[:content] << { type: :comment, content: Regexp.last_match(1) + "\n" }
15
+ else
16
+ current_context[:content] << { type: :string, content: line }
17
+ end
18
+ end
19
+
20
+ contexts << current_context unless current_context[:content].empty?
21
+ contexts
22
+ end
23
+ end
24
+ #</llmed-code>
@@ -0,0 +1,7 @@
1
+
2
+ class LLMed
3
+ class LiterateProgramming
4
+ end
5
+ end
6
+
7
+ require_relative 'literate_programming/markdown'
@@ -1,4 +1 @@
1
- class LLMed
2
- class LiterateProgramming::Markdown
3
- end
4
- end
1
+ require_relative 'literater_programming/markdown'
data/lib/llmed.rb CHANGED
@@ -33,7 +33,7 @@ class LLMed
33
33
  # changes default prompt
34
34
  def_delegator :@configuration, :set_prompt, :set_prompt
35
35
 
36
- def application(name, output_file:, language: nil, release: nil, output_dir: nil, &block)
36
+ def application(name, output_file:, language: nil, release: nil, output_dir: nil, release_dir: nil, &block)
37
37
  @app = Application.new(
38
38
  name: name,
39
39
  language: @configuration.language(language),
@@ -41,7 +41,7 @@ class LLMed
41
41
  block: block,
42
42
  logger: @logger,
43
43
  release: release,
44
- release_dir: @release_dir,
44
+ release_dir: release_dir || @release_dir,
45
45
  output_dir: output_dir || @output_dir
46
46
  )
47
47
  @applications << @app
@@ -94,3 +94,4 @@ require_relative 'llmed/context'
94
94
  require_relative 'llmed/release'
95
95
  require_relative 'llmed/application'
96
96
  require_relative 'llmed/deployment'
97
+ require_relative 'llmed/literate_programming'
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.3.18
4
+ version: 0.3.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jovany Leandro G.C
@@ -92,7 +92,6 @@ files:
92
92
  - LICENSE
93
93
  - README.md
94
94
  - exe/llmed
95
- - lib/literate_programming.llmed
96
95
  - lib/literate_programming.llmed~
97
96
  - lib/llm.rb
98
97
  - lib/llm.rb~
@@ -106,8 +105,9 @@ files:
106
105
  - lib/llmed/context.rb~
107
106
  - lib/llmed/deployment.rb
108
107
  - lib/llmed/deployment.rb~
109
- - lib/llmed/literate_programming.llmed
108
+ - lib/llmed/literate_programming.rb
110
109
  - lib/llmed/literate_programming.rb~
110
+ - lib/llmed/literate_programming/markdown.rb
111
111
  - lib/llmed/markdown.rb.statistics
112
112
  - lib/llmed/release.rb
113
113
  - lib/llmed/release.rb~
@@ -1,36 +0,0 @@
1
- set_llm provider: :openai, api_key: ENV['OPENAI_API_KEY'], model: 'gpt-4o-mini'
2
- #set_llm provider: :like_openai, api_key: ENV['TOGETHERAI_API_KEY'], model: 'Qwen/Qwen2.5-Coder-32B-Instruct', options: {uri_base: 'https://api.together.xyz/v1'}
3
-
4
- application "Literate Programming Markdown", release: nil, language: :ruby, output_file: "markdown.rb", output_dir: "literate_programming" do
5
- context "Library LLmed::LiterateProgramming::Markdown" do
6
- <<-LLM
7
- Exports the function `parse(input: String)`.
8
- Example of expected behavior:
9
- ```ruby
10
- md = LLmed::LiteratePrograming::Markdown.new()
11
- md.parse("
12
- # Context A
13
- Contenido
14
- [link](http://link)
15
- ## SubContexto A
16
- SubContenido
17
-
18
- # Contexto 3
19
- Contenido 3
20
-
21
- ") == [{type: :context,
22
- title: "Context A",
23
- content: [
24
- {type: :string, content: "Contenido\n"},
25
- {type: :link, content: "link", reference: "http://link"},
26
- {type: :string, content: "##SubContexto A\nSubContenido\n\n"}
27
- ]},
28
- {type: :context,
29
- title: "Contexto 3",
30
- content: [
31
- {type: :string, content: "Contenido 3\n\n"}
32
- ]}]
33
- ```
34
- LLM
35
- end
36
- end
@@ -1,35 +0,0 @@
1
- set_llm provider: :like_openai, api_key: ENV['TOGETHERAI_API_KEY'], model: 'Qwen/Qwen2.5-Coder-32B-Instruct', options: {uri_base: 'https://api.together.xyz/v1'}
2
-
3
- application "Literate Programming Markdown", release: nil, language: :ruby, output_file: "markdown.rb", output_dir: "literate_programming" do
4
- context "Library LLmed::LiterateProgramming::Markdown" do
5
- <<-LLM
6
- Exports the function `parse(input: String)`.
7
- Example of expected behavior:
8
- ```ruby
9
- md = LLmed::LiteratePrograming::Markdown.new()
10
- md.parse("
11
- # Context A
12
- Contenido
13
- [link](http://link)
14
- ## SubContexto A
15
- SubContenido
16
-
17
- # Contexto 3
18
- Contenido 3
19
-
20
- ") == [{type: :context,
21
- title: "Context A",
22
- content: [
23
- {type: :string, content: "Contenido\n"},
24
- {type: :link, content: "link", reference: "http://link"},
25
- {type: :string, content: "##SubContexto A\nSubContenido\n\n"}
26
- ]},
27
- {type: :context,
28
- title: "Contexto 3",
29
- content: [
30
- {type: :string, content: "Contenido 3\n\n"}
31
- ]}]
32
- ```
33
- LLM
34
- end
35
- end