Skip to content

Instantly share code, notes, and snippets.

View patrickloeber's full-sized avatar
💻
building

Patrick Loeber patrickloeber

💻
building
View GitHub Profile
@patrickloeber
patrickloeber / test_log.json
Created September 7, 2026 11:21
Test log json
[
{
"id": "log_01",
"user_query": "Can I cancel my annual subscription 4 months in and get money back?",
"retrieved_context": "Annual subscriptions are billed upfront. Customers can cancel auto-renewal at any time to prevent future billing cycles. Mid-term prorated refunds are not offered.",
"model_output": "No, you will not receive a refund for the remaining months. Canceling your annual subscription will only stop it from renewing for the next year.",
"ground_truth_verdict": "PASS",
"human_review_note": "PASS. Grounded: Sticks strictly to the provided context without adding unmentioned claims."
},
{
@patrickloeber
patrickloeber / racing-game.md
Last active May 22, 2026 13:41
racing-game with gemini

Racing game

Built with:

  • Gemini 3.5 Flash (Medium)
  • Antigravity 2.0

starter prompt:

@patrickloeber
patrickloeber / clear.sh
Created April 30, 2026 13:00
Clear notebook
jq '(.cells[] | select(.execution_count != null)).execution_count = null | (.cells[].outputs[]? | select(.execution_count != null)).execution_count = null' ./file.ipynb
@patrickloeber
patrickloeber / gemma-pi.md
Created April 28, 2026 08:13
gemma-pi.md
title How to run a local coding agent with Gemma 4 and Pi
spoiler Set up Gemma 4 running in LM Studio, connected to Pi as the terminal agent
date 2026-04-27
permalink /gemma-4-pi-agent/
tags
LLM

pi-agent

# Simple Generate Content
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-flash-latest:generateContent?key=${GEMINI_API_KEY}" \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"contents": [
{
"parts": [
{
"text": "Explain how AI works in one sentence"
@patrickloeber
patrickloeber / main.py
Last active September 23, 2025 08:16
Native audio example
"""
Install dependencies:
brew install portaudio
pip install -U google-genai pyaudio
Use headphones to avoid echo cancellation, then talk to Gemini.
"""
import asyncio
@patrickloeber
patrickloeber / README.md
Created September 4, 2025 11:31
How to build with Nano Banana: Complete Developer Tutorial

How to build with Nano Banana: Complete Developer Tutorial

Google has recently released Gemini 2.5 Flash Image, a powerful new model for image generation and editing, also known by its codename, Nano Banana. This model introduces state-of-the-art capabilities for creating and manipulating images, unlocking a wide range of new applications.

This guide provides a comprehensive walkthrough for developers looking to integrate Gemini 2.5 Flash Image aka Nano Banana into their applications using the Gemini Developer API.

This guide will cover:

  1. Using Nano Banana in AI Studio
  2. Project setup
@patrickloeber
patrickloeber / NanoBanana-JavaScript.md
Last active November 16, 2025 15:55
Use Nano Banana in JavaScript/TypeScript
@patrickloeber
patrickloeber / NanoBanana-Python.md
Last active September 14, 2025 04:10
Use Nano Banana in Python
@patrickloeber
patrickloeber / main.ts
Last active August 5, 2025 07:48
AI SDK + Gemini market researcher example
import { google } from "@ai-sdk/google";
import { z } from "zod";
import { generateText, generateObject } from "ai";
import "dotenv/config";
import puppeteer from "puppeteer";
import { ChartConfiguration } from "chart.js";
function createChartConfig({labels, data, label, type, colors,}: {
labels: string[];
data: number[];