Skip to content

bug: Unable to track image generation calls #8252

@secsilm

Description

@secsilm

Describe the bug

When using OpenAI's image generation API, Langfuse does not display the trace.

To reproduce

import os
from dotenv import load_dotenv
from langfuse import openai

load_dotenv(".env.dev")

client = openai.OpenAI(
    base_url=os.environ["AI_GATEWAY_API_URL"],
    api_key=os.environ["AI_GATEWAY_API_KEY"],
    max_retries=3,
)


def call_llm(prompt: str, model: str = "gpt-image-1"):
    response = client.images.generate(
        model=model,
        prompt=prompt,
        n=1,
    )
    return response


if __name__ == "__main__":
    call_llm("Generate an image of a futuristic city skyline at sunset")

SDK and container versions

  • sdk: 3.2.1
  • container: 3.72.1

Additional information

No response

Are you interested to contribute a fix for this bug?

No

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions