File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ REPLICATE_API_KEY=
1717
1818# For using Ollama
1919OLLAMA_HOST_URL =
20+ OLLAMA_MODEL =
2021
2122# For using GPT on Azure
2223AZURE_OPENAI_BASEURL =
Original file line number Diff line number Diff line change 66 "require" : {
77 "php" : " >=8.2" ,
88 "ext-pdo" : " *" ,
9- "async-aws/bedrock-runtime" : " ^1.1" ,
109 "codewithkyrian/chromadb-php" : " ^0.4.0" ,
1110 "codewithkyrian/transformers" : " ^0.6.1" ,
1211 "doctrine/dbal" : " ^3.3 || ^4.0" ,
1312 "google/auth" : " ^1.47" ,
14- "mongodb/mongodb" : " ^2.1" ,
1513 "mrmysql/youtube-transcript" : " ^0.0.5" ,
1614 "php-http/discovery" : " ^1.20" ,
1715 "probots-io/pinecone-php" : " ^1.0" ,
Original file line number Diff line number Diff line change 1818require_once dirname (__DIR__ ).'/bootstrap.php ' ;
1919
2020$ platform = PlatformFactory::create (env ('OLLAMA_HOST_URL ' ), http_client ());
21- $ model = new Ollama ();
21+ $ ollamaModel = !empty ($ _SERVER ['OLLAMA_MODEL ' ]) ? $ _SERVER ['OLLAMA_MODEL ' ] : '' ;
22+ $ model = new Ollama ($ ollamaModel );
2223
2324$ agent = new Agent ($ platform , $ model , logger: logger ());
2425$ messages = new MessageBag (
2526 Message::forSystem ('You are a helpful assistant. ' ),
2627 Message::ofUser ('Tina has one brother and one sister. How many sisters do Tina \'s siblings have? ' ),
2728);
28- $ result = $ agent ->call ($ messages );
2929
30- echo $ result ->getContent ().\PHP_EOL ;
30+ try {
31+ $ result = $ agent ->call ($ messages );
32+ $ response = $ result ->getContent ().\PHP_EOL ;
33+ } catch (InvalidArgumentException $ e ) {
34+ $ response = $ e ->getMessage () . "\nMaybe use a different model? \n" ;
35+ }
36+
37+ echo $ response ;
You can’t perform that action at this time.
0 commit comments