Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logfire only shows pretty message log when using prompt_template #775

Closed
off6atomic opened this issue Jan 22, 2025 · 1 comment · Fixed by #778
Closed

Logfire only shows pretty message log when using prompt_template #775

off6atomic opened this issue Jan 22, 2025 · 1 comment · Fixed by #778
Assignees
Labels
bug Something isn't working mirascope

Comments

@off6atomic
Copy link
Contributor

off6atomic commented Jan 22, 2025

Description

Run the following code:

import logfire
from dotenv import load_dotenv
from mirascope.core import openai, prompt_template
from mirascope.integrations.logfire import with_logfire

load_dotenv()
logfire.configure()


@with_logfire()
@openai.call(model="gpt-4o-mini")
def recommend_book_bad(genre: str) -> str:
    return f"Recommend a {genre} book"


@with_logfire()
@openai.call(model="gpt-4o-mini")
@prompt_template("Recommend a {genre} book")
def recommend_book_good(genre: str): ...


print(recommend_book_bad("fantasy"))  # ugly log
print(recommend_book_good("fantasy"))  # pretty log

And you will see the following ugly log on logfire:

Image

This one is prettier log:

Image

The only difference between them is the existence of prompt_template decorator in the 2nd function.

How can we make the log pretty for the 1st function as well?
I like to write in style of first function more because is more explicit and less magic.

Sorry @willbakst, lots of bug reports lately.

Python, Mirascope & OS Versions, related packages (not required)

mirascope==1.15.1
@off6atomic off6atomic added the bug Something isn't working label Jan 22, 2025
@willbakst willbakst self-assigned this Jan 23, 2025
willbakst pushed a commit that referenced this issue Jan 24, 2025
@willbakst willbakst mentioned this issue Jan 24, 2025
@willbakst
Copy link
Contributor

Fix released in v1.16.1!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mirascope
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants