loaded_model = mlflow.pyfunc.load_model(f"************************")
eval_data = pd.DataFrame(
{
"request": [
"{\"text\": \"What is the stoppage duration for January month 2024?\", \"param1\": \"2\", \"param2\": \"no-human\"}",
],
"expected_response": [
"Stoppage duration for January month 2024 is 12 hours.",
],
}
)
def custom_langgraph_wrapper(model_input😞
predictions = loaded_model.predict({"messages": model_input["messages"]})
# Assuming `predictions` is a list of strings
return predictions.join("\n")
with mlflow.start_run() as run:
results = mlflow.evaluate(
custom_langgraph_wrapper, # Pass the function defined above
data=eval_data,
model_type="databricks-agent",
)
print(results.metrics)
Error is:
MODEL_ERROR
Fail to invoke the model with {'messages': [{'role': 'user', 'content': '{"text": "What is the stoppage duration for January month 2024?", "param1": "2", "param2": "no-human"}'}]}. MlflowException('Failed to enforce schema of data \'{\'messages\': [{\'role\': \'user\', \'content\': \'{"text": "What is the stoppage duration for January month 2024?", "param1": "2", "param2": "no-human"}\'}]}\' with schema \'[\'text\': string (required), \'param1\': string (required), \'param2\': string (required)]\'. Error: Model is missing inputs [\'text\', \'param1\', \'param2\']. Note that there were extra inputs: [\'messages\']')
Any suggestion or reference example should be helpful .