Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a GPT-3 Lazy Collection #4

Open
gregpriday opened this issue Jun 30, 2021 · 0 comments
Open

Create a GPT-3 Lazy Collection #4

gregpriday opened this issue Jun 30, 2021 · 0 comments

Comments

@gregpriday
Copy link
Member

We should create a lazy collection that creates new instances of an item using GPT-3. This should be a class that extends the base Larave LazyCollectiont to add methods for adding seed data, a prompt as well as various options.

This is a general-purpose version of #2, in fact, we could even build the model factory on top of this collection.

Options and Settings

These are the options and settings the lazy collection will need.

  • Query|Collection|Closure $seed - The seed data that we'll pass to GPT-3. In the case of a closure, we'll call it for each call to GPT-3 so the data is always unique.
  • int $chunkSize - we might need to give this a different name. The chunk is how many items we'll get from GPT-3 with each request.
  • array $gpt3Options - an array of GPT-3 options.
  • Closure $itemToString - a closure that converts an item (usually a seed item) into a string for GPT-3.
  • Closure $stringToItem - a closure that converts a string from GPT-3 back into a item (Model, Object, array, etc)
  • string $itemSeparator - a string used to separate item instances.
  • string $prompt - The prompt string for GPT-3.

Adding Seed Data

The user should be able to set the seed data in a constructor in a separate withSeed.

Using a Closure for Seed data

Here's an example of creating a generator that is seeded with 10 random items from a collection each time its run:

$generator = new GeneratingCollection(fn() => $collection->shuffle()->slice(10));

This, along with a higher temperature setting for GPT-3, should ensure a lot of variety in the results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant