Skip to content

Commit 594ace0

Browse files
committed
Release version 0.17.0
1 parent ab8ee92 commit 594ace0

File tree

180 files changed

+932
-639
lines changed

Some content is hidden

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

180 files changed

+932
-639
lines changed

.github/workflows/split.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,39 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
package:
19-
- local: 'packages/addons'
20-
repo: 'cognesy/instructor-addons'
21-
name: 'instructor-addons'
19+
- local: 'packages/utils'
20+
repo: 'cognesy/instructor-utils'
21+
name: 'instructor-utils'
22+
- local: 'packages/setup'
23+
repo: 'cognesy/instructor-setup'
24+
name: 'instructor-setup'
2225
- local: 'packages/auxiliary'
2326
repo: 'cognesy/instructor-aux'
2427
name: 'instructor-aux'
25-
- local: 'packages/evals'
26-
repo: 'cognesy/instructor-evals'
27-
name: 'instructor-evals'
28+
- local: 'packages/templates'
29+
repo: 'cognesy/instructor-templates'
30+
name: 'instructor-templates'
2831
- local: 'packages/http-client'
2932
repo: 'cognesy/instructor-http-client'
3033
name: 'instructor-http-client'
31-
- local: 'packages/hub'
32-
repo: 'cognesy/instructor-hub'
33-
name: 'instructor-hub'
34-
- local: 'packages/instructor'
35-
repo: 'cognesy/instructor-struct'
36-
name: 'instructor-struct'
3734
- local: 'packages/polyglot'
3835
repo: 'cognesy/instructor-polyglot'
3936
name: 'instructor-polyglot'
40-
- local: 'packages/setup'
41-
repo: 'cognesy/instructor-setup'
42-
name: 'instructor-setup'
4337
- local: 'packages/tell'
4438
repo: 'cognesy/instructor-tell'
4539
name: 'instructor-tell'
46-
- local: 'packages/templates'
47-
repo: 'cognesy/instructor-templates'
48-
name: 'instructor-templates'
49-
- local: 'packages/utils'
50-
repo: 'cognesy/instructor-utils'
51-
name: 'instructor-utils'
40+
- local: 'packages/instructor'
41+
repo: 'cognesy/instructor-struct'
42+
name: 'instructor-struct'
43+
- local: 'packages/evals'
44+
repo: 'cognesy/instructor-evals'
45+
name: 'instructor-evals'
46+
- local: 'packages/hub'
47+
repo: 'cognesy/instructor-hub'
48+
name: 'instructor-hub'
49+
- local: 'packages/addons'
50+
repo: 'cognesy/instructor-addons'
51+
name: 'instructor-addons'
5252

5353
steps:
5454
- uses: actions/checkout@v4

bin/sync-ver.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ echo "Updating to version $VERSION (dependency constraint ^$MAJOR_MINOR)"
2020

2121
# Define packages and their sections based on composer.json
2222
declare -A PACKAGES
23-
PACKAGES["packages/addons"]="cognesy/instructor-addons"
24-
PACKAGES["packages/auxiliary"]="cognesy/instructor-auxiliary"
25-
PACKAGES["packages/evals"]="cognesy/instructor-evals"
23+
PACKAGES["packages/utils"]="cognesy/instructor-utils"
24+
PACKAGES["packages/templates"]="cognesy/instructor-templates"
2625
#PACKAGES["packages/experimental"]="cognesy/instructor-experimental"
2726
PACKAGES["packages/http-client"]="cognesy/instructor-http-client"
28-
PACKAGES["packages/hub"]="cognesy/instructor-hub"
29-
PACKAGES["packages/instructor"]="cognesy/instructor-struct"
3027
PACKAGES["packages/polyglot"]="cognesy/instructor-polyglot"
3128
PACKAGES["packages/setup"]="cognesy/instructor-setup"
29+
PACKAGES["packages/instructor"]="cognesy/instructor-struct"
3230
PACKAGES["packages/tell"]="cognesy/instructor-tell"
33-
PACKAGES["packages/templates"]="cognesy/instructor-templates"
34-
PACKAGES["packages/utils"]="cognesy/instructor-utils"
31+
PACKAGES["packages/evals"]="cognesy/instructor-evals"
32+
PACKAGES["packages/hub"]="cognesy/instructor-hub"
33+
PACKAGES["packages/addons"]="cognesy/instructor-addons"
34+
PACKAGES["packages/auxiliary"]="cognesy/instructor-auxiliary"
3535

3636
# Define which packages go in which section of the main composer.json
3737
declare -A MAIN_REQUIRE_PACKAGES

