Skip to content

Commit

Permalink
this will take care of the document summary
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Aug 18, 2024
1 parent ae29fad commit bd8d439
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
22 changes: 1 addition & 21 deletions app/Jobs/SummarizeDocumentJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,7 @@ public function __construct(public Document $document, public string $prompt = '
*/
public function handle(): void
{

$content = [];

/**
* @NOTE
* Hit max payload on system here so
* not 100% sure the best way to break this up.
*/
$divisor = too_large_for_json($this->document->document_chunks()->count());

Log::info('[LaraChain] Divisor', [
'count' => $divisor,
]);

foreach ($this->document->document_chunks as $chunkIndex => $chunk) {
if ($chunkIndex % $divisor == 0) {
$content[] = $chunk->content;
}
}

$content = implode(' ', $content);
$content = $this->document->original_content;

if (empty($this->prompt)) {
$prompt = $this->document->collection->summary_prompt;
Expand Down
Loading

0 comments on commit bd8d439

Please sign in to comment.