diff --git a/compose.yaml b/compose.yaml deleted file mode 100644 index 707851a2efd09b4c82b28922a5284f6ab16f9dc3..0000000000000000000000000000000000000000 --- a/compose.yaml +++ /dev/null @@ -1,20 +0,0 @@ -services: - postgres: - container_name: pgvector - image: ankane/pgvector - restart: always - shm_size: 128mb - ports: - - "5432:5432" - environment: - POSTGRES_USER: user - POSTGRES_PASSWORD: password - POSTGRES_DB: semantic_router - volumes: - - postgres_data:/var/lib/pgvector/data - -volumes: - postgres_data: - driver: local - - \ No newline at end of file diff --git a/docs/indexes/postgres/postgres.compose.yaml b/docs/indexes/postgres/postgres.compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/docs/indexes/postgres.ipynb b/docs/indexes/postgres/postgres.ipynb similarity index 78% rename from docs/indexes/postgres.ipynb rename to docs/indexes/postgres/postgres.ipynb index 401cb37fc9e7b564321e72397a0d35677f899150..c0de3ddf3dbbeed53194bcb3d6dbf1e9d7453e38 100644 --- a/docs/indexes/postgres.ipynb +++ b/docs/indexes/postgres/postgres.ipynb @@ -1,11 +1,36 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Postgres pgvector index example\n", + "\n", + "**Note**: You'll require docker to be installed locally, or a remote instance of Postgres with the pgvector extension installed." + ] + }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/Users/frankjames/Projects/semantic-router/docs/indexes/postgres\n", + "\u001b[1A\u001b[1B\u001b[0G\u001b[?25l[+] Running 0/0\n", + " \u001b[33m⠋\u001b[0m Container pgvector Starting \u001b[34m0.1s \u001b[0m\n", + "\u001b[?25h\u001b[1A\u001b[1A\u001b[0G\u001b[?25l\u001b[34m[+] Running 1/1\u001b[0m\n", + " \u001b[32m✔\u001b[0m Container pgvector \u001b[32mStarted\u001b[0m \u001b[34m0.1s \u001b[0m\n", + "\u001b[?25h" + ] + } + ], + "source": [ + "!echo \"Running docker compose to start postgres instance with pgvector extension\"\n", + "!docker compose -f ./postgres.compose.yaml up --detach" + ] }, { "cell_type": "code", @@ -67,11 +92,13 @@ "metadata": {}, "outputs": [], "source": [ - "from semantic_router.index.postgres import PostgresIndex \n", + "from semantic_router.index.postgres import PostgresIndex\n", "import os\n", "\n", - "os.environ[\"POSTGRES_CONNECTION_STRING\"] = \"postgresql://user:password@localhost:5432/semantic_router\"\n", - "postgres_index = PostgresIndex()\n" + "os.environ[\"POSTGRES_CONNECTION_STRING\"] = (\n", + " \"postgresql://user:password@localhost:5432/semantic_router\"\n", + ")\n", + "postgres_index = PostgresIndex()" ] }, {