Third-party toolUpdated 2026.11.15

LlamaIndex Tutorial: Trace Documents With MockEmbedding

LlamaIndex can turn documents into retrievable nodes.

Aaron recommends Open official GitHub

LlamaIndex can turn documents into retrievable nodes. This example installs llama-index-core and uses its bundled MockEmbedding to index two synthetic documents. It checks that retrieval preserves the original document IDs and text.

What the isolated test checked

Both documents were retrieved with scores of 1.0. Those scores come from synthetic embeddings and say nothing about semantic ranking quality. This test is useful for finding missing documents, lost source IDs or missing text before connecting a real embedding model.

The following is the recorded synthetic output, not a model benchmark.

{
  "nodes": [
    {
      "id": "note32",
      "text": "Dispatch NOTE-32 leaves at 16:45.",
      "score": 1.0
    },
    {
      "id": "note31",
      "text": "Dispatch NOTE-31 leaves at 08:30.",
      "score": 1.0
    }
  ]
}

Reproduce the small task

The recorded runtime was Linux with Python 3.12. Installation requires public package downloads; execution was offline. Windows shell behavior was not tested. Use a disposable environment for the example.

python -m pip install llama-index-core==0.14.26
import sys,json,traceback,importlib.metadata as meta,pathlib,asyncio,subprocess,os
SLUG='llama-index'
def emit(package,checks,observations,**kw):
    print(json.dumps({'checks':checks,'observations':observations},ensure_ascii=False,default=str,indent=2))
def llama():
    from llama_index.core import Document,Settings,VectorStoreIndex
    from llama_index.core.embeddings import MockEmbedding
    Settings.embed_model=MockEmbedding(embed_dim=4);Settings.llm=None
    idx=VectorStoreIndex.from_documents([Document(text='Dispatch NOTE-31 leaves at 08:30.',id_='note31'),Document(text='Dispatch NOTE-32 leaves at 16:45.',id_='note32')]);r=idx.as_retriever(similarity_top_k=2).retrieve('dispatch');ids=[x.node.ref_doc_id for x in r]
    emit('llama-index-core',dict(two_nodes=len(r)==2,source_ids=set(ids)=={'note31','note32'},text_retained=any('08:30' in x.node.text for x in r)),dict(nodes=[{'id':x.node.ref_doc_id,'text':x.node.text,'score':x.score} for x in r]),scope='Document ingestion and retriever wiring with built-in MockEmbedding. Scores are synthetic, not relevance evidence. No answer generation.')
llama()

Limits and untested behavior

The LLM is disabled. Answer generation, real embeddings, external vector stores, document-format parsing and large indexes were not tested.

Other capabilities described in the pinned official documentation below were not locally tested. Source availability alone does not establish free hosted execution or free model calls.

Sources and test record

Codex ran the synthetic task in a non-root, network-disabled container without publishing credentials or private inputs. This is not a claim that the site owner personally tested the tool.

Tested package: 0.14.26. Documentation commit: 99d7433f6f71. The registry package and README snapshot are separately pinned, not assumed identical. Test date: 2026-11-15.

Related reading

Subscribe to AI tool picks and practical advice

Get worthwhile tool picks, test findings and important updates in your inbox.

Get a monthly-updated list of AI tools and Skills right away. We email when there are worthwhile tool picks, test findings or important updates. Unsubscribe anytime. Privacy

Almost done: check your inboxClick the button in the confirmation email and you will get the download link for the tool list. If you do not see it, check your spam or Promotions folder.

Or follow us on: