Trying to use PHP SDK to read a sound file from GCS and then process it using Gemini Pro 2.5. SDK loaded and working. Keep getting an error: Class “Google\Cloud\AIPlatform\V1\GenerateContentConfig” not found
require '../vendor/autoload.php';
use Google\Cloud\AIPlatform\V1\Client\PredictionServiceClient;
use Google\Cloud\AIPlatform\V1\GenerateContentConfig;
use Google\Cloud\AIPlatform\V1\GenerateContentRequest;
use Google\Cloud\AIPlatform\V1\Content;
use Google\Cloud\AIPlatform\V1\Part;
use Google\Cloud\AIPlatform\V1\FileData;
// use Google\Cloud\AIPlatform\V1\GenerationConfig;
use Google\Cloud\AIPlatform\V1\SafetySetting;
use Google\Cloud\AIPlatform\V1\SafetySetting\HarmCategory;
use Google\Cloud\AIPlatform\V1\SafetySetting\HarmBlockThreshold;
use Google\Cloud\AIPlatform\V1\Tool;
use Google\Cloud\AIPlatform\V1\Type\HarmCategory as HarmCategoryAlias;
...
// 4. Prepare the Request
// $formattedResourceName = $predictionServiceClient->modelServicePath($projectId, $location, $modelName);
$formattedResourceName = "projects/{$projectId}/locations/{$location}/publishers/google/models/{$modelName}";
// Optional: Set generation configuration (e.g., temperature)
$config = new GenerateContentConfig([
'temperature' => 0.2,
'max_output_tokens' => 1048,
]);
$request = new GenerateContentRequest([
'model' => $formattedResourceName,
'contents' => [$content],
'config' => $config,
]);
// 5. Execute the Prediction Call
echo "Sending request to Gemini 2.5 Pro...\n";
try {
$response = $predictionServiceClient->generateContent($request);
etc
The error occurs on the line $config = new GenerateContentConfig([
I’ve deleted all the files, reinstalled the SDK’s etc. Gemini AI help is also unable to assist.