llmed 0.3.11 → 0.3.13

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: 0a76594513224861d625b7f9bccec631ce781a119dd940eb3136a035054c4bd5
4
- data.tar.gz: d308c71076898ec61f0a20453c762983a841955875cc1f181f6dd809b650538b
3
+ metadata.gz: d27122a6a39c8e8b65fcb2904770a1df40607a81fe4fc3509c64852c18166757
4
+ data.tar.gz: a8ad73c893af6e83223d37e0b7942748e5083afcf741ab3845f48f9819949745
5
5
  SHA512:
6
- metadata.gz: f8946ce2b8ba9bf2a7e34065c62e3c911441cbda1f9770f04f47550ad654abbfd2d59e3a3c174c9a449712e6374a2b23aa387f30783c2cb32e2b02787169dac0
7
- data.tar.gz: c9d99c0f4f6e2af6d304051608fa5dfbba3063023c5aa3c44c13ae07d74f276f7fe9bb8695d614296b8a26addb0efab8ca48cb41642b7964512ce567a0139ffd
6
+ metadata.gz: 952651684be39c509da0cbfaf4472487b03d19eb312fa2d28a4a22f4e940b5dc9a4d9e22123b52a42105e14d85c42e95dad7c830045d32df0303d43b65fdb0de
7
+ data.tar.gz: 06cff7578b503ede8222a1152653e3e195cd67ac717dbbbcd9f36d793beb1959ba7090757fd857795f4d45688ca8b544d0e3c9cf8e5080f7d733d1f3826a9b83
data/README.md CHANGED
@@ -14,24 +14,30 @@ What would happen if:
14
14
  In classic terms the LLM is the Compiler, Source Code is the Binary, the Programming language is Context Description.
15
15
 
16
16
  ```ruby
17
- set_llm provider: :openai, api_key: ENV['OPENAI_API_KEY'], model: 'gpt-4o-mini'
17
+ 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'}
18
18
 
19
- application "hola mundo ruby", release: nil, language: :ruby, output_file: "holamundo-ruby.ollmed" do
20
- # More stable context: if this changes, all subsequent context will be recompiled.
21
- context "variables" do
19
+ application "MINI COUNTER", release: nil, language: :node, output_file: "minicounter.ollmed" do
20
+ # Most stable context: if this changes, all subsequent context will be recompiled.
21
+ context "dependencies" do
22
22
  <<-LLM
23
- Variable saludos de valor 'hola mundo'.
23
+ * Must use only the standard/native library.
24
+ * Must not use external dependencies.
24
25
  LLM
25
26
  end
26
27
 
27
- # More inestable context: if this changes, only this context will be recompiled.
28
- context "main" do
28
+ # Most inestable context: if this changes, only this context will be recompiled.
29
+ context "API" do
29
30
  <<-LLM
30
- Mostrar al usuario la variable saludos.
31
+ API Server listening port 3007.
32
+ Expose the following endpoints:
33
+ - GET /count
34
+ - return the latest count.
35
+ - POST /count
36
+ - increase the count by 1.
37
+ add CORS endpoints.
31
38
  LLM
32
39
  end
33
40
  end
34
- ```
35
41
 
36
42
  ## Programming flow
37
43
 
data/lib/llm.rb CHANGED
@@ -19,6 +19,9 @@ class LLMed
19
19
  Response = Struct.new(:provider, :model, :source_code, :duration_seconds, :total_tokens, keyword_init: true)
20
20
 
21
21
  class OpenAI
22
+
23
+ DEFAULT_URI_BASE = "https://api.openai.com/".freeze
24
+
22
25
  def initialize(**args)
23
26
  @llm = Langchain::LLM::OpenAI.new(**llm_arguments(args))
24
27
  end
@@ -44,7 +47,6 @@ class LLMed
44
47
  end
45
48
 
46
49
  private
47
-
48
50
  def llm_arguments(args)
49
51
  args
50
52
  end
@@ -70,6 +72,18 @@ class LLMed
70
72
  end
71
73
  end
72
74
 
75
+ class LikeOpenAI < OpenAI
76
+ private
77
+
78
+ def llm_arguments(args)
79
+ args
80
+ end
81
+
82
+ def provider
83
+ :like_openai
84
+ end
85
+ end
86
+
73
87
  class Test
74
88
  def initialize
75
89
  @output = ''
@@ -52,10 +52,11 @@ Wrap with comment every code that belongs to the indicated context, example in {
52
52
  @language = language
53
53
  end
54
54
 
55
- def set_llm(provider:, api_key:, model:)
55
+ def set_llm(provider:, api_key:, model:, options: {})
56
56
  @provider = provider
57
57
  @provider_api_key = api_key
58
58
  @provider_model = model
59
+ @provider_options = options
59
60
  end
60
61
 
61
62
  def language(main)
@@ -77,6 +78,12 @@ Wrap with comment every code that belongs to the indicated context, example in {
77
78
  api_key: @provider_api_key,
78
79
  default_options: { temperature: 0.7, chat_model: @provider_model }
79
80
  )
81
+ when :like_openai
82
+ LLMed::LLM::LikeOpenAI.new(
83
+ api_key: @provider_api_key,
84
+ default_options: { temperature: 0.7, chat_model: @provider_model },
85
+ llm_options: @provider_options
86
+ )
80
87
  when :test
81
88
  LLMed::LLM::Test.new
82
89
  when nil
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.11
4
+ version: 0.3.13
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-12 00:00:00.000000000 Z
11
+ date: 2025-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: langchainrb