-
Notifications
You must be signed in to change notification settings - Fork 9
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
1db39a3
commit f64bb0e
Showing
20 changed files
with
285 additions
and
44 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
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
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,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpLlm\LlmChain\Chain; | ||
|
||
use PhpLlm\LlmChain\LanguageModel; | ||
use PhpLlm\LlmChain\Message\MessageBag; | ||
|
||
final class Input | ||
{ | ||
/** | ||
* @param array<string, mixed> $options | ||
*/ | ||
public function __construct( | ||
public readonly LanguageModel $llm, | ||
public readonly MessageBag $messages, | ||
private array $options, | ||
) { | ||
} | ||
|
||
/** | ||
* @return array<string, mixed> | ||
*/ | ||
public function getOptions(): array | ||
{ | ||
return $this->options; | ||
} | ||
|
||
/** | ||
* @param array<string, mixed> $options | ||
*/ | ||
public function setOptions(array $options): void | ||
{ | ||
$this->options = $options; | ||
} | ||
} |
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 | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpLlm\LlmChain\Chain; | ||
|
||
interface InputProcessor | ||
{ | ||
public function processInput(Input $input): 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpLlm\LlmChain\Chain; | ||
|
||
use PhpLlm\LlmChain\LanguageModel; | ||
use PhpLlm\LlmChain\Message\MessageBag; | ||
use PhpLlm\LlmChain\Response\Response; | ||
|
||
final readonly class Output | ||
{ | ||
/** | ||
* @param array<string, mixed> $options | ||
*/ | ||
public function __construct( | ||
public LanguageModel $llm, | ||
public Response $response, | ||
public MessageBag $messages, | ||
public array $options, | ||
) { | ||
} | ||
} |
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 | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpLlm\LlmChain\Chain; | ||
|
||
interface OutputProcessor | ||
{ | ||
public function processOutput(Output $output): mixed; | ||
} |
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,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpLlm\LlmChain\Exception; | ||
|
||
final class MissingModelSupport extends \RuntimeException | ||
{ | ||
private function __construct(string $model, string $support) | ||
{ | ||
parent::__construct(sprintf('Model "%s" does not support "%s".', $model, $support)); | ||
} | ||
|
||
public static function forToolCalling(string $model): self | ||
{ | ||
return new self($model, 'tool calling'); | ||
} | ||
|
||
public static function forImageInput(string $model): self | ||
{ | ||
return new self($model, 'image input'); | ||
} | ||
|
||
public static function forStructuredOutput(string $model): self | ||
{ | ||
return new self($model, 'structured output'); | ||
} | ||
} |
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
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.