Skip to content

Send multi-modal input to Logfire #1563

@DouweM

Description

@DouweM

Description

Logfire (and other OTel consumers) currently only receive kind: image/video/audio/document-url (but not the URL) or kind: binary-content (but not the bytes):

def otel_event(self) -> Event:
if isinstance(self.content, str):
content = self.content
else:
# TODO figure out what to record for images and audio
content = [part if isinstance(part, str) else {'kind': part.kind} for part in self.content]
return Event('gen_ai.user.message', body={'content': content, 'role': 'user'})

To render the LLM conversation accurately and aid in debugging, we should send the actual data along.

Note that URLs are typically not passed directly to the LLM, but downloaded by PydanticAI and sent as bytes. We could consider sending both the URL and the data to Logfire, especially as the URL may not always be available. We may need a size limit though.

References

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions