Skip to content

Instantly share code, notes, and snippets.

View pmutua's full-sized avatar
🐲

Philip Mutua pmutua

🐲
View GitHub Profile
@pmutua
pmutua / llm_provider_fallback.py
Last active July 6, 2026 18:46
A reusable LLM inference module that connects to Ollama, OpenAI, or OpenRouter. It selects a preferred provider through .env and automatically falls back to another provider when the preferred service is unavailable or not configured.
"""LLM inference with automatic Ollama, OpenAI, and OpenRouter fallback.
Setup:
1. Install packages: py -m pip install -r requirements.txt
2. Create a .env file in this project's root directory.
3. Set AI_PROVIDER to the provider that should be tried first:
AI_PROVIDER=ollama # Local inference; no API key required.
AI_PROVIDER=openai # Requires OPENAI_API_KEY.
AI_PROVIDER=openrouter # Requires OPENROUTER_API_KEY.
@pmutua
pmutua / 2026-07-05-maintenance-update-for-daraja-mcp-server.md
Created July 5, 2026 12:00
Maintenance Update for Daraja MCP Server
title Maintenance Update for Daraja MCP Server
date 2026-07-05
author pmutua
tags
cloudflare-workers
mcp
model-context-protocol
mpesa
daraja
typescript
kv
workers-ai
vitest
circleci
codecov
commit d0e695d
type dev-diary

The Hook

title Arifa CI/CD and Mobile Fixes
date 2026-05-26
author pmutua
tags
react-native
expo
astro
cloudflare-workers
hono
d1
drizzle
kv
r2
rag
workers-ai
vectorize
turborepo
typescript
commit b053eea
type dev-diary

The Hook

title Arifa API and Web Enhancements
date 2026-05-26
author pmutua
tags
react-native
expo
astro
cloudflare-workers
hono
d1
drizzle
kv
r2
rag
workers-ai
vectorize
turborepo
typescript
commit 643b909
type dev-diary

The Hook

@pmutua
pmutua / 2026-05-26-arifa-development-diary-zod-validation-eslint-and-telegram-a-609e1cc.md
Created May 26, 2026 01:21
Arifa Development Diary -- Zod Validation, ESLint, and Telegram Analytics
title Arifa Development Diary -- Zod Validation, ESLint, and Telegram Analytics
date 2026-05-26
author pmutua
tags
react-native
expo
astro
cloudflare-workers
hono
d1
drizzle
kv
r2
rag
workers-ai
vectorize
turborepo
typescript
commit 609e1cc
type dev-diary

The Hook

@pmutua
pmutua / 2026-05-26-arifa-platform-updates-interest-onboarding-api-validation-an-ab445ba.md
Created May 26, 2026 01:20
Arifa Platform Updates -- Interest Onboarding, API Validation, and Fixes
title Arifa Platform Updates -- Interest Onboarding, API Validation, and Fixes
date 2026-05-26
author pmutua
tags
react-native
expo
astro
cloudflare-workers
hono
d1
drizzle
kv
r2
rag
workers-ai
vectorize
turborepo
typescript
commit ab445ba
type dev-diary

The Hook

@pmutua
pmutua / 2026-05-26-arifa-dev-diary-ai-issue-reporting-accessibility-and-context-a5ffd4c.md
Created May 26, 2026 01:19
Arifa Dev Diary -- AI Issue Reporting, Accessibility, and Contextual Actions
title Arifa Dev Diary -- AI Issue Reporting, Accessibility, and Contextual Actions
date 2026-05-26
author pmutua
tags
arifa
ai
accessibility
contextual-actions
commit a5ffd4c
type dev-diary

The Hook

title Arifa Platform Updates -- May 2026
date 2026-05-26
author pmutua
tags
arifa
news-aggregation
ai
cloudflare-workers
commit 5369c28
type dev-diary

The Hook

@pmutua
pmutua / 2026-05-26-arifa-updates-paystack-checkout-rate-limits-and-bug-fixes-d1208bb.md
Created May 26, 2026 01:18
Arifa Updates - Paystack Checkout, Rate Limits, and Bug Fixes
title Arifa Updates - Paystack Checkout, Rate Limits, and Bug Fixes
date 2026-05-26
author pmutua
tags
react-native
expo
astro
cloudflare-workers
hono
d1
drizzle
kv
r2
rag
workers-ai
vectorize
turborepo
typescript
commit d1208bb
type dev-diary

The Hook

@pmutua
pmutua / 2026-05-26-arifa-platform-updates-ai-cost-instrumentation-security-and--6b4b8ab.md
Created May 26, 2026 01:17
Arifa Platform Updates: AI Cost Instrumentation, Security, and Subscription Features
title Arifa Platform Updates: AI Cost Instrumentation, Security, and Subscription Features
date 2026-05-26
author pmutua
tags
react-native
expo
astro
cloudflare-workers
hono
d1
drizzle
kv
r2
rag
workers-ai
vectorize
turborepo
typescript
commit 6b4b8ab
type dev-diary

The Hook