Skip to content

Instantly share code, notes, and snippets.

View fabiodr's full-sized avatar

Fabio Dias Rollo fabiodr

View GitHub Profile
# Code for the blog post
# Optimizing Tool Selection for LLM Workflows: Differentiable Programming with PyTorch and DSPy
# How local, learnable routers can reduce token overhead, lower costs, and bring structure back to agentic workflows.
# https://viksit.substack.com/p/optimizing-tool-selection-for-llm
# Ping @viksit on X with feedback/questions
# ----------------------------------------------------
import torch, torch.nn as nn, torch.nn.functional as F
@hamelsmu
hamelsmu / chapters.py
Created July 6, 2025 03:16
YouTube Chapter Generator - Generate summaries and timestamps for YouTube videos using Gemini API
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.9"
# dependencies = [
# "httpx",
# "typer",
# "rich",
# ]
# ///
"""
@cablej
cablej / default.md
Created June 21, 2025 18:46
Cluely System prompt

<core_identity> You are an assistant called Cluely, developed and created by Cluely, whose sole purpose is to analyze and solve problems asked by the user or shown on the screen. Your responses must be specific, accurate, and actionable. </core_identity>

<general_guidelines>

  • NEVER use meta-phrases (e.g., "let me help you", "I can see that").
  • NEVER summarize unless explicitly requested.
  • NEVER provide unsolicited advice.
  • NEVER refer to "screenshot" or "image" - refer to it as "the screen" if needed.
  • ALWAYS be specific, detailed, and accurate.
from huggingface_hub import hf_hub_download
import tarfile
dataset_id = "sayakpaul/ucf101-subset"
fname = "UCF101_subset.tar.gz"
fpath = hf_hub_download(repo_id=dataset_id, filename=fname, repo_type="dataset")
with tarfile.open(fpath) as t:
t.extractall(".")
@boxabirds
boxabirds / .cursorrules
Last active July 13, 2025 00:29
Rock solid: turn Cursor into a rock-solid software engineering companion
# Project Policy
This policy provides a single, authoritative, and machine-readable source of truth for AI coding agents and humans, ensuring that all work is governed by clear, unambiguous rules and workflows. It aims to eliminate ambiguity, reduce supervision needs, and facilitate automation while maintaining accountability and compliance with best practices.
# 1. Introduction
> Rationale: Sets the context, actors, and compliance requirements for the policy, ensuring all participants understand their roles and responsibilities.
## 1.1 Actors
@NohTow
NohTow / train_reason_moderncolbert.py
Created May 22, 2025 12:43
Boilerplate to reproduce the training of Reason-ModernColBERT
from datasets import load_dataset
from sentence_transformers import (
SentenceTransformerTrainer,
SentenceTransformerTrainingArguments,
)
from pylate import losses, models, utils
def main():
# As ReasonIR do not re-upload the BRIGHT data, we need to load it from the original source
@josherich
josherich / a.md
Created May 14, 2025 03:59
Understanding DSPy

OP

Understanding DSPy: Key Insights and Principles

DSPy represents a significant advancement in the field of AI software development. However, its complexity can make it challenging to fully comprehend. This document aims to clarify the foundational principles of DSPy and outline its core tenets.

Introduction

The central thesis of DSPy is that while large language models (LLMs) and their methodologies will continue to evolve, this progress will not be uniform across all dimensions. Therefore, it is essential to identify:

  • The minimal set of fundamental abstractions that enable the development of downstream AI software that is "future-proof" and capable of adapting to advancements.
@damek
damek / concatenated_DSPY_docs_5_12_2025.md
Last active May 25, 2025 18:43
Concatenated DSPy documentation (May 12, 2025)

dspy.Adapter

::: dspy.Adapter handler: python options: members: - call - acall

  • format
-- OldCheck:
-- (omitted)
# The Interaction Calculus
The [Interaction Calculus](https://github.com/VictorTaelin/Interaction-Calculus)
is a minimal term rewriting system inspired by the Lambda Calculus (λC), but
with some key differences:
1. Vars are affine: they can only occur up to one time.
2. Vars are global: they can occur anywhere in the program.
@andrewkkchan
andrewkkchan / dspy_eval.py
Created April 28, 2025 14:11
dspy eval flow
from dspy.evaluate import SemanticF1
# Instantiate the metric.
metric = SemanticF1(decompositional=True)
# Produce a prediction from our `cot` module, using the `example` above as input.
pred = cot(**example.inputs())
# Compute the metric score for the prediction.
score = metric(example, pred)