Intach-Pune / rag /vector_format.py
Meshyboi's picture
Upload folder using huggingface_hub
44436be verified
Raw History Blame Contribute Delete
348 Bytes
from __future__ import annotations
def to_pgvector_literal(embedding: list[float]) -> str:
"""Formats a Python float list as a pgvector text literal, e.g. '[0.1,0.2]',
for use with an explicit ::vector cast in raw SQL (no pgvector client
library needed for this)."""
return "[" + ",".join(str(value) for value in embedding) + "]"