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 not logging the response #359

Open
rawwerks opened this issue Oct 22, 2024 · 2 comments
Open

logfire not logging the response #359

rawwerks opened this issue Oct 22, 2024 · 2 comments

Comments

@rawwerks
Copy link

i'm following along with https://magentic.dev/logging-and-tracing/ , but i don't think logfire.instrument_openai() is fully implemented correctly, because i cannot see the response in logfire.

example:

import os
from dotenv import load_dotenv

# Load environment variables from .env file
load_dotenv()

import logfire

logfire.configure()
logfire.instrument_openai()  # optional, to trace OpenAI API calls  
logfire.info('Hello, {name}!', name='world')

from magentic import prompt
from pydantic import BaseModel


class Superhero(BaseModel):
    name: str
    age: int
    power: str
    enemies: list[str]


@prompt("Create a Superhero named {name}.")
def create_superhero(name: str) -> Superhero: ...


create_superhero("Monkey Boy")

result:
CleanShot 2024-10-22 at 07 27 34@2x

@jackmpcollins
Copy link
Owner

jackmpcollins commented Oct 25, 2024

@rawwerks You're right! Tool call responses (used for structure outputs in magentic) show correctly in logfire for non-streamed responses, but not when stream=True. I've opened an issue with logfire now pydantic/logfire#542

@jackmpcollins
Copy link
Owner

@rawwerks Logfire PR is here if you'd like to test it out pydantic/logfire#545

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants