Skip to content

Commit a3a0887

Browse files
committed
Moved schema code out of instructor repo into a separate one
1 parent 4f2950f commit a3a0887

File tree

249 files changed

+1611
-1634
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

249 files changed

+1611
-1634
lines changed

README.md.bak

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ use Cognesy\Instructor\StructuredOutput;
465465
$value = (new StructuredOutput)->with(
466466
messages: "His name is Jason, he is 28 years old.",
467467
responseModel: Scalar::integer('age'),
468-
)->getInt();
468+
)->create()->getInt();
469469

470470
var_dump($value);
471471
// int(28)
@@ -787,7 +787,7 @@ class Skill {
787787
You can use ValidationMixin trait to add ability of easy, custom data object validation.
788788

789789
```php
790-
use Cognesy\Instructor\Features\Validation\Traits\ValidationMixin;
790+
use Cognesy\Instructor\Validation\Traits\ValidationMixin;
791791

792792
class User {
793793
use ValidationMixin;
@@ -883,7 +883,7 @@ $structuredOutput = (new StructuredOutput)
883883
$structuredOutput->with(
884884
messages: "What is the population of Paris?",
885885
responseModel: Scalar::integer(),
886-
)->getInt();
886+
)->create()->getInt();
887887
// check your console for the details on the Instructor execution
888888
```
889889

bin/bootstrap.php.bak

Lines changed: 0 additions & 29 deletions
This file was deleted.

bin/instructor-setup

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env php
22
<?php
3-
namespace Cognesy\Setup;
4-
53
function findAutoload()
64
{
75
$dir = __DIR__;
@@ -21,11 +19,10 @@ function findAutoload()
2119

2220
require findAutoload();
2321

24-
use RuntimeException;
2522
use Symfony\Component\Console\Application;
2623

2724
$application = new Application('Instructor setup tool', '1.0.0');
28-
$application->add(new PublishCommand());
25+
$application->add(new Cognesy\Setup\PublishCommand());
2926
$application->run();
3027

3128
exit(0);

bin/publish-ver.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ echo "Using release notes from: $NOTES_FILE"
2727
# Define packages - must match those in sync-ver.sh
2828
declare -A PACKAGES
2929
PACKAGES["packages/utils"]="cognesy/instructor-utils"
30+
PACKAGES["packages/schema"]="cognesy/instructor-schema"
3031
PACKAGES["packages/http-client"]="cognesy/instructor-http-client"
3132
PACKAGES["packages/templates"]="cognesy/instructor-templates"
3233
PACKAGES["packages/polyglot"]="cognesy/instructor-polyglot"

bin/sync-ver.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ echo "Updating to version $VERSION (dependency constraint ^$MAJOR_MINOR)"
2121
# Define packages and their sections based on composer.json
2222
declare -A PACKAGES
2323
PACKAGES["packages/utils"]="cognesy/instructor-utils"
24+
PACKAGES["packages/schema"]="cognesy/instructor-schema"
2425
PACKAGES["packages/templates"]="cognesy/instructor-templates"
2526
#PACKAGES["packages/experimental"]="cognesy/instructor-experimental"
2627
PACKAGES["packages/http-client"]="cognesy/instructor-http-client"
@@ -36,6 +37,7 @@ PACKAGES["packages/auxiliary"]="cognesy/instructor-auxiliary"
3637
# Define which packages go in which section of the main composer.json
3738
declare -A MAIN_REQUIRE_PACKAGES
3839
MAIN_REQUIRE_PACKAGES["packages/addons"]="cognesy/instructor-addons"
40+
MAIN_REQUIRE_PACKAGES["packages/schema"]="cognesy/instructor-schema"
3941
MAIN_REQUIRE_PACKAGES["packages/http-client"]="cognesy/instructor-http-client"
4042
MAIN_REQUIRE_PACKAGES["packages/instructor"]="cognesy/instructor-struct"
4143
MAIN_REQUIRE_PACKAGES["packages/polyglot"]="cognesy/instructor-polyglot"

bin/tell

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env php
22
<?php
3-
namespace Cognesy\Tell;
4-
53
function findAutoload()
64
{
75
$dir = __DIR__;
@@ -24,7 +22,7 @@ require findAutoload();
2422
use Symfony\Component\Console\Application;
2523

2624
$application = new Application('Instructor Tell', '1.0.0');
27-
$application->add(new TellCommand());
25+
$application->add(new Cognesy\Tell\TellCommand());
2826
$application->setDefaultCommand('tell', true);
2927
$application->run();
3028

bin/test-publish.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ echo "Using release notes from: $NOTES_FILE"
3131
# Define packages - must match those in sync-ver.sh
3232
declare -A PACKAGES
3333
PACKAGES["packages/addons"]="cognesy/instructor-addons"
34+
PACKAGES["packages/schema"]="cognesy/instructor-schema"
3435
PACKAGES["packages/auxiliary"]="cognesy/instructor-auxiliary"
3536
PACKAGES["packages/evals"]="cognesy/instructor-evals"
3637
#PACKAGES["packages/experimental"]="cognesy/instructor-experimental"

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"autoload": {
2626
"psr-4": {
2727
"Cognesy\\Addons\\": "packages/addons/src/",
28+
"Cognesy\\Schema\\": "packages/schema/src/",
2829
"Cognesy\\Http\\": "packages/http-client/src/",
2930
"Cognesy\\Instructor\\": "packages/instructor/src/",
3031
"Cognesy\\Polyglot\\": "packages/polyglot/src/",
@@ -49,6 +50,7 @@
4950
"Cognesy\\InstructorHub\\Tests\\": "packages/hub/tests/",
5051
"Cognesy\\Instructor\\Tests\\": "packages/instructor/tests/",
5152
"Cognesy\\Polyglot\\Tests\\": "packages/polyglot/tests/",
53+
"Cognesy\\Schema\\Tests\\": "packages/schema/tests/",
5254
"Cognesy\\Setup\\Tests\\": "packages/setup/tests/",
5355
"Cognesy\\Tell\\Tests\\": "packages/tell/tests/",
5456
"Cognesy\\Templates\\Tests\\": "packages/templates/tests/",

config/structured.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,16 @@
1010
// should Instructor use object references or quote objects
1111
'useObjectReferences' => false,
1212

13+
// default schema name
14+
'defaultSchemaName' => 'default_schema',
15+
1316
// default tool name and description
1417
'defaultToolName' => 'extracted_data',
1518
'defaultToolDescription' => 'Function call based on user instructions.',
1619

20+
// default output class
21+
'defaultOutputClass' => 'Cognesy\Instructor\Extras\Structure\Structure',
22+
1723
// default prompts
1824
'defaultRetryPrompt' => "JSON generated incorrectly, fix following errors:\n",
1925
'defaultJsonPrompt' => "Response must follow JSON Schema:\n<|json_schema|>\n. Respond correctly with strict JSON object.\n",
@@ -26,10 +32,9 @@
2632
// potentially cached - predefined sections used to construct the script
2733
'system',
2834
'pre-cached',
29-
'pre-cached-prompt', 'cached-prompt', 'post-cached-prompt',
30-
'pre-cached-examples', 'cached-examples', 'post-cached-examples',
31-
'pre-cached-input', 'cached-input', 'post-cached-input',
32-
'cached-messages',
35+
'pre-cached-prompt', 'cached-prompt', 'post-cached-prompt',
36+
'pre-cached-examples', 'cached-examples', 'post-cached-examples',
37+
'cached-messages',
3338
'post-cached',
3439
// never cached
3540
'pre-prompt', 'prompt', 'post-prompt',

evals/SimpleExtraction/Company.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Evals\SimpleExtraction;
44

5-
use Cognesy\Instructor\Features\Schema\Attributes\Description;
5+
use Cognesy\Schema\Attributes\Description;
66

77
class Company {
88
#[Description("The name of the company")]

0 commit comments

Comments
 (0)