from muxx import trace@trace("document-pipeline")def process_document(doc_id: str): # All operations inside create a new trace extract_text(doc_id) analyze_content(doc_id) generate_summary(doc_id)
from muxx import generation@generation(model="gpt-4o", provider="openai")def call_llm(prompt: str): # Useful when using a custom LLM client # that Muxx doesn't automatically detect pass
Combining Decorators
Decorators can be combined:
from muxx import trace, span, observe@trace("api-request")def handle_api_request(request): @span("validate") def validate(): pass @span("process") @observe() # This span is also observed def process(): # LLM call here pass validate() return process()
from muxx import observe@observe("risky-operation")def risky_operation(): raise ValueError("Something went wrong") # Error is captured in the trace with full stack trace