---
title: "Discussion on \"Building a Production RAG API in Go with pgvector and Gemini\" | Hashnode"
description: "Discussion on \"Building a Production RAG API in Go with pgvector and Gemini\". Build a production RAG API in Go with PostgreSQL, pgvector and Gemini: hard safety filters before the LLM, deterministic ranking, vector fallback."
url: "https://hashnode.com/posts/building-a-production-rag-api-in-go-with-pgvector-and-gemini/6ae2df90e5a0e25712bb1420"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Building a Production RAG API in Go with pgvector and Gemini](https://pradipgolang.hashnode.dev/building-a-production-rag-api-in-go-with-pgvector-and-gemini?utm_source=hashnode&utm_medium=feed)

Build a production RAG API in Go with PostgreSQL, pgvector and Gemini: hard safety filters before the LLM, deterministic ranking, vector fallback.

Oct 29 · 8 min read · pradipgolang.hashnode.dev  
Read the article

-   [#go](https://hashnode.com/tag/go)
-   [#rag](https://hashnode.com/tag/rag)
-   [#ai](https://hashnode.com/tag/ai)
-   [#postgresql](https://hashnode.com/tag/postgresql)
-   [#pgvector](https://hashnode.com/tag/pgvector)

## Written by

[Pradip Parmar](https://hashnode.com/@pradipgolang)

@pradipgolang · Surat, India

  
[View profile](https://hashnode.com/@pradipgolang)

Go (Golang) backend and AI agent engineer. Building RAG systems, MCP servers and LLM agents in Go since 2018. Surat, India.

Go (Golang) backend and AI agent engineer. Building RAG systems, MCP servers and LLM agents in Go since 2018. Surat, India.

## Responses 1

Markdown supported · ⌘↵ to post

[Ahmet Özel](https://hashnode.com/@ahmetozel)

[Oct 30](https://hashnode.com/posts/building-a-production-rag-api-in-go-with-pgvector-and-gemini/6ae2df90e5a0e25712bb1420/comment/6ae42f97e9ef0fbc913c9657)

validateAnswer checks the structured item IDs, but Message remains unconstrained. The model could return an allowed ID while naming a different dish or inventing a price in the prose, and the current validation would still pass.

I would render names and prices from the selected records, or require structured item-level text that can be checked against each referenced candidate. A fixture with valid ItemIDs and a deliberately inconsistent Message would make that boundary visible. It separates “the reference exists” from “the explanation accurately describes the referenced item.”
