Repository: PrefectHQ/prefect

Issue:
Float64-only pandas Dataframes not supported as flow arguments
### First check

- [X] I added a descriptive title to this issue.
- [X] I used the GitHub search to find a similar issue and didn't find it.
- [X] I searched the Prefect documentation for this issue.
- [X] I checked that this issue is related to Prefect and not one of its dependencies.

### Bug summary

Flows don't support pandas Dataframes if they contain only float64 columns. Once we add any non-float64 (float32/int etc) column to the dataframe, serialization of the parameters works fine. I'm not sure why this makes any difference. 

Adding `orjson.OPT_SERIALIZE_NUMPY` flag to `prefect.orion.utilities.schemas.orjson_dumps_non_str_keys` solves this issue.

### Reproduction

```python3
import pandas as pd
from prefect import flow


@flow(validate_parameters=False)
def transformer(df: pd.DataFrame):
    return df


x = pd.DataFrame({
    "a": [0.],
    # "b": [0]  # uncomment to make it work
})
print(x.dtypes)
transformer(x)
```


### Error

```python3
Traceback (most recent call last):
  File "/Users/michal.augoff/Documents/GitHub/mls-mlops/local_run.py", line 15, in <module>
    transformer(x)
  File "/Users/michal.augoff/anaconda3/envs/mlops2/lib/python3.8/site-packages/prefect/flows.py", line 447, in __call__
    return enter_flow_run_engine_from_flow_call(
  File "/Users/michal.augoff/anaconda3/envs/mlops2/lib/python3.8/site-packages/prefect/engine.py", line 162, in enter_flow_run_engine_from_flow_call
    return anyio.run(begin_run)
  File "/Users/michal.augoff/anaconda3/envs/mlops2/lib/python3.8/site-packages/anyio/_core/_eventloop.py", line 70, in run
    return asynclib.run(func, *args, **backend_options)
  File "/Users/michal.augoff/anaconda3/envs/mlops2/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 292, in run
    return native_run(wrapper(), debug=debug)
  File "/Users/michal.augoff/anaconda3/envs/mlops2/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/Users/michal.augoff/anaconda3/envs/mlops2/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/Users/michal.augoff/anaconda3/envs/mlops2/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
    return await func(*args)
  File "/Users/michal.augoff/anaconda3/envs/mlops2/lib/python3.8/site-packages/prefect/client/utilities.py", line 47, in with_injected_client
    return await fn(*args, **kwargs)
  File "/Users/michal.augoff/anaconda3/envs/mlops2/lib/python3.8/site-packages/prefect/engine.py", line 219, in create_then_begin_flow_run
    flow_run = await client.create_flow_run(
  File "/Users/michal.augoff/anaconda3/envs/mlops2/lib/python3.8/site-packages/prefect/client/orion.py", line 449, in create_flow_run
    flow_run_create_json = flow_run_create.dict(json_compatible=True)
  File "/Users/michal.augoff/anaconda3/envs/mlops2/lib/python3.8/site-packages/prefect/orion/utilities/schemas.py", line 268, in dict
    return json.loads(self.json(*args, **kwargs))
  File "/Users/michal.augoff/anaconda3/envs/mlops2/lib/python3.8/site-packages/prefect/orion/utilities/schemas.py", line 238, in json
    return super().json(*args, **kwargs)
  File "pydantic/main.py", line 505, in pydantic.main.BaseModel.json
  File "/Users/michal.augoff/anaconda3/envs/mlops2/lib/python3.8/site-packages/prefect/orion/utilities/schemas.py", line 135, in orjson_dumps_non_str_keys
    return orjson.dumps(v, default=default, option=orjson.OPT_NON_STR_KEYS).decode()
TypeError: Type is not JSON serializable: numpy.float64
```


### Versions

```Text
2.7.1
```


### Additional context

_No response_


Discussion:
@Ewande would you mind including the full traceback?

Resolving patch:
diff --git a/src/prefect/orion/schemas/actions.py b/src/prefect/orion/schemas/actions.py
--- a/src/prefect/orion/schemas/actions.py
+++ b/src/prefect/orion/schemas/actions.py
@@ -13,7 +13,7 @@
     FieldFrom,
     PrefectBaseModel,
     copy_model_fields,
-    orjson_dumps_non_str_keys,
+    orjson_dumps_extra_compatible,
 )
 
 LOWERCASE_LETTERS_AND_DASHES_ONLY_REGEX = "^[a-z0-9-]*$"
@@ -209,7 +209,7 @@ class FlowRunCreate(ActionBaseModel):
     idempotency_key: Optional[str] = FieldFrom(schemas.core.FlowRun)
 
     class Config(ActionBaseModel.Config):
-        json_dumps = orjson_dumps_non_str_keys
+        json_dumps = orjson_dumps_extra_compatible
 
 
 @copy_model_fields
diff --git a/src/prefect/orion/utilities/schemas.py b/src/prefect/orion/utilities/schemas.py
--- a/src/prefect/orion/utilities/schemas.py
+++ b/src/prefect/orion/utilities/schemas.py
@@ -124,15 +124,18 @@ def orjson_dumps(v: Any, *, default: Any) -> str:
     return orjson.dumps(v, default=default).decode()
 
 
-def orjson_dumps_non_str_keys(v: Any, *, default: Any) -> str:
+def orjson_dumps_extra_compatible(v: Any, *, default: Any) -> str:
     """
-    Utility for dumping a value to JSON using orjson, but allows for non-string keys.
-    This is helpful for situations like pandas dataframes, which can result in
-    non-string keys.
+    Utility for dumping a value to JSON using orjson, but allows for
+    1) non-string keys: this is helpful for situations like pandas dataframes,
+    which can result in non-string keys
+    2) numpy types: for serializing numpy arrays
 
     orjson.dumps returns bytes, to match standard json.dumps we need to decode.
     """
-    return orjson.dumps(v, default=default, option=orjson.OPT_NON_STR_KEYS).decode()
+    return orjson.dumps(
+        v, default=default, option=orjson.OPT_NON_STR_KEYS | orjson.OPT_SERIALIZE_NUMPY
+    ).decode()
 
 
 class PrefectBaseModel(BaseModel):


Test patch:
diff --git a/tests/orion/schemas/test_actions.py b/tests/orion/schemas/test_actions.py
--- a/tests/orion/schemas/test_actions.py
+++ b/tests/orion/schemas/test_actions.py
@@ -1,5 +1,6 @@
 from uuid import uuid4
 
+import numpy as np
 import pytest
 
 from prefect.orion.schemas.actions import FlowRunCreate
@@ -14,7 +15,11 @@
         (
             {"df": {"col": {0: "1"}}},
             {"df": {"col": {"0": "1"}}},
-        ),  # Example of serialzied dataframe parameter with int key
+        ),  # Example of serialized dataframe parameter with int key
+        (
+            {"df": {"col": {0: np.float64(1.0)}}},
+            {"df": {"col": {"0": 1.0}}},
+        ),  # Example of serialized dataframe parameter with numpy value
     ],
 )
 class TestFlowRunCreate: