serverStreamingPredict, Error : Missing field messages in input
https://github.com/googleapis/google-cloud-node/blob/38140975dcfc5936032d05083eb3f7b9bfe93a7c/packages/google-cloud-aiplatform/src/v1beta1/prediction_service_client.ts#L924C32-L924C38
Is this datatype actually array of number ? data type is miss match and no explantation on how to generate a Tensor Input
I have tried this
const predictClient = new PredictionServiceClient({
apiEndpoint: 'us-central1-aiplatform.googleapis.com',
auth
});
const endpoint `projects/.......`
const Input = {
"context": `Your are an Ai`,
"examples": [],
"messages": [
{
"author": "user",
"content": 'This is question'
},
]
}
const parameter = {
candidateCount: 1,
maxOutputTokens: 1024,
temperature: 0.2,
topP: 0.8,
topK: 40
};
const request = {
endpoint,
inputs: [Tensor.fromObject(prompt)],
parameter: Tensor.fromObject(parameter)
};
const stream = predictClient.serverStreamingPredict(request);
stream.on('data', (response) => { console.log(response) });
stream.on('error', (err) => { throw(err) });
stream.on('end', () => { /* API call completed */ });
it fails with message
details: 'Missing field messages in input.',
Tried this
const input = Tensor.fromObject({
structVal: {
context: {
stringVal: [prompt as string]
},
examples: {
listVal: []
},
messages: {
listVal: [
{
author: {
stringVal: ["user"]
},
content: {
stringVal: [question as string]
}
},
]
}
}
})
const streamRequest = {
endpoint,
inputs: [input],
parameters: parameter as ITensor
};
const stream = predictClient.serverStreamingPredict(streamRequest);
Still doesnt work, with the same message
details: 'Missing field messages in input.',
NOTE: using this kind of object structure successfully created an ITensor with all value intact, last time it returned Empty Tensor object
I don't know if this is a Bug or I'm implementing it the wrong way, please give me guidance
So close, dude! From the REST API you can see that you're missing a structVal within your listVal.
The real question is: are there helpers to create ITensors like there are with IValue?
(FYI -- you don't need the Tensor.fromObject. The object you get back is exactly the same as the one you put in.)