-
Notifications
You must be signed in to change notification settings - Fork 1.2k
MachineLearning.GetTrainedModelsStats always throws a deserialization exception #8271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
spec issue: elastic/elasticsearch-specification#2739 |
@svalbuena Thank you for creating the spec PR! The fix should already be included in the latest patch release which I did on Monday :-) |
Thanks @flobernd ! |
@svalbuena I think you did not get this completely right here. The spec is created by hand ( The TS bindings for the official JS client are as well generated from the spec 🙂 Regarding server-side: Currently, the controllers etc. are not generated from the spec, but I agree, that such approach could have a lot of benefits. For a new project, I would always chose this path as well, but it's often hard to change workflows for a software like ElasticSearch that exists for such long time. |
@flobernd ahh gotcha, so the .ts files that are just used to generate the spec. why not editing the spec .json directly? is it to have some type-safety/compilation checks that you would not have by working against the json directly? |
@svalbuena Yes, mainly because it's way more convenient writing TS code than raw JSON 🙂 The compiled We as well explored other projects like e.g. Microsoft TypeSpec as a potential replacement for our custom TS based spec format, but currently this does not fulfill our requirements. |
@flobernd I've opened a follow-up pr to this, seems like there were two other type errors that are failing the request, this time I manually edited the .net client locally and verified there are no other errors left elastic/elasticsearch-specification#2763 |
Elastic.Clients.Elasticsearch version: 8.14.6
Elasticsearch version: 8.14.3
.NET runtime version: 8.0
Operating system version: Windows
Description of the problem including expected versus actual behavior:
I'm using the
MachineLearning.GetTrainedModelsStatsAsync
call to get the stats of a trained model, this request always results inSystem.Text.Json.JsonException: The JSON value could not be converted to System.Int32. Path: $.trained_model_stats[0].model_size_stats.required_native_memory_bytes
. Invoking the route manuallyhttp://localhost:9200/_ml/trained_models/intfloat__e5-small-v2/_stats
works.Upon inspection of the Model class the response is deserialized into, I found the
required_native_memory_bytes
is defined as anint
rather thanByteSize
as the other fields of the same type:The
required_native_memory_bytes
is much bigger than an int.Steps to reproduce:
await client.MachineLearning.GetTrainedModelsStatsAsync(new Ids("intfloat__e5-small-v2"), cancellationToken);
Expected behavior
The TrainedModelSizeStats class should type the
RequiredNativeMemoryBytes
field asElastic.Clients.Elasticsearch.ByteSize
, and theGetTrainedModelsStatsAsync
call should succeed.The text was updated successfully, but these errors were encountered: