Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php declare(strict_types=1); namespace App\Services\LLM; use App\Models\Config; use O..

Decoded Output download

<?php

declare(strict_types=1);

namespace App\Services\LLM;

use App\Models\Config;
use OpenAI as OpenAISDK;

final class OpenAI extends Base
{
    public function textPrompt(string $q): string
    {
        if (Config::obtain('openai_api_key') === '') {
            return 'OpenAI API key not set';
        }

        $client = OpenAISDK::client(Config::obtain('openai_api_key'));

        $response = $client->chat()->create([
            'model' => Config::obtain('openai_model_id'),
            'temperature' => 1,
            'messages' => [
                [
                    'role' => 'system',
                    'content' => 'You are a helpful assistant.',
                ],
                [
                    'role' => 'user',
                    'content' => $q,
                ],
            ],
        ]);

        return $response->choices[0]->message->content;
    }

    public function textPromptWithContext(string $q, array $context): string
    {
        return '';
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

namespace App\Services\LLM;

use App\Models\Config;
use OpenAI as OpenAISDK;

final class OpenAI extends Base
{
    public function textPrompt(string $q): string
    {
        if (Config::obtain('openai_api_key') === '') {
            return 'OpenAI API key not set';
        }

        $client = OpenAISDK::client(Config::obtain('openai_api_key'));

        $response = $client->chat()->create([
            'model' => Config::obtain('openai_model_id'),
            'temperature' => 1,
            'messages' => [
                [
                    'role' => 'system',
                    'content' => 'You are a helpful assistant.',
                ],
                [
                    'role' => 'user',
                    'content' => $q,
                ],
            ],
        ]);

        return $response->choices[0]->message->content;
    }

    public function textPromptWithContext(string $q, array $context): string
    {
        return '';
    }
}

Function Calls

None

Variables

None

Stats

MD5 48c06b4659364f0ea07d359dec9d23aa
Eval Count 0
Decode Time 151 ms