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
@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
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_contentandgenerate_content_streamare intercepted; chats, embeddings and the rest of the client pass through untouched. - Tested against
google-genai2.25 and@google/genai2.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.

