llmed 0.3.17 → 0.3.18
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/literate_programming.llmed +36 -0
- data/lib/literate_programming.llmed~ +39 -0
- data/lib/llmed/literate_programming.llmed +35 -0
- data/lib/llmed/markdown.rb.statistics +1 -0
- data/lib/llmed.rb +2 -2
- metadata +6 -3
- data/lib/llmed/literate_programming.rb +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2d293c8ee975eb321825f0e913ae677ac82a637e17eb5ec937f2cc787e60f00
|
4
|
+
data.tar.gz: c452a909758522e6a9a802f04fd65d20bb1e0afbc126045a7ddd54e2254109d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27c0f743139d321d6eef06fc26a7bc9c0ba2a6a0cbae25e0796d17f2b2f6b01871972ba4dd1be856e86663bf1f4de4dae8a426bc01184a7296f38c090ee6b4a7
|
7
|
+
data.tar.gz: 30044ce1bc97933d40b739309805983243129fbb2985a7bdfb14e57a5e2ccd0e3b18495ed9d635a97e9c25c040d7000a444f2dce3b2fadcace7cd5d4b97698b6
|
@@ -0,0 +1,36 @@
|
|
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
|
@@ -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,35 @@
|
|
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
|
@@ -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, &block)
|
37
37
|
@app = Application.new(
|
38
38
|
name: name,
|
39
39
|
language: @configuration.language(language),
|
@@ -42,7 +42,7 @@ class LLMed
|
|
42
42
|
logger: @logger,
|
43
43
|
release: release,
|
44
44
|
release_dir: @release_dir,
|
45
|
-
output_dir: @output_dir
|
45
|
+
output_dir: output_dir || @output_dir
|
46
46
|
)
|
47
47
|
@applications << @app
|
48
48
|
end
|
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.18
|
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,8 @@ files:
|
|
92
92
|
- LICENSE
|
93
93
|
- README.md
|
94
94
|
- exe/llmed
|
95
|
+
- lib/literate_programming.llmed
|
96
|
+
- lib/literate_programming.llmed~
|
95
97
|
- lib/llm.rb
|
96
98
|
- lib/llm.rb~
|
97
99
|
- lib/llmed.rb
|
@@ -104,8 +106,9 @@ files:
|
|
104
106
|
- lib/llmed/context.rb~
|
105
107
|
- lib/llmed/deployment.rb
|
106
108
|
- lib/llmed/deployment.rb~
|
107
|
-
- lib/llmed/literate_programming.
|
109
|
+
- lib/llmed/literate_programming.llmed
|
108
110
|
- lib/llmed/literate_programming.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
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'toml-rb'
|
2
|
-
|
3
|
-
class LLMed
|
4
|
-
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
|
-
end
|
50
|
-
end
|