importlogfirefrommirascope.coreimportanthropic,prompt_templatefrommirascope.integrations.logfireimportwith_logfirelogfire.configure()defformat_book(title:str,author:str):returnf"{title} by {author}"@with_logfire()@anthropic.call(model="claude-3-5-sonnet-20240620",tools=[format_book])defrecommend_book(genre:str)->str:returnf"Recommend a {genre} book"print(recommend_book("fantasy"))
Source code in mirascope/integrations/logfire/_with_logfire.py