Skip to content

Instantly share code, notes, and snippets.

View dharrawal's full-sized avatar

Dhar Rawal dharrawal

View GitHub Profile
@dharrawal
dharrawal / dspy_logger.py
Last active April 3, 2024 13:54
A simple framework for logging calls to DSPy programs in a minimally obtrusive way
"""
DSPy Logging Utilities
Author: Dhar Rawal
Works with DSPy to log forward calls and their results, using a custom handler function.
Works with typed predictors too!
"""
import functools
import json
from typing import Any, Callable, Dict, Optional, Tuple