Skip to content

Conversation

@rhaertel80
Copy link

No description provided.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@rhaertel80
Copy link
Author

Fixed my email address to avoid CLA bot warning.


try
{
Person person = new Person
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment -- I'd expect you should be able to use dynamic here rather than have to define a Person class and use strong typing, just for filling in a bunch of fields.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally did that, but then thought user in production probably has structured data. If, in fact, anonymous types are pretty ubiquitous, happy to change.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, you're already using dynamic in dealing with the response, as well as an anonymous type in constructing the request (new { instances = instances }) itself ... hence this bit might as well do the same.

client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", bearer_token);

var version_suffix = version == null ? "" : $"/version/{version}";
var model_uri = $"projects/{project}/models/{model}{version_suffix}";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a style point of view, C# code doesn't use underscores. This would be modelUri.

}

// [START predict_json]
static async Task<dynamic> Predict(String project, String model, List<Person> instances, String version = null)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the total nit category -- was slightly bugging me to see model and version parameters separated apart. Signature could be (instances, project, model, version). :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants