Skip to content

postevanus-scale/sgp-kb-demo

Repository files navigation

SGP Knowledge Base & Vector Store Demo

A GeoGuessr-style demo that uses SGP to identify locations from street-view image descriptions. It showcases two approaches: the v2 Knowledge Base SDK and the v5 Vector Store REST API.

Setup

uv sync
cp .env.example .env  # Fill in your keys

Environment Variables

Variable Description
SGP_API_KEY SGP API key
SGP_ACCOUNT_ID SGP account ID
SGP_BASE_URL SGP API base URL
EMBEDDING_MODEL Embedding model (e.g. openai/text-embedding-3-small)
LLM_MODEL LLM model for chat (e.g. gpt-4o-mini)
KB_ID Knowledge base ID (set after running create_sgp_kb.py)
VECTOR_STORE_NAME Vector store name (default: geoguessr-street-views)
OPENAI_API_KEY OpenAI API key (required for chat scripts)

Scripts

Data Generation

These scripts create the data stores with 20 street-view image descriptions from cities around the world. Each image is stored as a separate artifact/document with metadata (city, country, image URL).

  • create_sgp_kb.py -- Creates a v2 Knowledge Base and uploads image descriptions as chunks via the SGP SDK.
  • create_sgp_vector_store.py -- Creates a v5 Vector Store and upserts image descriptions as documents via the REST API.
uv run python3 create_sgp_kb.py
uv run python3 create_sgp_vector_store.py

Chat (GeoGuessr Game)

Interactive chat assistants powered by an LLM with function calling. Describe a scene or ask about a place, and the assistant searches the store to identify the location and return the matching image.

  • sgp_kb_chat.py -- Chat using the v2 Knowledge Base.
  • sgp_vector_store_chat.py -- Chat using the v5 Vector Store.
uv run python3 sgp_kb_chat.py
uv run python3 sgp_vector_store_chat.py

Testing

  • sgp_vector_store_test.py -- Runs predefined queries against the vector store and prints the top matches.
uv run python3 sgp_vector_store_test.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages