Skip to content

Support for Async in Google GenAI SDK - LLM Observability #315

Description

@maltehedderich

Hi Posthog Team,

recently you added basic Google GenAI SDK support see #201. Thanks a lot for that!

Unfortunately the whole async part of the client seems still unsupported, as the aio part is missing. Would be awesome to have that also in the Posthog Client replacement.

Cheers,

Malte

Edit: I just noticed the files API is also missing.

Activity

  1. kdenz commented on Sep 2, 2025

    @kdenz

    Have the same need too

  2. LucasAlvesSoares commented on Sep 5, 2025

    @LucasAlvesSoares

    Needed that too! #324 .Not sure how long it takes to be reviewed but feel free to use mine for now

  3. clr182 commented on Oct 28, 2025

    @clr182
    Member
  4. added theissue type on Oct 28, 2025
  5. staru09 commented on Jan 9, 2026

    @staru09

    Is this been taken care of?

  6. ethanporcaro commented on Feb 23, 2026

    @ethanporcaro
    Contributor

    This would be extremely helpful with the pydantic-ai framework.

  7. ethanporcaro commented on Feb 23, 2026

    @ethanporcaro
    Contributor

    I found a workaround way to do it. You may need to tweak the methods you carry over. This is unstable so use at your own risk.

    from posthog.ai.gemini import AsyncClient
    from google.genai.client import Client
    
    google_client = Client(
        api_key=os.getenv("GEMINI_API_KEY", ""),
    )
    ph_client = AsyncClient(
        api_key=os.getenv("GEMINI_API_KEY", ""),
        posthog_client=posthog_client
    )
    google_client.aio.models.generate_content = ph_client.models.generate_content
    google_client.aio.models.generate_content_stream = ph_client.models.generate_content_stream
    client = google_client
    

    It basically uses the original Gemini client, then replaces the actual generation methods with the posthog tracked ones.

  8. self-assigned this
    on May 6, 2026
  9. DanielTobi0 commented on Sep 8, 2026

    @DanielTobi0
    Contributor

    Hi, is anyone actively working on this issue?

  10. added 3 commits that reference this issue on Sep 8, 2026
    a47c144
    ab70479
    dfdb8cf
  11. added 2 commits that reference this issue on Sep 11, 2026
    373c580
    e9f6b67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions