evidentlyai / evidently

Evaluate and monitor ML models from validation to production. Join our Discord: https://discord.com/invite/xZjKRaNp8b
Apache License 2.0
4.88k stars 547 forks source link

HTTPError: 400 Client Error when adding report to workspace #1189

Open tommysteryy opened 1 week ago

tommysteryy commented 1 week ago

Hey there! Love your stuff.

I am implementing a custom Metric, and I believe there are no errors coming from that part. There are no calculation errors.

It is in the call to workspace.add_report() where we get a 400 from the POST request to add_snapshot.

I'm sorry I can't link the stacktrace because it's on my work laptop, but it's not particularly informative (just says requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: <our-evidently-instance>/api/projects/<some-id>/snapshots

Any help would be appreciated! Is it something wrong with the content (or MetricResult) I'm sending?

elenasamuylova commented 1 week ago

Hi @tommysteryy , did you implement the custom metric as a Python function like here: https://github.com/evidentlyai/evidently/blob/main/examples/how_to_questions/how_to_build_metric_over_python_function.ipynb ?

tommysteryy commented 1 week ago

Hi! No, I used this one: https://github.com/evidentlyai/evidently/blob/main/examples/how_to_questions/how_to_make_custom_metric_and_test.ipynb.

elenasamuylova commented 1 week ago

Hi @tommysteryy,

I am afraid as noted in the docs in this case you cannot simply pass the custom metric to the Monitoring UI since the metric code is not available to the server.

If you want to be able to pass the metric for monitoring easily, you must implement it as a Python function with the default counter render.

Which metric are you looking to add?

tommysteryy commented 1 week ago

Ahhh I see.. thank you for pointing me to that! I missed that part.

I am looking to plot a table that displays some custom calculations used in our use case. That's also why it doesn't quite fit the default Counter renderer.

Currently, I've implemented my custom Metric, MetricResult, and MetricRenderer (rendering using the table_data function).

I see that in the docs it mentions:

This is suitable for open-source use when you only want to access the new Metric in a Report or Test Suite

What is this referring to? How would I use/access my custom metric as a Report?

If that isn't super relevant, do you have any ideas for how I might be able to plot this table on our self-hosted monitoring UI?

SSJDiVaD commented 3 days ago

Hi @elenasamuylova ,

I just want to double check: the Evidently monitoring UI currently does not allow us to use any renderer other than the default Counter? So like, we cannot select the built-in Table renderer (https://docs.evidentlyai.com/reference/api-reference/evidently.renderers#table_data-column_names-iterable-str-data-iterable-iterable-title-str-size-widgetsize-widgetsize.ful)?

Would you happen to have any a rough estimate on if/when you plan to implement this?

Thanks in advance!