Download the PHP package angelxmoreno/prompt-classes without Composer
On this page you can find all versions of the php package angelxmoreno/prompt-classes. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package prompt-classes
PromptClasses
ChatGpt reusable objects
Installation
Getting started
First thing you will need to get started is an OpenAI api key.
Getting an OpenAI Api Key
To get started, visit the official OpenAI platform website. If you're new, create an account using simple steps. Next, sign in using your OpenAI account email and password, or use your Google/Microsoft account. Once logged in, you'll find your name and profile icon on the top-right corner of the OpenAI platform homepage. To obtain an API Key, click on your name in the top-right corner for a dropdown menu, and select "View API keys." On the resulting page, find the "Create new secret key" option in the center. If you don't have an API key, click this button to generate one. Remember to save the API key immediately, as you won't be able to retrieve it once the window closes.
Simple Hello Prompt
-
Create a PromptClass
- Instantiate and send
The order of params is the order of the
$promptParamsarray. This means that if you change the
$promptParamsfor the
HelloPromptclass to
['time_of_day','name'];, you would have to call
->send()` like so:
SEO Meta DescriptionPrompt
-
Create a PromptClass
- Instantiate and send `
Configuration
Under the hood the library uses orhanerday/open-ai. The default configuration for the calls to OpenAI Chat Completions are:
Name | Current Value | Info |
---|---|---|
model | gpt-3.5-turbo | ID of the model to use. See Model overview for descriptions of them. |
temperature | 1 | What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. |
To discover more options available take a look at the official documentation for the chat completions endpoint.
Values can be updated for your PromptClass by extending the $openaiParams
property of the AbstractPrompt
class like so:
Requirements
PHP 7.4+
Support
For bugs and feature requests, please use the issues section of this repository.
License
Licensed under the MIT License. Redistributions of the source code included in this repository must retain the copyright notice found in each file.
All versions of prompt-classes with dependencies
ext-json Version *
orhanerday/open-ai Version ^4.7
cakephp/utility Version ^4.4