-
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
907522e
commit 614ab0b
Showing
13 changed files
with
189 additions
and
125 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
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,10 @@ | ||
<?php | ||
|
||
namespace Cognesy\Instructor\Contracts; | ||
|
||
use Cognesy\Instructor\Events\Event; | ||
|
||
interface CanReceiveEvents | ||
{ | ||
public function onEvent(Event $event) : void; | ||
} |
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 |
---|---|---|
@@ -1,23 +1,32 @@ | ||
<?php | ||
namespace Cognesy\Instructor\Core; | ||
|
||
use Cognesy\Instructor\Schema\Data\Schema\Schema; | ||
|
||
class ResponseModel | ||
{ | ||
public mixed $instance; // calculated | ||
public ?string $class; // calculated | ||
public ?array $functionCall; // calculated | ||
public Schema $schema; // calculated | ||
public array $jsonSchema; | ||
public bool $receivesEvents = false; | ||
|
||
public string $functionName = 'extract_data'; | ||
public string $functionDescription = 'Extract data from provided content'; | ||
|
||
public function __construct( | ||
string $class = null, | ||
mixed $instance = null, | ||
array $functionCall = null, | ||
string $class = null, | ||
mixed $instance = null, | ||
Schema $schema = null, | ||
array $jsonSchema = null, | ||
array $functionCall = null, | ||
) | ||
{ | ||
$this->class = $class; | ||
$this->instance = $instance; | ||
$this->functionCall = $functionCall; | ||
$this->schema = $schema; | ||
$this->jsonSchema = $jsonSchema; | ||
} | ||
} |
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,34 @@ | ||
<?php | ||
|
||
namespace Cognesy\Instructor\Extras\Sequence; | ||
|
||
use Iterator; | ||
use IteratorAggregate; | ||
use Traversable; | ||
|
||
class Sequence implements Sequenceable, IteratorAggregate | ||
{ | ||
private string $class; | ||
private Iterator $iterator; | ||
|
||
public function __construct(string $class) { | ||
$this->class = $class; | ||
} | ||
|
||
public static function of(string $class) : Sequenceable { | ||
return new self($class); | ||
} | ||
|
||
public function getSequenceClass() : string { | ||
return $this->class; | ||
} | ||
|
||
public function getIterator(): Traversable | ||
{ | ||
return $this->iterator; | ||
} | ||
|
||
public function setIterator(Iterator $iterator) { | ||
$this->iterator = $iterator; | ||
} | ||
} |
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,8 @@ | ||
<?php | ||
|
||
namespace Cognesy\Instructor\Extras\Sequence; | ||
|
||
interface Sequenceable | ||
{ | ||
public static function of(string $class) : Sequenceable; | ||
} |
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
Oops, something went wrong.