Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
"""
Per-Module Usage Tracker for DSPy
Tracks token usage for individual sub-modules in multi-module DSPy programs.
Quick Start:
1. pip install dspy
2. export OPENAI_API_KEY="your-key"
3. Run: python per_module_usage_tracker.py
#!/usr/bin/env python3
"""
DSPy Parallel Chunk Streaming Demo (single file)
Setup (from repo root):
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install rich
pip install -e .
#!/usr/bin/env python3
"""
DSPy Streaming Demo - Self-Contained Script
This script demonstrates DSPy's streaming capabilities with tool calls and status messages.
It starts a server in the background, runs a demo query, and cleans up on exit.
Setup:
export OPENAI_API_KEY="sk-your-key"
python3 -m venv .venv
// Disclaimer: Initial version created using claude.ai.
// This modifier applies a blur effect to the bottom of a View.
// It is useful for giving a blur effect to the bottom of
// full-screen scrollable content.
import SwiftUI
struct ProgressiveBlurModifier: ViewModifier {
let height: CGFloat
let startColor: Color
@justanotheratom
justanotheratom / AutoScrollingTextView.swift
Last active July 13, 2024 17:58
SwiftUI - AutoScrollingTextView
// Initial version generated with help of claude.ai
// This is a ScrollView with following properties:
// - only child element is expected to be a Text view.
// - ScrollView height is limited to height of the Text view.
// - Max ScrollView height can be configured in terms of number of lines.
// - As text changes, it auto-scrolls to end of text.
import SwiftUI
struct AutoScrollingTextView<TextContent: View>: View {