Skip to main content
wrap() (Python) and wrapGoogleGenAI() (TypeScript) wrap the Google GenAI client so models.generate_content and generate_content_stream (and the same under client.aio) get the context and record the answer.

Install

The TypeScript integration ships with @niadra/sdk 0.3.0, ready on main and on npm when it is published; until then the npm package is 0.1.1.

The five primitives

Minimal example

The same code is in examples/google_genai_generate.py and examples/google-genai.ts.

Limits

  • Outside a conversation or task block, calls pass through untouched, and nothing the wrapper does can fail the call.
  • Only generate_content and generate_content_stream are intercepted; chats, embeddings and the rest of the client pass through untouched.
  • Tested against google-genai 2.25 and @google/genai 2.24 with the transport replaced and Niadra on the emulator.

Next steps

Google ADK

Google’s agent framework, through callbacks.

Context and views

the target model and the cache floors.