Closed CharlesFarhat closed 1 week ago
I think we should implement a helper method with proper typing that converts a list of decorators into a single decorator.
For example, maybe something like this:
from mirascope.core import merge_decorators
litellm_stream = merge_decorators(
litellm.call("gpt-4o-mini", stream=True),
with_logfire(),
save_usage(callback=lambda metrics: print(f"\nMetrics: {metrics}")),
handle_errors(),
retry(),
)
@litellm_stream()
@prompt_template("Recommend a {genre} book")
def recommend_book(genre: str): ...
We already have something like this implemented for BasePrompt.run
, but it will likely require some additional figuring out to make it work well
This is released in v1.8
!
Description
Would be super useful to solve situation where you have a stack of decorators :