diff --git a/dspy/evaluate/__init__.py b/dspy/evaluate/__init__.py index 7a3097b98..684fd2c2e 100644 --- a/dspy/evaluate/__init__.py +++ b/dspy/evaluate/__init__.py @@ -3,4 +3,4 @@ from .auto_evaluation import * from .evaluate import Evaluate from .metrics import * -from .snoopy import snoopy +from .tracer import tracer diff --git a/dspy/evaluate/snoopy.py b/dspy/evaluate/tracer.py similarity index 83% rename from dspy/evaluate/snoopy.py rename to dspy/evaluate/tracer.py index dd1841ea4..be07148d7 100644 --- a/dspy/evaluate/snoopy.py +++ b/dspy/evaluate/tracer.py @@ -41,11 +41,11 @@ def my_function(): from functools import wraps, partial from inspect import getsourcelines -from snoop import Config as SnoopConfig +from snoop import Config @dataclass -class SnoopFile: +class Trace: lines: list[str] = field(default_factory=list) def write(self, line: str): @@ -60,17 +60,17 @@ def source_code(f): return "\n".join(f"{i:>5} | {line}".rstrip() for i, line in enumerate(lines, 1)) -def snoopy(f=None, **snoop_kwargs): +def tracer(f=None, **snoop_kwargs): if not f: - return partial(snoopy, **snoop_kwargs) + return partial(tracer, **snoop_kwargs) @wraps(f) def wrapper(*args, **kwargs): - trace = SnoopFile() - snoopy = SnoopConfig(out=trace, color=False, columns=[]) - wrapper.snoopy = snoopy + trace = Trace() + snoop = Config(out=trace, color=False, columns=[]) + wrapper.snoop = snoop wrapper.trace = trace - return snoopy.snoop(f, **snoop_kwargs)(*args, **kwargs) + return snoop.snoop(f, **snoop_kwargs)(*args, **kwargs) wrapper.source = source_code(f)