These are some theoretical example uses for a GPT-3 Laravel Factory.
-
-
Save gregpriday/8f2a113773d61cf6f9053b7a6de18677 to your computer and use it in GitHub Desktop.
Example GPT-3 Laravel Factory Uses
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
<?php | |
use SiteOrigin\LaravelOpenAI\Factory as GPT3Factory | |
class MyModelFactory extends GPT3Factory { | |
protected $model = MyModel::class; | |
} | |
$models = MyModelFactory::withPrompt("This is a list of MyModels. Each one represents some_realworld_thing:") | |
->withFields(['tags', 'excerpt']) | |
->withFieldCast('tags', 'array') | |
->withTitle(function(Model $v){ | |
return $v->title . ':' . $v->excerpt; | |
}) | |
->withTitleToAttributes(function(string $v){ | |
// Convert the title string back into attributes | |
list($title, $excerpt) = explode(':', $v, 2); | |
return compat($title, $excerpt); | |
}) | |
->create(5); | |
dd($models); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment