-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7e695d
commit 017a902
Showing
6 changed files
with
61 additions
and
7 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
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,30 @@ | ||
# Collections | ||
|
||
|
||
```php | ||
<?php | ||
$loader = require 'vendor/autoload.php'; | ||
$loader->add('Cognesy\\Instructor\\', __DIR__.'../../src/'); | ||
|
||
use Cognesy\Instructor\Instructor; | ||
use Cognesy\Instructor\Utils\Collection; | ||
|
||
class Fact | ||
{ | ||
public string $key; | ||
public string $value; | ||
} | ||
|
||
$text = <<<TEXT | ||
Jason is 25 years old. He is a programmer. He has a car. He lives | ||
in a small house in Alamo. He likes to play guitar. | ||
TEXT; | ||
|
||
$list = (new Instructor)->respond( | ||
messages: [['role' => 'user', 'content' => $text]], | ||
responseModel: Collection::of(Fact::class) | ||
); | ||
|
||
dump($list); | ||
?> | ||
``` |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.