@@ -25,6 +25,12 @@ class LlmService {
2525
2626 private lateinit var syncModel: ChatModel
2727
28+ /* *
29+ * We can make several requests in parallel toward an LLM.
30+ * In the end, these are I/O bound, and could take fews seconds each.
31+ * So make sense to do in parallel and asynchronously, especially when we do not need to wait
32+ * for the responses.
33+ */
2834 private lateinit var executor: ExecutorService
2935
3036 @PostConstruct
@@ -81,6 +87,11 @@ class LlmService {
8187 return LlmSupport .chat(syncModel, " " , userMessage)
8288 }
8389
90+ /* *
91+ * Query the LLM for input data examples, based on parameter name and optional description.
92+ * These calls will be made in parallel, for each [fields] entry.
93+ * When a task is completed, the [callback] is executed with the collected examples.
94+ */
8495 fun askForNewExamples (fields : Collection <FieldInfo >, callback : (name: String , examples: Collection <String >) -> Unit ){
8596
8697 fields.toList()
@@ -96,6 +107,9 @@ class LlmService {
96107 description : String? ,
97108 callback : (name: String , examples: Collection <String >) -> Unit
98109 ){
110+ /*
111+ Note: this is the same approach used to build the dictionary
112+ */
99113 val mapper = ObjectMapper ()
100114 val prompt = Prompts .getPromptForNameDescription(name, description)
101115 var result = LlmSupport .chat(syncModel, prompt.first, prompt.second)
0 commit comments