Skip to content

Instantly share code, notes, and snippets.

View AFirooz's full-sized avatar

Ali Firooz AFirooz

View GitHub Profile
@AFirooz
AFirooz / ADK-to-LangChain.md
Last active December 26, 2025 13:32
Prompts

Instructions

You are an expert Python engineer specializing in agentic systems. Convert the provided Google ADK (Agent Development Kit) notebook or Python script into an equivalent implementation using the latest LangChain and LangGraph. Prioritize simplicity, clarity, and notebook-friendly structure. Use PydanticAI only when it materially improves correctness (typed/validated structured outputs).

Primary goals

  • Preserve functional behavior and control-flow semantics of the original ADK program (agents, tools, state, loops/parallelism, termination criteria).
  • Remove ADK dependencies entirely (assume not needed).
  • Keep the converted code as simple as possible while remaining correct.

How to remove ALL empty lines

  1. Open Find (Ctrl+H), check "Use Regular Expression".
  2. Find: ^\s*\r?\n (matches empty or whitespace-only lines).
  3. Replace with: Leave empty.
  4. Click "Replace All".

Grouping results and removing unwanted ones

Here we want to scrape product name, price and rating from ebay product pages:

url = 'https://www.ebay.com/itm/Sony-PlayStation-4-PS4-Pro-1TB-4K-Console-Black/203084236670' 

wanted_list = ['Sony PlayStation 4 PS4 Pro 1TB 4K Console - Black', 'US $349.99', '4.8'] 

scraper.build(url, wanted_list)
@AFirooz
AFirooz / Intro.md
Last active June 16, 2025 17:01
Vector Stores

Rules of Thumb

  1. For Small, Fast Retrieval (≤10M vectors) → Use FAISS or Annoy (in-memory)
  2. For prototyping with serverless persistent search → Use Chroma DB (duckdb+parquet)
  3. For On-Premise Search with Persistence → Use Milvus, Weaviate, or Qdrant
  4. For Fully Managed, Scalable Search (Cloud) → Use Pinecone or Weaviate Cloud Service (WCS)
  5. For Multi-Modal Hybrid Search (keywords + Vectors) → Use Weaviate, Qdrant, Elasticsearch, or MongoDB.
  6. For Large-Scale AI Pipelines → Use Milvus, Weaviate, or a hybrid FAISS+OLTP Database (e.g. Postgres) setup.

@AFirooz
AFirooz / v1.0 - Raw Prompt.md
Last active June 11, 2025 15:57
NotebookLM Audio Gen Prompts
  • Start by providing an overview of the topics you will cover. If they’re more than 10 topics, combine them into sections and only mention the sections.
  • Your target audience is an intermediate GenAI engineers.
  • Be deeply technical and don't read any equations.
  • Always mention what an acronym stands for and read them letter by letter (e.g. LLM should be read one-by-one, but InstructGPT, DeepSeek, etc. should be read as whole words).
  • less back-channeling
  • Always provide a summary of a technique you mention for the first time.
@AFirooz
AFirooz / diagrams.md
Last active May 7, 2025 20:21 — forked from blackcater/diagrams.md
Markdown Diagrams

Diagrams

Markdown Preview Enhanced supports rendering flow charts, sequence diagrams, mermaid, PlantUML, WaveDrom, GraphViz, Vega & Vega-lite, Ditaa diagrams. You can also render TikZ, Python Matplotlib, Plotly and all sorts of other graphs and diagrams by using Code Chunk.

Please note that some diagrams don't work well with file exports such as PDF, pandoc, etc.

Flow Charts

This feature is powered by flowchart.js.

@AFirooz
AFirooz / cancerlog.py
Last active April 29, 2025 05:30
Misc Test
# =================================================================================
# Name : cancerlog.py
# Author : Ali Firooz
# Version : 0.0.1
# Copyright : Copyright © 2023 Ali Firooz. All Rights Reserved.
# Description : based on: https://ankitbko.github.io/blog/2021/04/logging-in-python/
# Usage :
# =================================================================================
# TODO:
# 1. Add functionality to log other levels (info, warning, error, critical)
@AFirooz
AFirooz / SMOTE.ipynb
Last active January 8, 2026 14:44
Misc Learn
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Topic: Connection & Cursor
# this doesn't work in Jupyter notebooks!
# https://aiomysql.readthedocs.io/en/stable/cursors.html
# #############################################################################################################
# A cursor for connection.
# Allows Python code to execute MySQL command in a database session. Cursors are created by the `Connection.cursor()`:
# They are bound to the connection for the entire lifetime and all the commands are executed in the context of the database
# session wrapped by the connection.
#
# Cursors that are created from the same connection are not isolated,
@AFirooz
AFirooz / list-groups.py
Last active April 29, 2025 05:12
Poetry Scripts
#! /usr/bin/env python3
# =================================================================================
# Name : list-groups.py
# Author : Ali Firooz
# Version : 0.0.2
# Copyright : Copyright © 2025 Ali Firooz. All Rights Reserved.
# Description : Adding the function of listing available groups in poetry.
# Can be used by running `$ poetry run groups` or
# `$ poetry run groups "<pyproject.toml path>"`.