llmed 0.3.17 → 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26f64ce9f1d2a1fb5bf48f03b29d8655e920fbf35bc52d7f88dd62b0484e46bc
|
4
|
+
data.tar.gz: 225854a7506247a8ef9de98d63c3615b8fe92caeb79dc5a6228739102652560a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a317a663ed4c396469c4c7e082b19ab92d8633ce31ed022b8b1a3c90cc61635bac218d42eaf942c6508a643fffb5906d9a682a8962b11d151358dcb104975d4
|
7
|
+
data.tar.gz: 4c1347a274c421b2a9b7f04d5a2d7f63e78f8397d71be39ad34e3288c78c935e60a75a2f3c38bf6470d1bba11c3ab4be3c7e7712bcf4d984070f576fbb65d7de
|
@@ -0,0 +1,39 @@
|
|
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 a function call `parse(input: String)`.
|
7
|
+
|
8
|
+
### Example of usage
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
md = LLmed::LiteratePrograming::Markdown.new()
|
12
|
+
md.parse("
|
13
|
+
# Context A
|
14
|
+
Contenido
|
15
|
+
[link](http://link)
|
16
|
+
## SubContexto A
|
17
|
+
SubContenido
|
18
|
+
|
19
|
+
# Contexto 3
|
20
|
+
Contenido 3
|
21
|
+
|
22
|
+
") == [{type: :context,
|
23
|
+
title: "Context A",
|
24
|
+
content: [
|
25
|
+
{type: :string, content: "Contenido\n"},
|
26
|
+
{type: :link, content: "link", reference: "http://link"},
|
27
|
+
{type: :string, content: "##SubContexto A\nSubContenido\n\n"}
|
28
|
+
]},
|
29
|
+
{type: :context,
|
30
|
+
title: "Contexto 3",
|
31
|
+
content: [
|
32
|
+
{type: :string, content: "Contenido 3\n\n"}
|
33
|
+
]}]
|
34
|
+
```
|
35
|
+
|
36
|
+
|
37
|
+
LLM
|
38
|
+
end
|
39
|
+
end
|
@@ -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>
|
@@ -1,50 +1,7 @@
|
|
1
|
-
require 'toml-rb'
|
2
1
|
|
3
2
|
class LLMed
|
4
3
|
class LiterateProgramming
|
5
|
-
ContentString = Struct.new(:content, keyword_init: true) do
|
6
|
-
def to_s
|
7
|
-
content
|
8
|
-
end
|
9
|
-
end
|
10
|
-
ContentFencedBlock = Struct.new(:format, :arguments, :content, keyword_init: true)
|
11
|
-
Context = Struct.new(:name, :content, :content_desc, keyword_init: true)
|
12
|
-
Application = Struct.new(:configuration, :contexts, keyword_init: true)
|
13
|
-
|
14
|
-
class Markdown
|
15
|
-
|
16
|
-
def parse(content)
|
17
|
-
content.scan(/^---(.+?)---\n(.+)/m) => [[configuration_data, application_data]]
|
18
|
-
|
19
|
-
app = Application.new(configuration: TomlRB.parse(configuration_data), contexts: [])
|
20
|
-
|
21
|
-
application_data.split(/^# /)
|
22
|
-
.reject{|c| c.empty?}
|
23
|
-
.each do |context_data|
|
24
|
-
case context_data.split("\n", 2)
|
25
|
-
in ["", ""]
|
26
|
-
# omit
|
27
|
-
in [name, content]
|
28
|
-
context_desc = []
|
29
|
-
content.split(/(```.*```)/mi).each do |line|
|
30
|
-
if line.start_with?("```")
|
31
|
-
line.scan(/```(.+?)\n(.+)```/mi) => [[fenced_data, fenced_content]]
|
32
|
-
fenced_params = fenced_data.split(",")
|
33
|
-
format = fenced_params.shift
|
34
|
-
arguments = fenced_params.map{|item| item.split("=", 2)}.to_h
|
35
|
-
|
36
|
-
context_desc << ContentFencedBlock.new(format: format, arguments: arguments, content: fenced_content)
|
37
|
-
else
|
38
|
-
context_desc << ContentString.new(content: line)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
app.contexts << Context.new(name: name, content: content, content_desc: context_desc)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
app
|
47
|
-
end
|
48
|
-
end
|
49
4
|
end
|
50
5
|
end
|
6
|
+
|
7
|
+
require_relative 'literate_programming/markdown'
|
@@ -0,0 +1 @@
|
|
1
|
+
{"inserted_at":1750948249,"name":"Literate Programming Markdown","provider":"like_openai","model":"Qwen/Qwen2.5-Coder-32B-Instruct","release":null,"total_tokens":825,"duration_seconds":6}
|
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, &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,8 +41,8 @@ class LLMed
|
|
41
41
|
block: block,
|
42
42
|
logger: @logger,
|
43
43
|
release: release,
|
44
|
-
release_dir: @release_dir,
|
45
|
-
output_dir: @output_dir
|
44
|
+
release_dir: release_dir || @release_dir,
|
45
|
+
output_dir: output_dir || @output_dir
|
46
46
|
)
|
47
47
|
@applications << @app
|
48
48
|
end
|
@@ -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,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: llmed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jovany Leandro G.C
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-06-
|
11
|
+
date: 2025-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: langchainrb
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- LICENSE
|
93
93
|
- README.md
|
94
94
|
- exe/llmed
|
95
|
+
- lib/literate_programming.llmed~
|
95
96
|
- lib/llm.rb
|
96
97
|
- lib/llm.rb~
|
97
98
|
- lib/llmed.rb
|
@@ -106,6 +107,8 @@ files:
|
|
106
107
|
- lib/llmed/deployment.rb~
|
107
108
|
- lib/llmed/literate_programming.rb
|
108
109
|
- lib/llmed/literate_programming.rb~
|
110
|
+
- lib/llmed/literate_programming/markdown.rb
|
111
|
+
- lib/llmed/markdown.rb.statistics
|
109
112
|
- lib/llmed/release.rb
|
110
113
|
- lib/llmed/release.rb~
|
111
114
|
homepage: https://github.com/bit4bit/llmed
|