serverStreamingPredict doesn't accept request object properly

I'm trying to use `serverStreamingPredict` with  `text-bison@001` and its always saying prompt is missing in the input field. But I did verified with verify method from StreamingPredictRequest and it return valid case - null. Unfortunately there are no examples provided, I followed the RESTAPI and types to create this.

Error:

5war00p_0-1705758400595.png


Code:

 

async function callStreamingPredictForText(
publisher = "google",
model = "text-bison@001",
) {
// Configure the parent resource
const endpoint = `projects/${project}/locations/${location}/publishers/${publisher}/models/${model}`;

const request = {
endpoint,
inputs: [
{
prompt: "What are the cardinal directions?",
},
],
parameters: {
temperature: 0.2,
maxOutputTokens: 256,
topP: 0.95,
topK: 40,
},
};
const reqObject =
google.cloud.aiplatform.v1.StreamingPredictRequest.fromObject(request);
// console.log(
// ">>> inputs",
// google.cloud.aiplatform.v1.StreamingPredictRequest.toObject(reqObject),
// );

// Predict request
const response =
await predictionServiceClient.serverStreamingPredict(reqObject);

response.on("data", (data) => console.log(data));
}

 

 

 

1 0 72
0 REPLIES 0