-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
the missing [context] left out all the data
- Loading branch information
Showing
7 changed files
with
112 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
namespace App\Domains\Prompts; | ||
|
||
use Illuminate\Support\Facades\Log; | ||
|
||
class EventPageAsArrayPrompt | ||
{ | ||
public static function prompt(string $context): string | ||
{ | ||
Log::info('[LaraChain] - EventPageAsArrayPrompt'); | ||
|
||
return <<<PROMPT | ||
<ROLE> | ||
You are an AI assistant tasked with extracting event data from website content. | ||
<INSTRUCTIONS> | ||
1. Analyze the provided website HTML content below the <CONTENT> tag. | ||
2. Look for information about events within the content. | ||
3. If no event data is found, respond with a single word: false | ||
4. If event data is found, extract the following information for each event: | ||
- Event Title | ||
- Start Date | ||
- End Date | ||
- Location | ||
- Description | ||
- Any other relevant data | ||
5. Format the extracted data as a JSON array according to the specifications below. | ||
<OUTPUT_FORMAT> | ||
If events are found, return a JSON array with the following structure: | ||
[ | ||
{ | ||
"title": "Event Title", | ||
"startDate": "Start Date", | ||
"endDate": "End Date", | ||
"location": "Location", | ||
"description": "Description", | ||
"additionalInfo": "Any other relevant data" | ||
}, | ||
{ | ||
"title": "Event Title", | ||
"startDate": "Start Date", | ||
"endDate": "End Date", | ||
"location": "Location", | ||
"description": "Description", | ||
"additionalInfo": "Any other relevant data" | ||
} | ||
] | ||
If no events are found, return an empty JSON array: [] | ||
<CONTENT> | ||
$context | ||
</CONTENT> | ||
Respond only with the JSON array or 'false' if no events are found. Do not include any explanations or additional text in your response. | ||
PROMPT; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
database/migrations/2024_07_25_194618_add_md5_to_documents.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::table('documents', function (Blueprint $table) { | ||
$table->string('document_md5')->nullable(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::table('documents', function (Blueprint $table) { | ||
// | ||
}); | ||
} | ||
}; |