llmed 0.1.16 → 0.1.17

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/lib/llm.rb +5 -1
  3. data/lib/llmed.rb +5 -13
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09c50ad00371154217526840bd23d9905bdd41db9603e677a94508f27518c09f'
4
- data.tar.gz: fdea6c57beeb69aa45a5324f4533431ca732da087538130e4c483c22b6ceef0a
3
+ metadata.gz: 66603fc5fdc0f63f5c066ca085a80dee2a259e4a1d30f315f52e018f5bfec0de
4
+ data.tar.gz: 244a8d4938c85cd395a541eb18491e007b8e116d4dbf997d4f71a05050d5b5a9
5
5
  SHA512:
6
- metadata.gz: 25adbc23488893e2c29ba284e3da0ab45fc466d5258bc6f54753a87bf2eb7273d0eafbfe95eda1b77d1deaad58bc897d47d3d6cdc7e83eac4f3cb43a712bf0ba
7
- data.tar.gz: f1fe49760f451316f9ff3155c482155c3fb6653139f386602175dab09dc95b578d90cc9147218ede345246cfb2fdbbebf44b5e7e271d01c7ab30e04aeafe138b
6
+ metadata.gz: 2f9c7c6e0f9949b7a2876051912a645e786bd65eaba09e23bf837f1e52ae1cb8c0d645194028ac5f8b65c5e0a0f8d5d6197d6ac1155753dfa38f887ac57a6fc9
7
+ data.tar.gz: 308e33e710860f4ed3b63b007875aa4c339edac3bbb9f8ab6c13452cb48919408e610282991f53fefb38c27a009fb3e9acf0e4035944f40867a9f833825b2e49
data/lib/llm.rb CHANGED
@@ -16,7 +16,7 @@ class LLMed
16
16
  end
17
17
  end
18
18
 
19
- Response = Struct.new(:provider, :model, :source_code, :total_tokens, keyword_init: true)
19
+ Response = Struct.new(:provider, :model, :source_code, :duration_seconds, :total_tokens, keyword_init: true)
20
20
 
21
21
  class OpenAI
22
22
  def initialize(**args)
@@ -33,9 +33,12 @@ class LLMed
33
33
  end
34
34
  end
35
35
 
36
+ start = Time.now
36
37
  llm_response = @llm.chat(messages: messages)
38
+ stop = Time.now
37
39
  Response.new({ provider: :openai,
38
40
  model: @llm.chat_parameters[:model],
41
+ duration_seconds: stop.to_i - start.to_i,
39
42
  source_code: source_code(llm_response.chat_completion),
40
43
  total_tokens: llm_response.total_tokens })
41
44
  end
@@ -57,6 +60,7 @@ class LLMed
57
60
 
58
61
  Response.new({ provider: :test,
59
62
  model: 'test',
63
+ duration_seconds: 0,
60
64
  source_code: @output,
61
65
  total_tokens: 0 })
62
66
  end
data/lib/llmed.rb CHANGED
@@ -189,7 +189,8 @@ You must only modify the following source code:
189
189
  provider: response.provider,
190
190
  model: response.model,
191
191
  release: @release,
192
- total_tokens: response.total_tokens
192
+ total_tokens: response.total_tokens,
193
+ duration_seconds: response.duration_seconds
193
194
  }
194
195
  file.puts stat.to_json
195
196
  end
@@ -226,11 +227,7 @@ You must only modify the following source code:
226
227
 
227
228
  def compile(output_dir:, release_dir: nil)
228
229
  @applications.each do |app|
229
- app.notify('COMPILE START')
230
- _, elapsed_seconds = measure do
231
- compile_application(app, output_dir, release_dir)
232
- end
233
- app.notify("COMPILE DONE #{elapsed_seconds}")
230
+ compile_application(app, output_dir, release_dir)
234
231
  end
235
232
  end
236
233
 
@@ -239,6 +236,7 @@ You must only modify the following source code:
239
236
  def compile_application(app, output_dir, release_dir)
240
237
  release_dir ||= output_dir
241
238
 
239
+ app.notify('COMPILE START')
242
240
  @logger.info("APPLICATION #{app.name} COMPILING")
243
241
 
244
242
  llm = @configuration.llm
@@ -258,6 +256,7 @@ You must only modify the following source code:
258
256
  @logger.info("APPLICATION #{app.name} TOTAL TOKENS #{llm_response.total_tokens}")
259
257
  write_output(app, output_dir, llm_response.source_code)
260
258
  write_statistics(app, release_dir, llm_response)
259
+ app.notify("COMPILE DONE #{llm_response.duration_seconds}")
261
260
  end
262
261
 
263
262
  def write_statistics(app, release_dir, response)
@@ -269,13 +268,6 @@ You must only modify the following source code:
269
268
  file.write(output)
270
269
  end
271
270
  end
272
-
273
- def measure
274
- start = Time.now
275
- result = yield
276
- stop = Time.now
277
- [result, stop - start]
278
- end
279
271
  end
280
272
 
281
273
  require_relative 'llm'
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.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jovany Leandro G.C