Skip to content

Commit

Permalink
add new prompt template for event data
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Jul 22, 2024
1 parent 51d554a commit f31c435
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions app/Jobs/GetWebContentJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public function handle(): void
! $this->source->force &&
SourceTask::where('source_id', $this->source->id)->where('task_key', $key)->exists()) {
Log::info('[LaraChain] GetWebContentJob - Skipping - already ran');

return;
}

Expand Down Expand Up @@ -111,15 +112,15 @@ public function handle(): void

$promptResults = json_decode($promptResultsOriginal, true);

if(is_null($promptResults)) {
$promptResults = Arr::wrap($promptResultsOriginal);
if (is_null($promptResults)) {
$promptResults = Arr::wrap($promptResultsOriginal);
}

/**
* @NOTE all the user to build array results
* Like Events from a webpage
*/
foreach($promptResults as $promptResultIndex => $promptResult) {
foreach ($promptResults as $promptResultIndex => $promptResult) {

$promptResult = json_encode($promptResult);

Expand Down Expand Up @@ -184,7 +185,7 @@ public function handle(): void
new SummarizeDocumentJob($document),
new TagDocumentJob($document),
new DocumentProcessingCompleteJob($document),
]
],
])
->name(sprintf('Final Document Steps Document %s id %d', $document->type->name, $document->id))
->allowFailures()
Expand All @@ -195,7 +196,6 @@ public function handle(): void
->dispatch();
}


/**
* @NOTE
* I could move this into the loop if it is not
Expand All @@ -215,7 +215,6 @@ public function handle(): void
message: $assistantMessage,
prompt: $prompt);


}
}
}
2 changes: 1 addition & 1 deletion tests/Feature/Jobs/GetWebContentJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function test_array(): void
LlmDriverFacade::shouldReceive('driver->completion')
->once()
->andReturn(CompletionResponse::from([
'content' => "[{\"content\":\"Test 1\"},{\"content\":\"Test 2\"}]",
'content' => '[{"content":"Test 1"},{"content":"Test 2"}]',
]));

$this->assertDatabaseCount('documents', 0);
Expand Down

0 comments on commit f31c435

Please sign in to comment.