Skip to content

Instantly share code, notes, and snippets.

View ehzawad's full-sized avatar
🎃
Wasteland Baby!

ehzawad ehzawad

🎃
Wasteland Baby!
View GitHub Profile
@ehzawad
ehzawad / specs.md
Created October 10, 2025 20:56
Specifications

Bangladesh Election Commission NID Chatbot - Complete Specification

System Overview

The Bangladesh Election Commission NID chatbot is a conversational AI system that helps citizens with National Identity Card (NID) and voter registration queries. The system operates in two distinct modes:

  1. Form Mode (9 specialized tags) - Multi-turn conversations requiring country information
  2. FAQ Mode (201 other tags) - Simple question-answer responses

Problem Decomposition: Bengali RAG-Based Chatbot for Election Commission

Project Overview

A production-ready Bengali conversational AI system for National Identity Card (NID) and voter registration queries. The system uses semantic search (RAG) with multi-turn form conversations, interruption handling, and state management.

Core Challenge: Build an intelligent chatbot that understands Bengali queries about NID/voter registration, retrieves relevant answers from a knowledge base, and handles complex multi-turn conversations like form filling.

The Tentative Approach

import os
import sys
import numpy as np
import psutil
import torch
def get_memory_info():
"""Get current memory usage of the process."""
@ehzawad
ehzawad / idea-brainstorming.md
Created September 16, 2025 12:35
idea-brainstorming.md

● 🔍 YOUR PROBLEMS (Comprehensive Summary)

Your core issue was that while your Bengali Legal RAG system achieved 94.7% test accuracy using EmbeddingGemma-300M, it suffered from four critical limitations that threatened scalability and real-world usability. First, Bengali linguistic confusion where syntactically similar legal terms like "khatian_correction" vs "khatian_copy" caused 11 classification errors due to EmbeddingGemma's 768D embedding space limitations and under-representation of Bengali legal terminology in multilingual training. Second, rigid threshold problems where your 0.932 FAISS threshold resulted in 0% complex query acceptance, while Linear Head's 0.60 threshold only achieved 14.3% acceptance - both failing to handle compound Bengali queries like "নামজারি করতে কি কি কাগজপত্র লাগে এবং কত টাকা লাগবে?" (documents + fee questions). Third, scalability anxiety about expanding from 14 tags to 200-300+ tags (evidenced by the EC dataset's 221 tags), where current O(n) FAISS complexity wou

examples/basic/hello_world.py
examples/basic/hello_world_gpt_5.py
examples/basic/hello_world_gpt_oss.py
examples/basic/stream_text.py
examples/basic/stream_items.py
examples/basic/stream_function_call_args.py
examples/basic/dynamic_system_prompt.py
examples/basic/prompt_template.py
examples/basic/agent_lifecycle_example.py
examples/basic/lifecycle_example.py
# PyTorch 2.x; Apple Silicon; runs on MPS if available, else CPU.
import math
import torch
if torch.backends.mps.is_available(): # official API to detect MPS
device = torch.device("mps")
else:
device = torch.device("cpu")
# --- Quantization helpers (per-tensor, symmetric) ---
import React, { useMemo, useRef, useState, useEffect } from "react";
// Simple FAISS-like toy: IndexFlatL2
class IndexFlatL2 {
constructor(d) {
this.d = d; // dimensionality
this.vectors = []; // each item: {id, x: number[], label?: string}
this._nextId = 1;
}
add(vecs) {

Looking at your GeForce RTX 2050 laptop GPU, here's what I recommend:

Best Driver Options for RTX 2050 Laptop:

1. nvidia-driver-575-open (RECOMMENDED)

  • Version: 575.64.03
  • Why: Ubuntu specifically recommends this for your RTX 2050
  • Benefits for laptops: the driver also added NVIDIA Dynamic Boost support for Linux notebooks running on battery power
  • CUDA: Fully compatible with CUDA 12.9
#!/usr/bin/env python3
"""
Run GPT-OSS using the Metal implementation for Apple Silicon
This requires downloading and converting the model first.
"""
import os
import subprocess
import sys
// file: vecadd_test.cu
#include <cstdio>
#include <cstdlib>
#define CUDA_CHECK(call) do { \
cudaError_t err = call; \
if (err != cudaSuccess) { \
fprintf(stderr, "CUDA error %s:%d: %s\n", \
__FILE__, __LINE__, cudaGetErrorString(err)); \
exit(EXIT_FAILURE); \