Comments (5)
Hi @cselti , sorry for the delay.
So I tried to deploy a model and the send predict
requests. Following the way a model was queried in ruby, I replicated the syntax for PHP and it worked. Following is the crude way of creating a prediction request. You can extract the logic so that request making becomes easy.
$serializer = new Serializer();
$struct = $serializer->decodeMessage(new Struct(), ['fields' => ['prompt' => ['string_value' => 'Hi Model']]]);
$request = (new PredictRequest())
->setEndpoint($client->endpointName($projectId, $locationId, $endpointId))
->setInstances([
new Value(['struct_value' => $struct])
If you face connection timeout / deadline exceed error, you can just simply increase the timeout for predict
rpc according to your model's average end to end request times in the vendor/google/cloud-ai-platform/src/V1/resources/prediction_service_client_config.json
from php-docs-samples.
Does this example help? https://github.com/googleapis/google-cloud-php-ai-platform/blob/main/src/V1/Gapic/PredictionServiceGapicClient.php#L614-L623
from php-docs-samples.
Sadly, no, I have already checked everything in the client library's source code.
The problem is that the acceptable instance
structure has not been specified.
I have tried with the same structure as in the REST API or Node.js library (and those work, of course):
$instances = new Value(['prompt' => 'Give me ten interview questions for the role of program manager.']);
// or
$instances = new Value(['content' => 'Give me ten interview questions for the role of program manager.']);
// or
$instances = new Value(['text' => 'Give me ten interview questions for the role of program manager.']);
// or
$instances = new StringValue(['input' => 'Give me ten interview questions for the role of program manager.']);
// or
$instances = new Value(['input_text' => new StringValue('Give me ten interview questions for the role of program manager.')]);
// .....
I have got always like these:
Fatal error: Uncaught UnexpectedValueException: Invalid message property: content
Fatal error: Uncaught UnexpectedValueException: Invalid message property: prompt
Fatal error: Uncaught UnexpectedValueException: Invalid message property: text
Fatal error: Uncaught UnexpectedValueException: Invalid message property: input
....
from php-docs-samples.
Hi @cselti ,
I see that the Value
is imported as Google\Protobuf\Value
(ref). Also observing that Ai Platform has defined it's own Value.php with possible options as string_value
, int_value
and double_value
.
Can you check if the following works for you?
$instances = [new Value(['string_value' => 'Give me ten interview questions for the role of program manager.'])]
from php-docs-samples.
Hi @yash30201 ,
Sadly not:
Call failed with message: {
"message": "Invalid instance: string_value: \t \"Give me ten interview questions for the role of program manager.\"\n",
"code": 3,
"status": "INVALID_ARGUMENT",
"details": []
}
It was worked for you?
from php-docs-samples.
Related Issues (20)
- Link to GAE Standard Wordpress is broken HOT 1
- Pubsub sample publish_avro_records is not working for Binary encoded data
- Implicit conversion from float 3988292384 to int loses precision Error in PHP 8.1 HOT 1
- Cannot connect from PHP to firebase firestore shared emulator HOT 1
- Remove dollars outside curly braces
- download multiple objects in StorageClient HOT 1
- feat: upgrade "preview" api clients to new surface
- feat: upgrade GA api clients to new surface
- Error in \appengine\flexible\wordpress HOT 1
- Create samples for storageinsights HOT 1
- storage: update Autoclass samples for v2.1
- Response size on PHP 8.2 HOT 1
- BetaAnalyticsDataClient: unable to fetch data using quickstart guide HOT 1
- run/laravel tests not configured correctly HOT 2
- Are Firestore aggregation queries supported? (count, sum etc) HOT 5
- BetaAnalyticsDataClient: Uri template error HOT 8
- feat: update Cloud Run sample to use non-EOL PHP
- feat: Update Cloud Functions samples to use non-EOL PHP
- storage: add object retention samples
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-docs-samples.