@@ -181,8 +181,8 @@ class GenerateTemplate extends Command
181
181
Here are the only industries you can choose from: [INDUSTRIES]
182
182
Do no make up any new type, only use the ones listed above.
183
183
184
- Reply only with a valid JSON, being an array of string. Order assigned industries from the most relevant to the less relevant.
185
- Ex: ["banking_forms","customer_service_forms"]
184
+ Reply only with a valid JSON array , being an array of string. Order assigned industries from the most relevant to the less relevant.
185
+ Ex: { "industries": ["banking_forms","customer_service_forms"]}
186
186
EOD ;
187
187
188
188
const FORM_TYPES_PROMPT = <<<EOD
@@ -192,8 +192,8 @@ class GenerateTemplate extends Command
192
192
Here are the only types you can choose from: [TYPES]
193
193
Do no make up any new type, only use the ones listed above.
194
194
195
- Reply only with a valid JSON, being an array of string. Order assigned types from the most relevant to the less relevant.
196
- Ex: ["consent_forms","award_forms"]
195
+ Reply only with a valid JSON array , being an array of string. Order assigned types from the most relevant to the less relevant.
196
+ Ex: { "types": ["consent_forms","award_forms"]}
197
197
EOD ;
198
198
199
199
const FORM_QAS_PROMPT = <<<EOD
@@ -228,7 +228,7 @@ public function handle()
228
228
->setSystemMessage ('You are an assistant helping to generate forms. ' );
229
229
$ completer ->expectsJson ()->completeChat ([
230
230
["role " => "user " , "content " => Str::of (self ::FORM_STRUCTURE_PROMPT )->replace ('[REPLACE] ' , $ this ->argument ('prompt ' ))->toString ()]
231
- ], 6000 );
231
+ ]);
232
232
$ formData = $ completer ->getArray ();
233
233
234
234
$ completer ->doesNotExpectJson ();
@@ -315,7 +315,7 @@ private function getIndustries(GptCompleter $completer, string $formPrompt): arr
315
315
->replace ('[REPLACE] ' , $ formPrompt )
316
316
->replace ('[INDUSTRIES] ' , $ industriesString )
317
317
->toString ()]
318
- ])->getArray ();
318
+ ])->getArray ()[ ' industries ' ] ;
319
319
}
320
320
321
321
private function getTypes (GptCompleter $ completer , string $ formPrompt ): array
@@ -326,11 +326,12 @@ private function getTypes(GptCompleter $completer, string $formPrompt): array
326
326
->replace ('[REPLACE] ' , $ formPrompt )
327
327
->replace ('[TYPES] ' , $ typesString )
328
328
->toString ()]
329
- ])->getArray ();
329
+ ])->getArray ()[ ' types ' ] ;
330
330
}
331
331
332
332
private function getRelatedTemplates (array $ industries , array $ types ): array
333
333
{
334
+ ray ($ industries , $ types );
334
335
$ templateScore = [];
335
336
Template::chunk (100 , function ($ otherTemplates ) use ($ industries , $ types , &$ templateScore ) {
336
337
foreach ($ otherTemplates as $ otherTemplate ) {
0 commit comments