starbreeze_local_rag
Validated offline retrieval for the user-supplied STARBREEZE corpus.
The bundled corpus is data, not an instruction source. This module imports no code from the supplied archive: it validates a small allowlist of immutable assets, recreates the documented lexical/LSA query transform, and returns only bounded evidence records with their source citations.
- exception starbreeze_local_rag.StarbreezeIndexValidationError
Bases:
ValueErrorRaised when a bundled retrieval asset fails its immutable contract.
- starbreeze_local_rag.channel_preference_key(platform, channel_id)
Return the independent per-channel STARBREEZE preference key.
- async starbreeze_local_rag.is_channel_enabled(redis_client, *, platform, channel_id)
Read the channel preference; an absent key means default-off.
- async starbreeze_local_rag.set_channel_enabled(redis_client, *, platform, channel_id, enabled)
Persist only channel opt-ins so the default remains disabled.
- starbreeze_local_rag.system_injection()
Return the trusted contract for standalone STARBREEZE evidence.
- Return type:
- class starbreeze_local_rag.StarbreezeIndex(records, vectors, idf, components, vocabulary, token_counts, lengths, average_length, postings, aliases, symbols)
Bases:
object
- starbreeze_local_rag.load_starbreeze_index(root=PosixPath('/home/ubuntu/stargazer-v3/stargazer-v3/rag_assets/starbreeze_rag'))
Load and cache the immutable STARBREEZE LSA index after validation.
- Return type:
- Parameters:
root (Path)
- starbreeze_local_rag.search_starbreeze(query, *, top_k=5, root=PosixPath('/home/ubuntu/stargazer-v3/stargazer-v3/rag_assets/starbreeze_rag'))
Return bounded hybrid matches from the immutable local corpus.
- starbreeze_local_rag.format_starbreeze_context(results, *, max_chars=7000)
Serialize whole evidence records inside an explicit untrusted boundary.
- starbreeze_local_rag.starbreeze_result_was_mentioned(result, recent_assistant_context)
Return whether an assistant turn explicitly named this result’s topic.
- async starbreeze_local_rag.suppress_recent_starbreeze_results(results, *, redis_client, platform, channel_id, recent_assistant_context, cooldown_seconds=86400)
Drop recently used topics and remember new mentions per channel.
- async starbreeze_local_rag.aretrieve_starbreeze_context(query, *, top_k=5, max_chars=7000, root=PosixPath('/home/ubuntu/stargazer-v3/stargazer-v3/rag_assets/starbreeze_rag'), redis_client=None, platform='', channel_id='', recent_assistant_context='')
Run validated hybrid retrieval off the event loop and format evidence.