mirascope.integrations.logfire | Mirascope
MirascopeLilypad

mirascope.integrations.logfire

Alias with_logfire

Wraps a Mirascope function with Logfire tracing.

Example:

import logfire
from mirascope.core import anthropic, prompt_template
from mirascope.integrations.logfire import with_logfire

logfire.configure()


def format_book(title: str, author: str):
    return f"{title} by {author}"


@with_logfire()
@anthropic.call(model="claude-3-5-sonnet-20240620", tools=[format_book])
def recommend_book(genre: str) -> str:
    return f"Recommend a {genre} book"


print(recommend_book("fantasy"))

Returns

TypeDescription
(() => _R) => () => _R-

Alias to: mirascope.integrations.logfire._with_logfire.with_logfire