Replies: 0 comments 1 reply
-
Hi Gilles! Thanks for the detailed plugin ideas. If I understand correctly, there are two ideas:
Am I correct? PHP Copilot InstanceGreat idea. Although I feel like it's less controlled compared to generated text in the Kirby Panel. If someone don't control your caching well, every time a page is generated, the cost to the client could increase unpredictably. This should be used carefully. But in the end, that's a choice the developer should make, not myself. I may add such a function in the future, but until then you can easily write a wrapper yourself with one of the many PHP clients, such as Open AI's PHP client. If you use GPT, you've already configured the token and can reuse it: function completeText(string $prompt) {
$apiKey = option('johannschopplich.copilot.providers.openai.apiKey');
$client = OpenAI::client($apiKey);
$response = $client->completions()->create([
'model' => 'gpt-4',
'prompt' => $prompt
]);
return $response->choices[0]->text;
} But this is just an example. A more sophisticated example would support a global More Context Options in the PanelShould not be that hard to implement. I will add this in the near future. 🙂 |
Beta Was this translation helpful? Give feedback.
-
Hi Johanne,
I'm thinking about using your plugin in my customer projects to see if it could be useful to them. There are some ideas I was thinking about:
I was wondering if it would be easy to obtain on the front (via a template or snippet) what you can do with your plugin in the Panel?
For example, code a form in a template to collect information on a public web page, use this information to build a prompt and transmit it to the AI model, then return the response in a variable to display it on the public page. It's like a AI Chabot but with specific form fields I would be able to guide the user in his/her request and build the prompt myself programmatically.
It would be also great to be able to transmit to the IA an URL from a JSON File and ask the IA to answer the prompt based on information coming from the JSON file transmitted. This way I could ask the IA to search information based on a prompt from the data of my own website or another website which has an API.
Don't know if it makes sense or if it's feasible ;-)
Thanks for your feedback
Gilles
Beta Was this translation helpful? Give feedback.
All reactions