config/llm.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
'apiUrl' => 'https://api.fireworks.ai/inference/v1',
110110
'apiKey' => Env::get('FIREWORKS_API_KEY', ''),
111111
'endpoint' => '/chat/completions',
112-
'defaultModel' => 'accounts/fireworks/models/mixtral-8x7b-instruct',
112+
'defaultModel' => 'accounts/fireworks/models/llama4-maverick-instruct-basic',
113113
'defaultMaxTokens' => 1024,
114114
'contextLength' => 65_000,
115115
'maxOutputLength' => 4096,
@@ -166,10 +166,10 @@
166166
],
167167
'moonshot-kimi' => [
168168
'providerType' => LLMProviderType::Moonshot->value,
169-
'apiUrl' => 'https://api.moonshot.ai/v1',
169+
'apiUrl' => 'https://api.moonshot.cn/v1',
170170
'apiKey' => Env::get('MOONSHOT_API_KEY', ''),
171171
'endpoint' => '/chat/completions',
172-
'defaultModel' => 'kimi-k1.5-preview',
172+
'defaultModel' => 'kimi-latest',
173173
'defaultMaxTokens' => 1024,
174174
'contextLength' => 128_000,
175175
'maxOutputLength' => 4096,
@@ -179,7 +179,7 @@
179179
'apiUrl' => 'http://localhost:11434/v1',
180180
'apiKey' => Env::get('OLLAMA_API_KEY', ''),
181181
'endpoint' => '/chat/completions',
182-
'defaultModel' => 'qwen2.5-coder:3b', //'gemma2:2b',
182+
'defaultModel' => 'gemma3:1b', // 'qwen2.5-coder:3b', //'gemma2:2b',
183183
'defaultMaxTokens' => 1024,
184184
'httpClient' => 'http-ollama',
185185
'contextLength' => 128_000,
@@ -214,7 +214,7 @@
214214
'apiUrl' => 'https://api.perplexity.ai',
215215
'apiKey' => Env::get('PERPLEXITY_API_KEY', ''),
216216
'endpoint' => '/chat/completions',
217-
'defaultModel' => 'llama-3.1-sonar-small-128k-online',
217+
'defaultModel' => 'sonar',
218218
'defaultMaxTokens' => 1024,
219219
'contextLength' => 128_000,
220220
'maxOutputLength' => 2048,
@@ -234,7 +234,7 @@
234234
'apiUrl' => 'https://api.together.xyz/v1',
235235
'apiKey' => Env::get('TOGETHER_API_KEY', ''),
236236
'endpoint' => '/chat/completions',
237-
'defaultModel' => 'mistralai/Mixtral-8x7B-Instruct-v0.1',
237+
'defaultModel' => 'meta-llama/Llama-3.3-70B-Instruct-Turbo',
238238
'defaultMaxTokens' => 1024,
239239
'contextLength' => 128_000,
240240
'maxOutputLength' => 4096,
@@ -244,7 +244,7 @@
244244
'apiUrl' => 'https://api.x.ai/v1',
245245
'apiKey' => Env::get('XAI_API_KEY', ''),
246246
'endpoint' => '/chat/completions',
247-
'defaultModel' => '-1212',
247+
'defaultModel' => 'grok-3',
248248
'defaultMaxTokens' => 1024,
249249
'contextLength' => 128_000,
250250
'maxOutputLength' => 128_000,

docs-build/cookbook/instructor/advanced/context_cache_structured.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ require 'examples/boot.php';
3232

3333
use Cognesy\Instructor\Features\Schema\Attributes\Description;
3434
use Cognesy\Instructor\Instructor;
35-
use Cognesy\Polyglot\LLM\Enums\Mode;
35+
use Cognesy\Polyglot\LLM\Enums\OutputMode;
3636
use Cognesy\Utils\Str;
3737

3838
class Project {
@@ -80,7 +80,7 @@ $project = $cached->respond(
8080
messages: 'Describe the project in a way compelling to my audience: P&C insurance CIOs.',
8181
responseModel: Project::class,
8282
options: ['max_tokens' => 4096],
83-
mode: Mode::MdJson,
83+
mode: OutputMode::MdJson,
8484
);
8585
dump($project);
8686
assert($project instanceof Project);
@@ -99,7 +99,7 @@ $project = $cached->respond(
9999
messages: "Describe the project in a way compelling to my audience: boutique CMS consulting company owner.",
100100
responseModel: Project::class,
101101
options: ['max_tokens' => 4096],
102-
mode: Mode::Json,
102+
mode: OutputMode::Json,
103103
);
104104
dump($project);
105105
assert($project instanceof Project);

docs-build/cookbook/instructor/advanced/custom_llm.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require 'examples/boot.php';
1818
use Cognesy\Instructor\Instructor;
1919
use Cognesy\Polyglot\LLM\Data\LLMConfig;
2020
use Cognesy\Polyglot\LLM\Enums\LLMProviderType;
21-
use Cognesy\Polyglot\LLM\Enums\Mode;
21+
use Cognesy\Polyglot\LLM\Enums\OutputMode;
2222
use Cognesy\Utils\Env;
2323

2424
class User {
@@ -44,7 +44,7 @@ $instructor = (new Instructor)->withLLMConfig($config);
4444
$user = $instructor->respond(
4545
messages: "Our user Jason is 25 years old.",
4646
responseModel: User::class,
47-
mode: Mode::Tools,
47+
mode: OutputMode::Tools,
4848
);
4949

5050

docs-build/cookbook/instructor/advanced/custom_prompts.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ require 'examples/boot.php';
2020

2121
use Cognesy\Http\Events\HttpRequestSent;
2222
use Cognesy\Instructor\Instructor;
23-
use Cognesy\Polyglot\LLM\Enums\Mode;
23+
use Cognesy\Polyglot\LLM\Enums\OutputMode;
2424

2525
class User {
2626
public int $age;
@@ -37,7 +37,7 @@ $user = $instructor
3737
messages: "Our user Jason is 25 years old.",
3838
responseModel: User::class,
3939
prompt: "\nYour task is to extract correct and accurate data from the messages using provided tools.\n",
40-
mode: Mode::Tools
40+
mode: OutputMode::Tools
4141
);
4242
echo "\nRESPONSE:\n";
4343
dump($user);
@@ -48,7 +48,7 @@ $user = $instructor
4848
messages: "Our user Jason is 25 years old.",
4949
responseModel: User::class,
5050
prompt: "\nYour task is to respond correctly with JSON object. Response must follow JSONSchema:\n<|json_schema|>\n",
51-
mode: Mode::Json
51+
mode: OutputMode::Json
5252
);
5353
echo "\nRESPONSE:\n";
5454
dump($user);
@@ -59,7 +59,7 @@ $user = $instructor
5959
messages: "Our user Jason is 25 years old.",
6060
responseModel: User::class,
6161
prompt: "\nYour task is to respond correctly with strict JSON object containing extracted data within a ```json {} ``` codeblock. Object must validate against this JSONSchema:\n<|json_schema|>\n",
62-
mode: Mode::MdJson
62+
mode: OutputMode::MdJson
6363
);
6464
echo "\nRESPONSE:\n";
6565
dump($user);

docs-build/cookbook/instructor/advanced/demonstrations.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ require 'examples/boot.php';
2121
use Cognesy\Http\Events\HttpRequestSent;
2222
use Cognesy\Instructor\Features\Core\Data\Example;
2323
use Cognesy\Instructor\Instructor;
24-
use Cognesy\Polyglot\LLM\Enums\Mode;
24+
use Cognesy\Polyglot\LLM\Enums\OutputMode;
2525

2626
class User {
2727
public int $age;
@@ -46,7 +46,7 @@ $user = (new Instructor)
4646
template: "example input:\n<|input|>\noutput:\n```json\n<|output|>\n```\n",
4747
),
4848
],
49-
mode: Mode::Json)
49+
mode: OutputMode::Json)
5050
->get();
5151

