release: v0.17.7 — SemanticCache, Prompt Compression, Conversation Branching#32
Merged
johnnichev merged 2 commits intomainfrom Mar 25, 2026
Merged
release: v0.17.7 — SemanticCache, Prompt Compression, Conversation Branching#32johnnichev merged 2 commits intomainfrom
johnnichev merged 2 commits intomainfrom
Conversation
…hing SemanticCache (cache_semantic.py): drop-in replacement for InMemoryCache that serves hits for paraphrased queries using cosine similarity over embedding vectors. Configurable threshold, LRU eviction, TTL, thread-safe. Prompt Compression: fires before each LLM call when token fill-rate exceeds compress_threshold; summarises old messages into a [Compressed context] system message while keeping compress_keep_recent turns verbatim. Adds StepType.PROMPT_COMPRESSED and on_prompt_compressed observer event. Conversation Branching: ConversationMemory.branch() returns an independent snapshot; SessionStore.branch(src, dst) forks persisted sessions across all three backends (JSON, SQLite, Redis). Raises ValueError for missing source. Stats: 55 new tests (2275 total), 3 examples (52-54), StepType 16→17, observer events 31→32 sync / 28→29 async.
Update observer event count 28→32, test count 2220→2275, add SemanticCache / Prompt Compression / Conversation Branching to docs/index.md feature table.
johnnichev
added a commit
that referenced
this pull request
Apr 7, 2026
Three small fixes from the latest review pass. 1. **pip install terminal full-width on desktop** (Image #32): Removed `max-width: 440px` from `.terminal-install`. The terminal now spans 100% of the hero-content column, matching the width of the "Try the Builder" + "Read the Docs" button row directly below it. The hero grid (1fr 1fr split until 1024px) still constrains the column width itself, so this doesn't span the entire viewport on wide screens — it spans the column where the buttons live, which is what aligns them. 2. **SVG flow lines lingering after nodes fade out** (Image #33): Root cause: in the hero flow scene transitions, nodes fade via CSS `transition: opacity 0.3s` when `el.style.opacity = '0'`, but the SVG `<line>` elements (and `<circle>` pulses inside the same `<svg>`) had no fade animation — they stayed fully opaque until the next scene's `buildScene()` cleared the SVG via `svg.textContent = ''`. The visible result: nodes vanish at t=300ms, lines hang in the air alone for ~100ms, then snap to the next scene at t=400ms. Fix: added `transition: opacity 0.3s var(--ease)` to `.hf-svg`, and in playScene's "all done" handler set `svg.style.opacity = '0'` at the same time as `el.style.opacity = '0'` on the nodes. In buildScene, reset `svg.style.opacity = '1'` before drawing the next scene's lines so the new content fades in cleanly. Lines and nodes now vanish on the same curve. 3. **CONTRIBUTING.md stale facts** (user pointed out the version): The user noticed v0.19.2 in the header. While I was there I caught several other stale items and fixed them in the same pass: - Header version: v0.19.2 → v0.20.1 (current) - Header Python: "3.9+" → "3.9 – 3.13" (matches actual classifiers) - Header test status: "100%" → "95% coverage" (matches reality) - Project structure: "24 pre-built tools" → "33 pre-built tools" (verified via `grep -c '^@tool' src/selectools/toolbox/*.py`) - Project structure: "61 numbered examples (01–61)" → "88 numbered examples" (verified via `find examples -maxdepth 1 -name '*.py' | wc -l`) - Release script examples: 0.5.1 → 0.20.2 (current minor + 1) - Test command: `python tests/test_framework.py` → `pytest tests/` (the legacy single-file runner doesn't exist anymore) - Provider test path: `tests/test_framework.py` → `tests/providers/ test_your_provider.py` (current convention) - Section header: "Adding RAG Features (New in v0.8.0!)" → "Adding RAG Features" (v0.8.0 was many releases ago) The biggest substantive fix: rewrote the "Adding a New Tool" example. The old example used `Tool(name=..., parameters=[ ToolParameter(...)])`, which is the legacy class-based API. Selectools has used the `@tool()` decorator pattern for many versions now, where the function signature and docstring are introspected automatically. The old example was actively misleading new contributors into using a deprecated API. New example shows the modern decorator pattern with proper docstring conventions. What's NOT in this PR: - Full rewrite of the project structure block — only the genuinely stale numeric facts (24, 61) were fixed; the listed file names are still mostly accurate and a full architectural audit is out of scope for "the version is outdated" - No CHANGELOG entry — these are doc fixes, not user-facing code - No version bump
13 tasks
johnnichev
added a commit
that referenced
this pull request
Apr 7, 2026
Three small fixes from the latest review pass. 1. **pip install terminal full-width on desktop** (Image #32): Removed `max-width: 440px` from `.terminal-install`. The terminal now spans 100% of the hero-content column, matching the width of the "Try the Builder" + "Read the Docs" button row directly below it. The hero grid (1fr 1fr split until 1024px) still constrains the column width itself, so this doesn't span the entire viewport on wide screens — it spans the column where the buttons live, which is what aligns them. 2. **SVG flow lines lingering after nodes fade out** (Image #33): Root cause: in the hero flow scene transitions, nodes fade via CSS `transition: opacity 0.3s` when `el.style.opacity = '0'`, but the SVG `<line>` elements (and `<circle>` pulses inside the same `<svg>`) had no fade animation — they stayed fully opaque until the next scene's `buildScene()` cleared the SVG via `svg.textContent = ''`. The visible result: nodes vanish at t=300ms, lines hang in the air alone for ~100ms, then snap to the next scene at t=400ms. Fix: added `transition: opacity 0.3s var(--ease)` to `.hf-svg`, and in playScene's "all done" handler set `svg.style.opacity = '0'` at the same time as `el.style.opacity = '0'` on the nodes. In buildScene, reset `svg.style.opacity = '1'` before drawing the next scene's lines so the new content fades in cleanly. Lines and nodes now vanish on the same curve. 3. **CONTRIBUTING.md stale facts** (user pointed out the version): The user noticed v0.19.2 in the header. While I was there I caught several other stale items and fixed them in the same pass: - Header version: v0.19.2 → v0.20.1 (current) - Header Python: "3.9+" → "3.9 – 3.13" (matches actual classifiers) - Header test status: "100%" → "95% coverage" (matches reality) - Project structure: "24 pre-built tools" → "33 pre-built tools" (verified via `grep -c '^@tool' src/selectools/toolbox/*.py`) - Project structure: "61 numbered examples (01–61)" → "88 numbered examples" (verified via `find examples -maxdepth 1 -name '*.py' | wc -l`) - Release script examples: 0.5.1 → 0.20.2 (current minor + 1) - Test command: `python tests/test_framework.py` → `pytest tests/` (the legacy single-file runner doesn't exist anymore) - Provider test path: `tests/test_framework.py` → `tests/providers/ test_your_provider.py` (current convention) - Section header: "Adding RAG Features (New in v0.8.0!)" → "Adding RAG Features" (v0.8.0 was many releases ago) The biggest substantive fix: rewrote the "Adding a New Tool" example. The old example used `Tool(name=..., parameters=[ ToolParameter(...)])`, which is the legacy class-based API. Selectools has used the `@tool()` decorator pattern for many versions now, where the function signature and docstring are introspected automatically. The old example was actively misleading new contributors into using a deprecated API. New example shows the modern decorator pattern with proper docstring conventions. What's NOT in this PR: - Full rewrite of the project structure block — only the genuinely stale numeric facts (24, 61) were fixed; the listed file names are still mostly accurate and a full architectural audit is out of scope for "the version is outdated" - No CHANGELOG entry — these are doc fixes, not user-facing code - No version bump
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
InMemoryCachethat serves cache hits for paraphrased queries using cosine similarity over embeddings. Configurable threshold, LRU eviction, TTL, thread-safe, pure-Python cosine (no NumPy). Exported asselectools.SemanticCache.compress_context / compress_threshold / compress_keep_recentonAgentConfig. Fires before each LLM call when token fill-rate exceeds threshold; summarises old messages into[Compressed context]system message, leavingself.memoryuntouched. NewStepType.PROMPT_COMPRESSED+on_prompt_compressedobserver event.ConversationMemory.branch()returns an independent snapshot.SessionStore.branch(src, dst)forks persisted sessions across all three backends (JSON, SQLite, Redis). RaisesValueErrorfor missing source.Stats
Checklist
__init__.pyandpyproject.toml(0.17.6 → 0.17.7)