How to Connect ChatGPT to a Company Knowledge Base
Ask ChatGPT a question about your own product and it will answer with total confidence, and it will be wrong.
You connect ChatGPT to a company knowledge base by placing Sanity Context between the model and your content as the retrieval layer, indexing documentation, tickets, and wikis into structured, queryable records that ChatGPT pulls from at query time instead of guessing from training data. That connection is what turns confident wrong answers into sourced ones. What follows covers how the plumbing works, where naive setups leak, and what rules govern what the agent is allowed to say.

Why ChatGPT hallucinates against your own content
A base model like GPT-4 knows the public internet up to a cutoff date. It knows nothing about your pricing tiers, your SKU catalog, your support runbooks, or the policy your legal team rewrote last Tuesday. When you ask it a question that lives inside that private knowledge, it does not say "I do not know." It generates the most statistically plausible answer, which is often a confident fabrication that looks exactly like a real answer.
The standard fix is retrieval-augmented generation: before the model answers, you fetch the relevant passages from your own content and paste them into the prompt as context. Done well, the model quotes your facts instead of inventing them. Done poorly, retrieval becomes the new failure point. If the fetch returns the wrong passage, an outdated passage, or a passage stripped of the structure that made it meaningful, the model faithfully summarizes garbage. Garbage retrieval produces confident garbage answers, and now you have a hallucination that is harder to catch because it is wrapped in a citation.
The uncomfortable truth is that most "ChatGPT on your docs" projects fail at the content layer, not the model layer. The knowledge is scattered across a wiki, a PDF export, a support database, and a marketing website. It has no shared shape. It goes stale the moment someone edits the source without re-indexing. Solving hallucination is therefore mostly a content-operations problem: get the right facts, in the right structure, kept current, in front of the model at query time. That is the frame the rest of this guide uses.
Connect ChatGPT: the plumbing, and where it leaks
The mechanical version of connecting ChatGPT to a knowledge base has three moving parts. First, a retrieval layer that takes the user's question and returns the most relevant chunks of your content. Second, a prompt-assembly step that stitches those chunks into the context window with instructions about how to use them. Third, the model call itself, either the OpenAI API directly or through a tool or function-calling interface so the agent can decide when to go fetch.
Modern agents standardize that fetch through the Model Context Protocol. Instead of hard-coding a bespoke integration, ChatGPT (or any MCP-aware client) connects to an endpoint that exposes your knowledge as a callable tool. The Sanity Context MCP endpoint is what production agents connect to in order to query Sanity Context, which means the retrieval path is a first-class, governed interface rather than a script someone wired up and forgot.
Each of the three parts leaks in a predictable way. The retrieval layer leaks when it is keyword-only and misses a semantically related passage, or embedding-only and misses an exact-match part number. Prompt assembly leaks when it dumps too much context and the model loses the thread, or too little and the answer is thin. The model call leaks when there is no governance on what the assembled instructions tell the agent to do. The point is that connecting ChatGPT is easy; connecting it so the answers stay correct, current, and in-policy is the actual engineering work, and it lives almost entirely upstream of the model in how your content is stored and retrieved.
Hybrid retrieval beats keyword or vector alone
Semantic search using embeddings is excellent at understanding intent. Ask "how do I get my money back" and it will surface the refund policy even though the word "refund" never appeared in your question. But embeddings are weak precisely where keywords are strong: exact identifiers, part numbers, error codes, product names, and version strings. Search for "error E-4021" with pure vector similarity and you may get a cluster of vaguely-related errors instead of the exact one. Keyword search nails the identifier but misses the paraphrase. Each approach fails on the other's home turf.
Hybrid retrieval runs both and blends the scores, so the exact-match signal and the semantic signal reinforce each other. In Sanity's Content Lake this is native, not a second system you assemble. A single GROQ query blends `text::semanticSimilarity()` for the embedding signal with a BM25-style `match()` for the keyword signal, and you tune the blend with `score()` and `boost()` so identifiers and titles carry the weight they deserve. One query, one store, both signals.
That matters operationally because the alternative is running a vector database next to your content store and reconciling two sources of truth every time content changes. The blended-query approach keeps retrieval logic where the content already lives. When a support engineer asks about "E-4021 on the v3 firmware," the keyword clause locks onto the error code and firmware version while the semantic clause pulls in the conceptually related troubleshooting steps, and the agent gets a passage that is both exactly right and contextually complete.
Fresh embeddings without a second data pipeline
The failure mode nobody demos is staleness. You index your knowledge base on Monday, the docs team ships a correction on Wednesday, and until someone re-runs the embedding job the agent keeps answering with Monday's now-wrong facts. In a bolt-on stack, embeddings live in a separate vector database with its own ingestion pipeline, so every content edit has to trigger a re-embed, a re-upload, and a reconciliation. That pipeline is a standing operational cost and a standing source of drift.
With Sanity, dataset embeddings are tied to the content itself. When an editor changes a document, the embeddings update within minutes, because they are a property of the content rather than a copy of it living in a foreign system. There is no separate vector pipeline to build, monitor, or debug at three in the morning when retrieval quality silently degrades. The agent's view of the truth moves when the truth moves.
This is the difference between a headless CMS with an AI feature bolted on and a Content Operating System designed for AI from the ground up. Legacy systems create silos: content in one place, embeddings in another, a brittle sync in between. Sanity provides a shared foundation where retrieval reads from the same governed content editors write to. For a knowledge base that changes daily, which is every real company's knowledge base, freshness is not a nice-to-have. It is the line between an agent your team trusts and one they route around because it keeps citing last quarter's policy.
Turning PDFs, wikis, and support tickets into agent-readable knowledge
Real company knowledge does not arrive as a tidy set of Markdown files. It is a PDF handbook exported from a legal review, a Confluence-style wiki that three teams edit, a support database full of resolved tickets, and a marketing website that is the only place a certain feature is described accurately. An agent cannot reason over that heap in its native mess; each source has a different shape, and the structure that makes a support ticket meaningful (product, severity, resolution) is exactly what a naive text-dump throws away.
Sanity's Knowledge Bases turn datasets, websites, PDFs, and support databases into agent-readable documents that share the Sanity Context retrieval path. Instead of standing up a separate ingestion tool per source, the sources become structured content in the Content Lake, queryable with the same GROQ hybrid retrieval and covered by the same freshness guarantees. A PDF becomes documents you can query by section; a support database becomes tickets you can filter by product and status before you ever hand a passage to the model.
Structure is what makes retrieval precise. When the knowledge is modeled, the agent can be told to retrieve only from published, in-policy documents, only in the user's language, or only from the current product version. A flat text index cannot make those distinctions because it threw the metadata away at ingestion. Modeling your business up front, the first of Sanity's three pillars, is what lets the agent answer "what is the return window for EU orders on the Pro plan" with the one correct passage instead of a plausible average of five contradictory ones.
Governing what the agent is allowed to say
A knowledge base that answers correctly can still answer dangerously. It can surface an internal-only pricing note to a public chatbot, quote a policy that is drafted but not yet approved, or confidently repeat a passage that legal flagged for removal. Retrieval accuracy and governance are different problems, and the second one is where enterprise deployments live or die. The question is not only "can the agent find the right answer" but "is the agent permitted to say this, to this person, right now."
Sanity puts agent behavior under the same editorial controls as the website. Studio Workspaces, Roles & Permissions, and Audit logs mean the people who own the content own what the agent can see and repeat, with a record of who changed what. Content Releases let a team stage agent behavior the way they stage a site launch: draft the new knowledge, review it, schedule it, and roll it back if it misbehaves, without a code deploy. Agent Actions provide schema-aware APIs for the generate, transform, and translate workflows the agent runs, so those operations respect the same content model rather than free-typing into a text field.
On compliance, the substrate matters as much as the workflow. Sanity is SOC 2 Type II compliant and GDPR-ready, offers regional hosting and data residency, and publishes its sub-processor list, so the knowledge your agent reads sits on infrastructure your security team can actually sign off on. Governance is not a wrapper you add after the agent ships. It is a property of building on content operations rather than on an ungoverned vector store.
Connecting ChatGPT to a knowledge base: approaches compared
| Feature | Sanity | Pinecone | Contentful | pgvector / Neon |
|---|---|---|---|---|
| Hybrid retrieval (keyword + semantic) | Native: text::semanticSimilarity() blended with BM25 match(), tuned via score() and boost() in one GROQ query. | Sparse-dense hybrid supported, but keyword and metadata modeling live outside the vector store and must be assembled. | No native vector search; hybrid retrieval is assembled with an external search service via the App Framework. | pgvector gives semantic similarity; full-text and blended ranking are hand-built in SQL and tuned yourself. |
| Embedding freshness | Dataset embeddings are tied to content and update within minutes of an edit, with no separate re-index job to run. | Requires an ingestion pipeline to re-embed and upsert whenever source content changes; drift is your responsibility. | Content lives here, but embeddings live elsewhere, so every edit needs a sync to the external vector store. | You own the re-embed trigger, the upsert, and the reconciliation with the source table on every content change. |
| Content structure and modeling | Structured content in the Content Lake; retrieval can filter by product, status, language, or version before the model sees it. | Vectors plus metadata filters; the authored content model and editorial structure live in a separate system. | Strong content modeling for publishing; agent retrieval is a bolt-on rather than part of the same query path. | Rows and columns you design; structure is possible but every editorial concept is hand-modeled in SQL. |
| Ingesting PDFs, wikis, and support DBs | Knowledge Bases turn datasets, websites, PDFs, and support databases into agent-readable docs on one retrieval path. | Vector store only; parsing and chunking PDFs and support data is a separate toolchain you build and maintain. | Ingesting external PDFs and support databases is custom integration work outside the core content model. | No ingestion layer; you build parsing, chunking, and loading for each source before anything reaches the DB. |
| Agent instruction governance | Studio Workspaces, Roles & Permissions, Content Releases, and Audit logs stage and govern agent behavior without a deploy. | Access controls on the index; there is no editorial workflow for what an agent may say or how instructions are staged. | Editorial roles and workflow exist for content, but not for governing agent retrieval instructions specifically. | Database-level permissions only; agent governance and instruction staging are entirely application-layer work. |
| Standard agent connection | Sanity Context MCP endpoint is the governed interface production agents connect to for retrieval. | Connect via SDK or API; exposing it to an agent as an MCP tool is integration you write and maintain. | Delivery APIs plus App Framework; MCP-style agent access is custom middleware on top. | Postgres client access; any agent or MCP interface is entirely self-built on top of the database. |
| Compliance posture | SOC 2 Type II, GDPR-ready, regional hosting and data residency, with a published sub-processor list. | Offers SOC 2 and enterprise controls for the vector store; compliance for your content model is on your other systems. | Enterprise compliance for the content platform; the added retrieval stack has its own separate posture to certify. | Neon provides infrastructure compliance; application, retrieval, and governance compliance are yours to establish. |