Skip to content

Commit

Permalink
Docs update
Browse files Browse the repository at this point in the history
  • Loading branch information
ddebowczyk committed Oct 5, 2024
1 parent 8448f19 commit ed5432b
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 72 deletions.
57 changes: 0 additions & 57 deletions docs/advanced/modules.mdx

This file was deleted.

2 changes: 1 addition & 1 deletion docs/cookbook/examples/advanced/custom_client.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ $driver = new OpenAIDriver(new LLMConfig(
apiKey: Env::get('OPENAI_API_KEY'),
endpoint: '/chat/completions',
metadata: ['organization' => ''],
model: 'gpt-4o-mini',
model: 'gpt-3.5-turbo',
maxTokens: 128,
)
);
Expand Down
12 changes: 7 additions & 5 deletions docs/cookbook/examples/advanced/partials.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ $text = <<<TEXT
San Francisco. He likes to play soccer and climb mountains.
TEXT;

$user = (new Instructor)->request(
messages: $text,
responseModel: UserDetail::class,
options: ['stream' => true]
)->onPartialUpdate(partialUpdate(...))->get();
$user = (new Instructor)
->onPartialUpdate(partialUpdate(...))
->request(
messages: $text,
responseModel: UserDetail::class,
options: ['stream' => true]
)->get();

echo "All tokens received, fully completed object available in `\$user` variable.\n";
echo '$user = '."\n";
Expand Down
2 changes: 1 addition & 1 deletion docs/cookbook/examples/advanced/sequences.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ print("INPUT:\n$text\n\n");

print("OUTPUT:\n");
$list = (new Instructor)
->onSequenceUpdate(fn($sequence) => dump($sequence->last()))
->request(
messages: $text,
responseModel: Sequence::of(Person::class),
options: ['stream' => true],
)
->onSequenceUpdate(fn($sequence) => dump($sequence->last()))
->get();


Expand Down
2 changes: 1 addition & 1 deletion docs/cookbook/examples/basics/basic_use.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ print($text . "\n\n");

// Step 3: Extract structured data using default language model API (OpenAI)
print("Extracting structured data using LLM...\n\n");
$user = (new Instructor)->withDebug(true)->respond(
$user = (new Instructor)->respond(
messages: $text,
responseModel: User::class,
);
Expand Down
2 changes: 1 addition & 1 deletion docs/cookbook/examples/basics/validation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ try {
$user = (new Instructor)->request(
messages: [['role' => 'user', 'content' => "you can reply to me via mail -- Jason"]],
responseModel: UserDetails::class,
})->get();
)->get();
} catch(Exception $e) {
$caughtException = true;
}
Expand Down
4 changes: 2 additions & 2 deletions docs/cookbook/examples/troubleshooting/on_event.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ $logger = new class {
};

$user = (new Instructor)
->onEvent(RequestSentToLLM::class, fn($event) => $logger->log($event))
->onEvent(ResponseReceivedFromLLM::class, fn($event) => $logger->log($event))
->request(
messages: "Jason is 28 years old",
responseModel: User::class,
)
->onEvent(RequestSentToLLM::class, fn($event) => $logger->log($event))
->onEvent(ResponseReceivedFromLLM::class, fn($event) => $logger->log($event))
->get();

dump($user);
Expand Down
2 changes: 1 addition & 1 deletion docs/cookbook/examples/troubleshooting/wiretap.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ class UserDetail
}

$user = (new Instructor)
->wiretap(fn($event) => $event->print())
->request(
messages: [["role" => "user", "content" => "Contact our CTO, Jason is 28 years old -- Best regards, Tom"]],
responseModel: UserDetail::class,
options: ['stream' => true]
)
->wiretap(fn($event) => $event->print())
->get();

dump($user);
Expand Down
4 changes: 1 addition & 3 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@
"advanced/partials",
"advanced/sequences",
"advanced/structures",
"advanced/function_calls",
"advanced/modules"
"advanced/function_calls"
]
},
{
Expand Down Expand Up @@ -162,7 +161,6 @@
"group": "Troubleshooting",
"pages": [
"cookbook/examples/troubleshooting/debugging",
"cookbook/examples/troubleshooting/on_error",
"cookbook/examples/troubleshooting/on_event",
"cookbook/examples/troubleshooting/token_usage_events",
"cookbook/examples/troubleshooting/wiretap"
Expand Down

0 comments on commit ed5432b

Please sign in to comment.