5252
echo "\nOUTPUT:\n";

docs-build/cookbook/instructor/advanced/partials.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ response is received.
1818
require 'examples/boot.php';
1919

2020
use Cognesy\Instructor\Instructor;
21-
use Cognesy\Polyglot\LLM\Enums\Mode;
21+
use Cognesy\Polyglot\LLM\Enums\OutputMode;
2222
use Cognesy\Utils\Cli\Console;
2323

2424
class UserRole
@@ -72,7 +72,7 @@ $user = (new Instructor)
7272
messages: $text,
7373
responseModel: UserDetail::class,
7474
options: ['stream' => true],
75-
mode: Mode::Json,
75+
mode: OutputMode::Json,
7676
)->get();
7777

7878
echo "All tokens received, fully completed object available in `\$user` variable.\n";

docs-build/cookbook/instructor/advanced/streaming.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ generated.
1616
require 'examples/boot.php';
1717

1818
use Cognesy\Instructor\Instructor;
19-
use Cognesy\Polyglot\LLM\Enums\Mode;
19+
use Cognesy\Polyglot\LLM\Enums\OutputMode;
2020
use Cognesy\Utils\Cli\Console;
2121

2222
class UserRole
@@ -67,7 +67,7 @@ $stream = (new Instructor)->withConnection('openai')->request(
6767
messages: $text,
6868
responseModel: UserDetail::class,
6969
options: ['stream' => true],
70-
mode: Mode::Json,
70+
mode: OutputMode::Json,
7171
)->stream();
7272

7373
foreach ($stream->partials() as $partial) {

docs-build/cookbook/instructor/api_support/a21.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Mode compatibility:
2121
require 'examples/boot.php';
2222

2323
use Cognesy\Instructor\Instructor;
24-
use Cognesy\Polyglot\LLM\Enums\Mode;
24+
use Cognesy\Polyglot\LLM\Enums\OutputMode;
2525

2626
enum UserType : string {
2727
case Guest = 'guest';
@@ -46,7 +46,7 @@ $user = $instructor->respond(
4646
messages: "Jason (@jxnlco) is 25 years old and is the admin of this project. He likes playing football and reading books.",
4747
responseModel: User::class,
4848
model: 'jamba-1.5-mini', // set your own value/source
49-
mode: Mode::Json,
49+
mode: OutputMode::Json,
5050
examples: [[
5151
'input' => 'Ive got email Frank - their developer, who\'s 30. His Twitter handle is @frankch. Btw, he plays on drums!',
5252
'output' => ['age' => 30, 'name' => 'Frank', 'username' => '@frankch', 'role' => 'developer', 'hobbies' => ['playing drums'],],

0 commit comments

Comments
 (0)