Skip to content

RFC: Providing support for non-node.js backends (Python FastAPI) #435

@nikkiam

Description

@nikkiam

Hey, not sure where to put this, but the Q&A link in the contributing guide was broken. I have a port of the @hashbrown/google package to Python that is FastAPI compatible, and I was wondering whether the Hashbrown team had interest in officially or unofficially supporting non-JS backends in the docs.

I wanted to integrate my frontend implementation of the hashbrown.dev library in React with my existing FastAPI backend instead of spinning up a dedicated Express server just for processing OpenAI/Gemini requests. In doing so, I discovered that the basic chat functions are easy to port to Python for both OpenAI and Gemini, but with the useStructured* hooks, I had to make some minor changes to get things working.

I now have what I think is working, "pip package"-able code to translate from useStructured* hook backend request format to the Gemini API request format (using the google-genai python SDK). I validated my code by writing a script to check that identical Gemini requests are produced for the same useStructured* hook-based request by both of my locally running Express + @hashbrown/google and FastAPI + my port servers. Happy to keep it for my own use, but I thought I'd let you know!

Metadata

Metadata

Assignees

No one assigned

    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