- Add WebSearchInterface + TavilyWebSearch (POST /search, max 5 results)
- SpecsResearchAgent now fetches search results first, injects them as
{{searchResults}} context into the prompt, then calls plain generate()
— no dependency on model-specific web_search tool support
- Update specs_research prompt template (PHP default + DB migration) to
use the new {{searchResults}} variable
- Wire TAVILY_API_KEY env var; register TavilyWebSearch in services.yaml
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
51 lines
1.7 KiB
PHP
51 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DoctrineMigrations;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
final class Version20260520020000 extends AbstractMigration
|
|
{
|
|
public function getDescription(): string
|
|
{
|
|
return 'Update specs_research prompt to include {{searchResults}} from Tavily';
|
|
}
|
|
|
|
public function up(Schema $schema): void
|
|
{
|
|
$body = <<<'PROMPT'
|
|
You are a hardware specifications expert. Extract the technical specifications for the {{articleType}}: "{{subject}}".
|
|
|
|
Web search results:
|
|
{{searchResults}}
|
|
|
|
Based on the search results above, list all technical specifications including:
|
|
processor, RAM, storage variants, display size and resolution, GPU, battery capacity,
|
|
ports, connectivity, weight, dimensions, OS, and any other relevant specs.
|
|
Be specific and accurate. If a spec is not found in the search results, omit it rather than guessing.
|
|
PROMPT;
|
|
|
|
$this->addSql(
|
|
"UPDATE app.prompt_templates SET body = :body WHERE key = 'specs_research'",
|
|
['body' => $body],
|
|
);
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$body = <<<'PROMPT'
|
|
List all known technical specifications for the {{articleType}}: "{{subject}}".
|
|
Include: processor, RAM, storage variants, display size and resolution, GPU, battery capacity,
|
|
ports, connectivity, weight, dimensions, OS, and any other relevant specs.
|
|
If you know this device, be specific and complete. If it is unknown, say so explicitly.
|
|
PROMPT;
|
|
|
|
$this->addSql(
|
|
"UPDATE app.prompt_templates SET body = :body WHERE key = 'specs_research'",
|
|
['body' => $body],
|
|
);
|
|
}
|
|
}
|