Falcon AI 🚧

In development (coming soon) 🚧

Falcon AI is a wrapper for orhanerday/open-ai (opens in a new tab) which allows you to supercharge your scraping and extract data like never before!

Usage

// first we scrape the page
$falcon = Falcon::getInstance()->run("https://example.com/");
 
// now we ask chatgpt to help us retreive something from the document:
$chatgpt = $falcon->ai()->chat([
   'model' => 'gpt-3.5-turbo',
   'messages' => [
       [
           "role" => "user",
           "content" => "Can you help me retreive contact details in JSON format that has first_name, last_name & email fields from this HTML document {$falcon->getRawHtml()}",
       ]
   ],
   'temperature' => 1.0,
   'max_tokens' => 4000,
   'frequency_penalty' => 0,
   'presence_penalty' => 0,
]);
 
// decode messages
$d = json_decode($chat);
// Get Content
echo($d->choices[0]->message->content);

Any orhanerday/open-ai method can be called via the ai method:

$falcon->ai()->listModels();