Download the PHP package timkley/denk without Composer
On this page you can find all versions of the php package timkley/denk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package denk
Denk – a small helper package to work with the OpenAI API
The package name is derived from the German word "denken" which means "to think".
Installation
How to use
Make sure that you have an OpenAI API key. You can get one here.
Initialization
Using Laravel
The package comes with a service provider that will automatically register the OpenAI client. You can use the Denk facade to access the service.
Make sure to publish the configuration file to set your API key and/or change the API url.
After that, you can use the Denk facade to access the service like this:
Manually or non-Laravel projects
To initialize the service, you need create an OpenAI client and pass it to the DenkService.
Generating text
Available models
gpt-4o-mini(default)gpt-4ogpt-4-turbogpt-4gpt-3.5-turbo
Temperature
You can control the randomness of the response by setting the temperature:
Generating JSON
To generate Structured Output, you can use the json() method. Set the properties of the JSON object and provide a prompt, additionally you may also set a system prompt.
Available models
gpt-4o-mini(default)gpt-4o
Temperature
You can control the randomness of the response by setting the temperature:
Generating Images
To generate images, you can use the image() method. Set the properties of the image and provide a prompt.
Available image sizes
1024x1024(square)1792x1024(landscape)1024x1792(portrait)
Or use the convenience aliases:
squarelandscapeportrait
Available image qualities
standardhd
Available image models
dall-e-3(default)dall-e-2
All versions of denk with dependencies
illuminate/collections Version ^11.34|^12.0
illuminate/http Version ^11.34|^12.0
illuminate/support Version ^11.34|^12.0
openai-php/client Version ^0.16.1
symfony/http-client Version ^7.4.4
vlucas/phpdotenv Version ^5.6.3