PHP code example of yllw-digital / laravel-chatgpt-mock-api

1. Go to this page and download the library: Download yllw-digital/laravel-chatgpt-mock-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yllw-digital / laravel-chatgpt-mock-api example snippets


use YellowDigital\LaravelChatgptMockApi\Facades\ChatGPTMockApi;

Route::get("/mock-response", function() {
    return ChatGPTMockApi::generate(
        prompt: "European countries and their national food",
        keys: [
            "id",
            "name",
            "food",
            "food_description",
        ],
        count: 3,
    );
});

ChatGPTMockApi::generate(
    prompt: "European countries and their national food",
    keys: [
        "id",
        "name",
        "food",
        "food_description",
    ],
    count: 3,
    cache: false,
);

ChatGPTMockApi::generate(
    prompt: "European countries and their national food",
    keys: [
        "id",
        "name",
        "food",
        "food_description",
    ],
    count: 3,
    model: "gpt-3.5-turbo-0301",
);
bash
php artisan vendor:publish --provider="YellowDigital\LaravelChatgptMockApi\LaravelChatgptMockApiServiceProvider"
bash
php artisan migrate