This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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 { |