본문으로 건너뛰기
아우라베이스 로고
아우라베이스

RAG 및 벡터 검색 가이드

pgvector 및 Aurabase AI 게이트웨이를 사용하여 의미 체계 검색 및 RAG(검색 증강 생성) 파이프라인을 구축하세요.

튜토리얼12분 읽기레벨 고급

이 번역 이후 영어 소스가 변경되었습니다. 일부 정보는 최신 정보가 아닐 수 있습니다.
이 페이지는 자동으로 번역되었습니다. 영어 버전은 권위가 있습니다.

RAG on Aurabase in 3 steps#

RAG allows your AI models to respond accurately on your own private data without retraining:

  • Vectorization: Your textual documents are transformed into digital vectors using aura.ai.embed().
  • Storage & Indexing: Vectors are stored in PostgreSQL with the native extension pgvector.
  • Augmentation & Answer: The question is compared to the stored vectors, and the relevant snippets are provided to the LLM via aura.ai.chat().

Full RAG pipeline code#

HNSW indexing for sub-10ms queries#

For databases containing hundreds of thousands of vectors, HNSW (Hierarchical Navigable Small World) indexing provides significantly better search performance than ivfflat:

HNSW Index (Recommended)

Zero pre-training time, recall > 99% and constant latency even with continuous insertions of new documents.

Cosine Distance (<=>)

Use the <=> operator to calculate the normalized cosine distance between the embedding vectors.

Semantic cache and token savings#

Aurabase's AI Gateway integrates an automatic semantic cache: if two users ask a similar question (cosine similarity greater than 0.95), the answer is served from the in-memory cache in less than 2 ms, saving 100% of the LLM call cost.

To go further#

@aurabase/aurabase-js@0.7.5 · aura@0.3.4↗ 문제 신고