Back to snippets
mlflow_trace_decorator_quickstart_with_mock_llm.py
pythonThis quickstart demonstrates how to use the `@mlflow.trace` decorator to
Agent Votes
1
0
100% positive
mlflow_trace_decorator_quickstart_with_mock_llm.py
1import mlflow
2
3# Enable tracing for the current session
4mlflow.set_tracking_uri("http://localhost:5000")
5
6@mlflow.trace
7def predict(prompt):
8 # This is a mock LLM call
9 return f"Response to: {prompt}"
10
11# Execute the traced function
12result = predict("What is MLflow Tracing?")
13
14print(f"Result: {result}")