Knowledge retrieval

AI resource library: upload the documents, ask in plain language, get cited answers

Every established business has the same problem hiding in a shared drive: the answer exists, in a PDF, from 2019, that nobody can find. Training manuals, supplier terms, spec sheets, SOPs, price lists. Staff ask a colleague instead, and the colleague guesses.

The resource library turns that pile into something you can question. Documents are parsed, split, embedded and indexed, and answers are retrieved with a hybrid search that combines meaning with exact wording, because a policy question needs semantics and a part number needs literal matching.

GoGee feature series · 15 of 33

How it's actually built

Formats
PDF, DOCX, XLSX, CSV, text, HTML and crawled URLs
Chunking
1,200 characters with 150-character overlap, on sentence or paragraph breaks
Embedding model
openai/text-embedding-3-small at 1,536 dimensions
Index
HNSW cosine index on the chunk vector
Retrieval
Hybrid vector plus full text, fused by reciprocal rank fusion
Reranker
openai/gpt-5.4-mini scoring candidates 0–10
Document Q&A pipeline
  1. 01Input

    Documents

    PDF, DOCX, XLSX, CSV, text, HTML and crawled URLs

  2. 02Deterministic

    Chunk

    1,200 characters with 150-character overlap on sentence breaks

  3. 03Database

    Hybrid retrieval

    text-embedding-3-small at 1,536 dims plus full text, fused by RRF

  4. 04AI

    Rerank

    gpt-5.4-mini scores candidates 0–10

  5. 05Output

    Answer with sources

    Cited back to the source document

Guardrails and fallbacks

  • HNSW cosine index on chunk vectors
  • Answers restricted to your own library

AI resource library search, data flow, generated from the shared GoGee feature diagram template.

Ingestion: from a file to searchable chunks

Uploads are parsed by format, PDF, Word, spreadsheets, CSV, plain text and HTML, or a URL is fetched and stripped to text. URL discovery is restricted to an administrator-managed domain allow-list, so a crawl cannot wander off your own material.

Text is split into overlapping chunks of about 1,200 characters with 150 characters of overlap, preferring paragraph or sentence boundaries when the cut point is already past halfway. Overlap is what stops an answer being lost across a page break, the classic reason naive document search misses the one paragraph that mattered.

Each resource tracks its own status through pending, parsing, ready or failed with an error message, along with its chunk count, tags and scopes. Files are stored in a dedicated bucket and served through signed URLs.

Hybrid retrieval, because meaning alone is not enough

Chunks are embedded at 1,536 dimensions and indexed for cosine similarity. Retrieval then runs two searches: vector similarity for meaning, and Postgres full-text ranking for literal wording. The two ranked lists are fused with reciprocal rank fusion rather than one being used as a tiebreaker.

This is the difference between "what is our policy on damaged returns" and "clause 7.3". A pure vector search handles the first and fumbles the second. Hybrid handles both, which is what document Q&A in a real business actually requires.

  • Vector candidates and full-text candidates retrieved in parallel
  • Ranks fused rather than one signal overriding the other
  • Candidate pools deliberately oversized before reranking
  • Six chunks returned to the answering model by default

Reranking and scoped material

When the hybrid pass returns more candidates than needed, a reranking model scores each chunk from zero to ten for relevance to the question, and only the best survive. Retrieving twenty and keeping six produces materially better answers than retrieving six and hoping.

Resources also carry scopes, so a document can be made available to specific AI surfaces only, the internal assistant, support chat, product copy, category copy, brand copy or assessment work. Supplier contracts can inform staff answers without ever being reachable by a public-facing assistant.

Citations and a retrieval log you can audit

Retrieved material is formatted into a numbered reference block with each source's title and URL, and the answering model is instructed to cite those sources. Citation is a prompt-level instruction over verified retrieved text, the text is real and traceable, which is the part that matters when someone challenges an answer.

Every retrieval is logged: the user, the calling feature, the scope, the query, the mode, whether reranking ran, the candidate set, the final chunk identifiers, latency and any error. That log is browsable in the admin, which means when someone says the AI gave a bad answer, you can see exactly what it was given.

Why this beats a shared drive and a search box

Because the same infrastructure serves several surfaces. One ingested document can inform staff answers, support chat and content generation, scoped separately, with one audit trail and one place to remove a document when it is superseded.

For franchise networks this is usually the highest-value module we deploy: consistent answers across every branch, with visibility into what people are actually asking.

Questions we get asked

Which file types can we upload?

PDF, Word documents, spreadsheets, CSV, plain text and HTML, plus pages fetched from an approved list of domains.

How do we know the answer came from our documents?

Answers reference numbered sources with titles and links, and every retrieval is logged with the exact chunks that were supplied.

Can some documents stay internal?

Yes. Each resource carries scopes controlling which AI surfaces may retrieve it, so internal material never reaches a public assistant.