In this tutorial, you'll visualize facts about Space Exploration and Astrophysics as a semantic knowledge graph using Google Cloud SQL (PostgreSQL), pgvector, and pyvis.
The steps performed include:
- Configure a Google Cloud SQL (PostgreSQL) instance.
- Enable the
pgvectorextension for vector similarity search. - Generate semantic embeddings for text data using
sentence-transformers. - Store and query vector data in PostgreSQL.
- Visualize the relationships between data points using
pyvis.
This tutorial uses billable components of Google Cloud:
- Cloud SQL: Costs are associated with the instance size and storage used.
Learn about Cloud SQL pricing and use the Pricing Calculator to generate a cost estimate based on your projected usage.
- Vector Search: Uses
pgvectorto find semantically similar facts based on embeddings generated bysentence-transformers. - Interactive Visualization: Renders a dynamic, physics-based graph using
pyviswhere nodes are facts and edges represent semantic similarity. - Secure: Configured to use Google Colab's
userdatafor secure credential management.
Before running the notebook, ensure you have:
- Google Cloud Project: A GCP project with billing enabled.
- Cloud SQL Instance: A PostgreSQL instance (version 15+) with
pgvectorsupported. - Database Credentials:
- Connection Name (e.g.,
project:region:instance) - Database User
- Database Password
- Database Name
- Connection Name (e.g.,
