* feat: allow chunks only in recall * feat: fetch chunks independently of max_tokens filtering Changes: - Chunks now fetched BEFORE max_tokens filtering (Step 5.5) - Implements batching: (max_chunk_tokens / retain_chunk_size) * 2 - Loop-based fetching until budget exhausted or no more chunks - Handles varying chunk sizes across documents - When max_tokens=0: returns 0 facts but still returns chunks - When max_tokens>0: backward compatible (chunks match filtered facts) Tests: - Added test_recall_chunks_independence.py with 5 comprehensive tests - Tests chunk independence, batching, ordering, and backward compat Docs: - Updated recall.mdx to explain new chunk behavior - Updated memory_engine.py docstrings Fixes chunk-related test failures by reordering chunks to match filtered facts when max_tokens > 0 (backward compatibility). * fix: fetch chunks after token filtering when max_tokens>0 Changes: - When max_tokens=0: fetch chunks BEFORE token filtering (new behavior) - When max_tokens>0: fetch chunks AFTER token filtering (backward compat) - This ensures chunk ordering matches filtered facts for max_tokens>0 - Fixes test failures in test_chunks_and_entities_follow_fact_order, test_chunk_fact_mapping, test_chunk_ordering_preservation, etc. The previous approach tried to reorder prefetched chunks, but that caused issues when the chunk budget was exhausted before all facts were processed. The new approach fetches chunks based on the correct fact set for each scenario. * fix: use ConfigResolver for bank-specific retain_chunk_size Fixes error: Field 'retain_chunk_size' is bank-configurable and cannot be accessed from global config. Changed from: - config.retain_chunk_size (global config, not allowed) To: - bank_config.retain_chunk_size (resolved from ConfigResolver) This ensures the correct chunk size is used for each bank, respecting any bank-specific overrides. * fix: correct Budget import in test_recall_chunks_independence Changed from: - from hindsight_api.engine.interface import Budget (incorrect) To: - from hindsight_api.engine.memory_engine import Budget (correct) This fixes the ImportError that was preventing the tests from running. * fix: prevent infinite loop in chunk fetching and improve test content - Add max(1, ...) to estimated_batch_size to prevent division resulting in 0 - Update test content to use more substantial examples that generate facts - Add request_context parameter to all retain_async and recall_async test calls * refactor: simplify chunk fetching to always use pre-filtering approach Remove backward compatibility code that fetched chunks after token filtering. Now chunks are always fetched from top-scored results before max_tokens filtering, regardless of max_tokens value. This simplifies the code by: - Removing duplicate chunk fetching logic - Eliminating conditional behavior based on max_tokens - Making chunk fetching behavior consistent and predictable Chunks are still fetched in batches and respect max_chunk_tokens limit. |
||
|---|---|---|
| .. | ||
| blog | ||
| docs | ||
| examples | ||
| src | ||
| static | ||
| versioned_docs | ||
| versioned_sidebars | ||
| .gitignore | ||
| docusaurus.config.ts | ||
| package.json | ||
| README.md | ||
| sidebars.ts | ||
| tsconfig.json | ||
| versions.json | ||
Website
This website is built using Docusaurus, a modern static website generator.
Installation
npm install
Local Development
npm start
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
Build
npm run build
This command generates static content into the build directory and can be served using any static contents hosting service.
Deployment
Using SSH:
USE_SSH=true npm run deploy
Not using SSH:
GIT_USER=<Your GitHub username> npm run deploy
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the gh-pages branch.