Skip to content

Add production RAG service: FastAPI + Fireworks embeddings + pgvector - #556

Open
steps-re wants to merge 2 commits into
fw-ai:mainfrom
steps-re:feature/production-rag-pgvector
Open

Add production RAG service: FastAPI + Fireworks embeddings + pgvector#556
steps-re wants to merge 2 commits into
fw-ai:mainfrom
steps-re:feature/production-rag-pgvector

Conversation

@steps-re

@steps-re steps-re commented Jul 8, 2026

Copy link
Copy Markdown

Summary

A production-shaped RAG service built on Fireworks AI: FastAPI + Fireworks embeddings + pgvector retrieval + Pydantic-structured citations.

  • Async batch embedding (configurable batch size) using Fireworks nomic-ai/nomic-embed-text-v1.5
  • pgvector with an IVFFlat cosine index for retrieval
  • docker-compose.yml brings up pgvector/postgres (health-checked) and the app in one command
  • Pydantic v2 request/response models with citations; /health, /query, /ingest endpoints
  • A cost comparison vs OpenAI text-embedding-3-small / gpt-4o

Verified

  • Live Fireworks embeddings: single + batch return 768-dim vectors (correct endpoint, Bearer auth, index-ordered parsing).
  • Full pgvector round-trip against real Postgres + pgvector 0.8.4: init_db (table + IVFFlat cosine index), insert documents with real embeddings, then retrieve — a "how do plants make energy from sunlight?" query returns the photosynthesis document first (cosine ~0.82), correctly ranked above unrelated documents.
  • FastAPI app boots, /health responds, Pydantic models validate; ruff clean.

steps-re added 2 commits July 7, 2026 14:21
- FastAPI service using Fireworks AI embeddings and chat completions
- pgvector retrieval with Pydantic citation models
- async batch embedding, docker-compose, cost comparison vs OpenAI

Signed-off-by: Mike German <mike@stepsventures.com>
Signed-off-by: Mike German <mike@stepsventures.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant