-
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
433b520
commit ccabc47
Showing
6 changed files
with
49 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,19 +55,19 @@ $instructor = (new Instructor)->withClient($client); | |
|
||
$user = $instructor | ||
->respond( | ||
messages: "Jason (@jxnlco) is 25 years old and is the admin of this project. He likes playing football and reading books.", | ||
messages: "Jason (@jxnlco) is 25 years old. He is the admin of this project. He likes playing football and reading books.", | ||
responseModel: User::class, | ||
prompt: 'Parse the user data to JSON, respond using following JSON Schema: <|json_schema|>', | ||
examples: [[ | ||
'input' => 'Ive got email Frank - their developer, who\'s 30. He asked to come back to him [email protected]. Btw, he plays on drums!', | ||
'output' => ['age' => 30, 'name' => 'Frank', 'username' => '[email protected]', 'role' => 'developer', 'hobbies' => ['playing drums'],], | ||
'output' => ['age' => 30, 'name' => 'Frank', 'username' => '[email protected]', 'role' => 'user', 'hobbies' => ['playing drums'],], | ||
],[ | ||
'input' => 'We have a meeting with John, our new user. He is 30 years old - check his profile: @jx90.', | ||
'output' => ['name' => 'John', 'role' => 'admin', 'hobbies' => [], 'username' => 'jx90', 'age' => 30], | ||
'input' => 'We have a meeting with John, our new admin who likes surfing. He is 19 years old - check his profile: @jx90.', | ||
'output' => ['name' => 'John', 'role' => 'admin', 'hobbies' => ['surfing'], 'username' => 'jx90', 'age' => 19], | ||
]], | ||
model: 'gemma2-9b-it', | ||
maxRetries: 2, | ||
options: ['temperature' => 0], | ||
options: ['temperature' => 0.5], | ||
mode: Mode::Json, | ||
); | ||
|
||
|
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 |
---|---|---|
|
@@ -53,19 +53,20 @@ $client = new OpenRouterClient( | |
/// Get Instructor with the default client component overridden with your own | ||
$instructor = (new Instructor)->withClient($client); | ||
|
||
$user = $instructor->respond( | ||
messages: "Jason (@jxnlco) is 25 years old and is the admin of this project. He likes playing football and reading books.", | ||
responseModel: User::class, | ||
examples: [[ | ||
'input' => 'Ive got email Frank - their developer, who\'s 30. He asked to come back to him [email protected]. Btw, he plays on drums!', | ||
'output' => ['age' => 30, 'name' => 'Frank', 'username' => '[email protected]', 'role' => 'developer', 'hobbies' => ['playing drums'],], | ||
],[ | ||
'input' => 'We have a meeting with John, our new user. He is 30 years old - check his profile: @jx90.', | ||
'output' => ['name' => 'John', 'role' => 'admin', 'hobbies' => [], 'username' => 'jx90', 'age' => 30], | ||
]], | ||
model: 'google/gemma-2-9b-it:free', | ||
$user = $instructor->withDebug()->respond( | ||
messages: "Jason (@jxnlco) is 25 years old. He is the admin of this project. He likes playing football and reading books.", | ||
responseModel: User::class, | ||
prompt: 'Parse the user data to JSON, respond using following JSON Schema: <|json_schema|>', | ||
examples: [[ | ||
'input' => 'Ive got email Frank - their developer, who\'s 30. He asked to come back to him [email protected]. Btw, he plays on drums!', | ||
'output' => ['age' => 30, 'name' => 'Frank', 'username' => '[email protected]', 'role' => 'user', 'hobbies' => ['playing drums'],], | ||
],[ | ||
'input' => 'We have a meeting with John, our new admin who likes surfing. He is 19 years old - check his profile: @jig.', | ||
'output' => ['age' => 19, 'name' => 'John', 'username' => 'jig', 'role' => 'admin', 'hobbies' => ['surfing'],], | ||
]], | ||
model: 'microsoft/phi-3.5-mini-128k-instruct', | ||
//options: ['stream' => true ] | ||
mode: Mode::Tools, | ||
mode: Mode::Json, | ||
); | ||
|
||
print("Completed response model:\n\n"); | ||
|
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