Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added a replaced teleprompt.compile's signature with a TypeVar that t…
…racks the type exact type of the student module passed in
  • Loading branch information
TyTodd committed Nov 3, 2025
commit 55aef6f0d29528fb6ba1a6f5e338808d57403e6a
14 changes: 12 additions & 2 deletions dspy/teleprompt/teleprompt.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
from typing import Any
from typing import Any, TypeVar

from dspy.primitives import Example, Module

M = TypeVar("M", bound=Module)


class Teleprompter:
def __init__(self):
pass

def compile(self, student: Module, *, trainset: list[Example], teacher: Module | None = None, valset: list[Example] | None = None, **kwargs) -> Module:
def compile(
self,
student: M,
*,
trainset: list[Example],
teacher: Module | None = None,
valset: list[Example] | None = None,
**kwargs,
) -> M:
"""
Optimize the student program.

Expand Down