RAG and embeddings
RAG and embeddings in the Carbium Library: 9 working Solana examples, among them Search query type router and Recency-ranked retrieval by slot.
- Search query type router SI0120
Classify a search string as a slot, signature, address or name, send each to the one RPC call that fits, and verify name hits on chain.
- Recency-ranked retrieval by slot SI0119
Pull the newest transactions for an address into SQLite and rank them for a model by log match and slot age.
- Log message embeddings SI0118
Index the program log lines of recent transactions in SQLite as embeddings, then search them by text and get transaction signatures back.
- Program bytecode similarity search SI0114
Fingerprint deployed Solana program bytecode and score how much of a reference program sits inside each candidate, to spot copies and forks.
- Slot-cited chain answers SI0079
Attach a slot, commitment and block time to every chain fact in a model's context, then recheck any citation with minContextSlot.
- Streamed transaction embeddings SI0073
Subscribe to one program's logs, turn each transaction into a text record and vector, store rows in SQLite and query nearest neighbours.
- On-chain IDL retrieval for models SI0060
Derive a program's Anchor IDL address, inflate the account and cut it into instruction, account and error chunks a model can retrieve.
- Copycat token name matcher SI0037
Compare a token's on-chain name and symbol with well-known mints after folding lookalike characters, and flag COPYCAT or CLOSE matches.
- Live account RAG SI0011
Retrieve accounts by embedding similarity, read them live in one getMultipleAccounts call and stamp the prompt with its slot.