Decorators
Two decorators are available: @observe for tracing-only and @endpoint for remote testing with automatic tracing.
@endpoint
Functions decorated with @endpoint are automatically traced. Use this for functions that need remote testing capability.
See the Connector documentation for full details on @endpoint.
Disabling Tracing
To register for remote testing without tracing:
@observe
Use @observe for functions that only need tracing (no remote testing):
Convenience Decorators
Pre-configured decorators for common AI operations, organized by category.
AI Model Operations
@observe.llm()
For language model calls.
| Parameter | Required | Description |
|---|---|---|
provider | Yes | Provider name (openai, anthropic, google) |
model | Yes | Model name (gpt-4, claude-3-opus) |
@observe.embedding()
For embedding generation.
| Parameter | Required | Description |
|---|---|---|
model | Yes | Embedding model name |
dimensions | No | Vector dimensions |
Tool & Retrieval
@observe.tool()
For tool/function execution.
| Parameter | Required | Description |
|---|---|---|
name | Yes | Tool name |
tool_type | Yes | Type (http, function, database) |
@observe.retrieval()
For vector search and knowledge base queries.
| Parameter | Required | Description |
|---|---|---|
backend | Yes | Backend name (pinecone, weaviate, chroma) |
top_k | No | Number of results |
@observe.rerank()
For reranking search results.
| Parameter | Required | Description |
|---|---|---|
model | Yes | Reranker model name |
top_n | No | Number of results to return |
Quality & Safety
@observe.evaluation()
For response evaluation and scoring.
| Parameter | Required | Description |
|---|---|---|
metric | Yes | Metric name (relevance, faithfulness) |
evaluator | Yes | Evaluator model/service |
@observe.guardrail()
For content safety and moderation.
| Parameter | Required | Description |
|---|---|---|
guardrail_type | Yes | Type (content_safety, pii_detection, toxicity) |
provider | Yes | Provider name |
Data Processing
@observe.transform()
For data transformation and preprocessing.
| Parameter | Required | Description |
|---|---|---|
transform_type | Yes | Type (text, image, audio) |
operation | Yes | Operation (clean, normalize, tokenize) |
Comparison
| Feature | @observe | @endpoint |
|---|---|---|
| Traces execution | Yes | Yes (default) |
| Remote testing | No | Yes |
| Use case | Internal helpers | Public APIs, endpoints |
Usage Pattern
Next: Learn about custom spans for advanced attribute configuration.