@@ -12,6 +12,7 @@ import org.evomaster.core.utils.TimeUtils
1212import java.io.File
1313import java.util.Collections
1414import java.util.concurrent.Executors
15+ import java.util.concurrent.TimeUnit
1516import kotlin.io.path.Path
1617
1718
@@ -20,9 +21,21 @@ object DictionaryCreator {
2021 @JvmStatic
2122 fun main (args : Array <String >) {
2223
24+ /*
25+ June 2026
26+ 111M tokens
27+ deepseek-v4-flash
28+ cost: ~$19
29+ size: 25.3Mb
30+ */
31+
32+ // TODO need to add manually
33+ // WARNING: make sure you do NOT commit it
2334 val API_KEY = " "
2435
2536 val file = File (" src/main/resources/llm_dictionary.jsonl" )
37+ val errors = 0
38+ val alreadyHandled = errors + file.bufferedReader().use { it.lineSequence().count() }
2639
2740// val modelName = "deepseek-v4-pro"
2841 val modelName = " deepseek-v4-flash"
@@ -33,17 +46,24 @@ object DictionaryCreator {
3346 TimeUtils .measureTimeMillis(
3447 {ms, res -> println (" Took ${ms/ 1000 } s" )},
3548 {
36- val executor = Executors .newFixedThreadPool(10 )
49+ val parallelism = 20
50+ val executor = Executors .newFixedThreadPool(parallelism)
3751 val list = Collections .synchronizedList(mutableListOf<String >())
3852
3953 val futures = data.entries
4054 .sortedBy { it.key }
41- // .drop(1) //TODO for debugging
42- .take(10 ) // TODO for debugging
55+ .drop(alreadyHandled)
56+ .take(2000 ) // TODO use for incremental job
4357 .map { entry ->
4458 executor.submit { handleEntry(entry, model, list) }
4559 }
46- futures.forEach { it.get() }
60+ futures.forEach {
61+ try {
62+ it.get(120 , TimeUnit .SECONDS )
63+ }catch (e: Exception ) {
64+ println (" ERROR. Failed to wait for job: ${e.message} " )
65+ }
66+ }
4767 executor.shutdown()
4868
4969 list.sorted().forEach {
@@ -62,18 +82,22 @@ object DictionaryCreator {
6282 val description = entry.value.maxByOrNull { it.length }
6383 val prompt = Prompts .getPromptForNameDescription(name, description)
6484 var result = LlmSupport .chat(model, prompt.first, prompt.second)
65- val list = try {
85+ try {
6686 mapper.readValue(result, object : TypeReference <List <String >>() {})
6787 } catch (e: Exception ) {
68- val failed = Prompts .getPromptForFailedName(e.toString())
69- result = LlmSupport .chat(model, failed.first, failed.second)
70- mapper.readValue(result, object : TypeReference <List <String >>() {})
71- } catch (e: Exception ) {
72- print (" Failed handling response: $result " )
73- throw e
88+ print (" ERROR. Failed handling response: $result " )
89+ try {
90+ val failed = Prompts .getPromptForFailedName(e.toString())
91+ result = LlmSupport .chat(model, failed.first, failed.second)
92+ mapper.readValue(result, object : TypeReference <List <String >>() {})
93+ } catch (e: Exception ) {
94+ print (" ERROR. Failed again handling response: $result " )
95+ throw e
96+ }
7497 }
7598
76- val row = " { \" $name \" : $result }"
99+ // must be a single row, and we have it in the prompt, but sometimes it is ignored
100+ val row = " { \" $name \" : $result }" .replace(' \n ' ,' ' )
77101 println (row)
78102 buffer.add(row)
79103 }
@@ -83,8 +107,7 @@ object DictionaryCreator {
83107 val data = mutableMapOf<String , MutableSet <String >>()
84108
85109 val locations = scanForSchemas(" ./src/test/resources/swagger" )
86- // TODO put back once rest finished
87- // .plus(scanForSchemas("../core-tests/integration-tests/core-it/src/test/resources/APIs_guru"))
110+ .plus(scanForSchemas(" ../core-tests/integration-tests/core-it/src/test/resources/APIs_guru" ))
88111
89112 for (l in locations){
90113 println (" Analyzing: $l " )
0 commit comments