diff --git a/tests/async_client_test.py b/tests/async_client_test.py index f2e86f8..fdeec92 100644 --- a/tests/async_client_test.py +++ b/tests/async_client_test.py @@ -19,7 +19,15 @@ @pytest.mark.asyncio @pytest.mark.parametrize("schema", ["temp", None]) async def test_vector(service_url: str, schema: str) -> None: - vec = Async(service_url, "data_table", 2, schema_name=schema) + vec = Async( + service_url, + "data_table", + 2, + schema_name=schema, + embedding_table_name="data_table", + id_column_name="id", + metadata_column_name="metadata", + ) await vec.drop_table() await vec.create_tables() empty = await vec.table_is_empty() @@ -118,7 +126,7 @@ async def test_vector(service_url: str, schema: str) -> None: assert isinstance(rec[0][SEARCH_RESULT_METADATA_IDX], dict) assert isinstance(rec[0]["metadata"], dict) - assert rec[0]["contents"] == "the brown fox" + assert rec[0]["chunk"] == "the brown fox" rec = await vec.search([1.0, 2.0], limit=4, predicates=Predicates(("key", "val2"))) assert len(rec) == 1 @@ -256,7 +264,15 @@ async def test_vector(service_url: str, schema: str) -> None: await vec.drop_table() await vec.close() - vec = Async(service_url, "data_table", 2, id_type="TEXT") + vec = Async( + service_url, + "data_table", + 2, + id_type="TEXT", + embedding_table_name="data_table", + id_column_name="id", + metadata_column_name="metadata", + ) await vec.create_tables() empty = await vec.table_is_empty() assert empty @@ -269,7 +285,15 @@ async def test_vector(service_url: str, schema: str) -> None: await vec.drop_table() await vec.close() - vec = Async(service_url, "data_table", 2, time_partition_interval=timedelta(seconds=60)) + vec = Async( + service_url, + "data_table", + 2, + time_partition_interval=timedelta(seconds=60), + embedding_table_name="data_table", + id_column_name="id", + metadata_column_name="metadata", + ) await vec.create_tables() empty = await vec.table_is_empty() assert empty diff --git a/tests/compatability_test.py b/tests/compatability_test.py new file mode 100644 index 0000000..77a1619 --- /dev/null +++ b/tests/compatability_test.py @@ -0,0 +1,300 @@ +import uuid +from collections.abc import Generator + +import numpy +import psycopg2 +import pytest +from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT + +from tests.mocks import embeddings +from tests.utils import test_file_path +from timescale_vector import client + +# To Generate a new dump in blog.sql: +# Go through the quickstart in https://github.com/timescale/pgai/blob/main/docs/vectorizer-quick-start.md +# and run the following command: +# docker compose exec db pg_dump \ +# -t public.blog \ +# -t public.blog_contents_embeddings_store \ +# -t public.blog_contents_embeddings \ +# --inserts \ +# --section=data \ +# --section=pre-data \ +# --no-table-access-method \ +# postgres > blog.sql + + +@pytest.fixture(scope="module") +def quickstart(service_url: str) -> Generator[None, None, None]: + conn = psycopg2.connect(service_url) + conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) + + with conn.cursor() as cursor: + cursor.execute("CREATE EXTENSION IF NOT EXISTS ai CASCADE;") + cursor.execute("DROP VIEW IF EXISTS blog_contents_embeddings;") + cursor.execute("DROP TABLE IF EXISTS blog_contents_embeddings_store;") + cursor.execute("DROP TABLE IF EXISTS blog;") + + with open(test_file_path + "/sample_tables/blog.sql") as f: + sql = f.read() + cursor.execute(sql) + + yield # Run the tests + + conn = psycopg2.connect(service_url) + conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) + + with conn.cursor() as cursor: + cursor.execute("DROP VIEW IF EXISTS blog_contents_embeddings;") + cursor.execute("DROP TABLE IF EXISTS blog_contents_embeddings_store;") + cursor.execute("DROP TABLE IF EXISTS blog;") + + conn.close() + + +def format_array_for_pg(array: list[float]) -> str: + formatted_values = [f"{x:g}" for x in array] + + return f"ARRAY[{','.join(formatted_values)}]::vector" + + +def test_semantic_search(quickstart: None, service_url: str): # noqa: ARG001 + conn = psycopg2.connect(service_url) + conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) + + with conn.cursor() as cursor: + cursor.execute(f""" + SELECT + title, + chunk, + embedding <=> {format_array_for_pg(embeddings["artificial intelligence"])} as distance + FROM blog_contents_embeddings + ORDER BY distance + LIMIT 3; + """) + + results = cursor.fetchall() + + assert len(results) == 3 + assert "Artificial Intelligence" in results[0][0] # First result should be the AI article + + cursor.execute(f""" + SELECT + title, + chunk, + embedding <=> {format_array_for_pg(embeddings["database technology"])} as distance + FROM blog_contents_embeddings + ORDER BY distance + LIMIT 3; + """) + + results = cursor.fetchall() + + # Verify that the PostgreSQL article comes first + assert len(results) == 3 + assert "PostgreSQL" in results[0][0] + + conn.close() + + +def test_metadata_filtered_search(quickstart: None, service_url: str): # noqa: ARG001 + conn = psycopg2.connect(service_url) + conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) + + with conn.cursor() as cursor: + cursor.execute(f""" + SELECT + title, + chunk, + metadata->>'read_time' as read_time, + embedding <=> {format_array_for_pg(embeddings["technology"])} as distance + FROM blog_contents_embeddings + WHERE metadata->'tags' ? 'technology' + ORDER BY distance + LIMIT 2; + """) + + results = cursor.fetchall() + + assert len(results) > 0 + titles = [row[0] for row in results] + assert any("Artificial Intelligence" in title for title in titles) + assert any("Cloud Computing" in title for title in titles) + + conn.close() + + +@pytest.fixture(scope="function") +def sync_client(service_url: str) -> client.Sync: + return client.Sync(service_url, "blog_contents_embeddings", 768, metadata_column_name="metadata") + + +def test_basic_similarity_search(sync_client: client.Sync, quickstart: None): # noqa: ARG001 + results = sync_client.search(embeddings["artificial intelligence"], limit=3) + + assert len(results) == 3 + # Verify the most relevant result is AI-related + assert "AI" in results[0]["metadata"]["tags"] + # Verify basic result structure + assert all(isinstance(r["embedding_uuid"], uuid.UUID) for r in results) + assert all(isinstance(r["chunk"], str) for r in results) + assert all(isinstance(r["metadata"], dict) for r in results) + assert all(isinstance(r["embedding"], numpy.ndarray) for r in results) + assert all(isinstance(r["distance"], float) for r in results) + + +def test_metadata_filter_search(sync_client: client.Sync, quickstart: None): # noqa: ARG001 + results = sync_client.search( + embeddings["technology"], + limit=2, + filter={"read_time": 12}, # matches read_time exactly + ) + + assert len(results) > 0 + assert all(result["metadata"]["read_time"] == 12 for result in results) + + results = sync_client.search( + embeddings["technology"], + limit=3, + filter=[{"read_time": 5}, {"read_time": 8}], # matches either read_time + ) + + assert len(results) == 2 + assert all(result["metadata"]["read_time"] in [5, 8] for result in results) + + results = sync_client.search(embeddings["technology"], limit=2, filter={"published_date": "2024-04-01"}) + + assert len(results) > 0 + assert all(result["metadata"]["published_date"] == "2024-04-01" for result in results) + + +def test_predicate_search(sync_client: client.Sync, quickstart: None): # noqa: ARG001 + results = sync_client.search(embeddings["technology"], limit=2, predicates=client.Predicates("read_time", ">", 5)) + + assert len(results) > 0 + assert all(float(result["metadata"]["read_time"]) > 5 for result in results) + + combined_results = sync_client.search( + embeddings["technology"], + limit=2, + predicates=(client.Predicates("read_time", ">", 5) & client.Predicates("read_time", "<", 15)), + ) + + assert len(combined_results) > 0 + assert all(5 < float(r["metadata"]["read_time"]) < 15 for r in combined_results) + + +@pytest.mark.skip( + "hard to make work because pgai has a foreign key to the original data which we dont pass in upsert atm" +) +def test_upsert_and_retrieve(sync_client: client.Sync, quickstart: None): # noqa: ARG001 + test_id = uuid.uuid1() + test_content = "This is a test article about Python programming." + test_embedding = [0.1] * 768 + + # Test upsert Todo: ? This breaks right now but users shouldn't have to manually manage embeddings anyways + sync_client.upsert([(test_id, test_content, test_embedding)]) + results = sync_client.search(test_embedding, limit=1, filter={"tags": "test"}) + + assert len(results) == 1 + assert results[0]["id"] == test_id + assert results[0]["chunk"] == test_content + + sync_client.delete_by_ids([test_id]) + + +def test_delete_operations(sync_client: client.Sync, quickstart: None): # noqa: ARG001 + initial_results = sync_client.search(embeddings["database technology"], limit=1, filter={"read_time": 5}) + assert len(initial_results) > 0 + record_to_delete = initial_results[0] + + sync_client.delete_by_ids([record_to_delete["embedding_uuid"]]) + results_after_delete = sync_client.search(embeddings["database technology"], limit=1, filter={"read_time": 5}) + assert len(results_after_delete) == 0 + + initial_health_results = sync_client.search( + embeddings["artificial intelligence"], limit=1, filter={"read_time": 12} + ) + assert len(initial_health_results) > 0 + + sync_client.delete_by_metadata({"read_time": 12}) + results_after_metadata_delete = sync_client.search( + embeddings["artificial intelligence"], limit=1, filter={"read_time": 12} + ) + assert len(results_after_metadata_delete) == 0 + + +@pytest.mark.skip("Makes no sense for the managed vector store?") +def test_index_operations(sync_client: client.Sync, quickstart: None): # noqa: ARG001 + sync_client.create_embedding_index(client.DiskAnnIndex()) + + results = sync_client.search( + embeddings["database technology"], limit=3, query_params=client.DiskAnnIndexParams(rescore=50) + ) + + assert len(results) == 3 + tags = [result["metadata"]["tags"] for result in results] + assert any("database" in t for t in tags) + + results_with_params = sync_client.search( + embeddings["database technology"], + limit=3, + query_params=client.DiskAnnIndexParams(rescore=100, search_list_size=20), + ) + assert len(results_with_params) == 3 + + sync_client.drop_embedding_index() + + +def test_semantic_search_without_metadata(service_url: str, quickstart: None): # noqa: ARG001 + conn = psycopg2.connect(service_url) + conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) + + with conn.cursor() as cursor: + cursor.execute("DROP VIEW IF EXISTS public.blog_contents_embeddings;") + cursor.execute(""" + CREATE VIEW public.blog_contents_embeddings AS + SELECT + t.embedding_uuid, + t.chunk_seq, + t.chunk, + t.embedding, + t.id, + s.title, + s.authors, + s.contents + FROM (public.blog_contents_embeddings_store t + LEFT JOIN public.blog s ON ((t.id = s.id))); + """) + + sync_client = client.Sync(service_url, "blog_contents_embeddings", 768) + results = sync_client.search(embeddings["artificial intelligence"], limit=3) + + assert len(results) == 3 + assert all(isinstance(r["embedding_uuid"], uuid.UUID) for r in results) + assert all(isinstance(r["chunk"], str) for r in results) + assert all(isinstance(r["embedding"], numpy.ndarray) for r in results) + assert all(isinstance(r["distance"], float) for r in results) + + assert all("metadata" not in r or not r["metadata"] for r in results) + + # Restore the original view + with conn.cursor() as cursor: + cursor.execute("DROP VIEW IF EXISTS public.blog_contents_embeddings;") + cursor.execute(""" + CREATE VIEW public.blog_contents_embeddings AS + SELECT + t.embedding_uuid, + t.chunk_seq, + t.chunk, + t.embedding, + t.id, + s.title, + s.authors, + s.contents, + s.metadata + FROM (public.blog_contents_embeddings_store t + LEFT JOIN public.blog s ON ((t.id = s.id))); + """) + + conn.close() diff --git a/tests/mocks.py b/tests/mocks.py new file mode 100644 index 0000000..a2b8a9a --- /dev/null +++ b/tests/mocks.py @@ -0,0 +1,2312 @@ +embeddings = { + "database technology": [ + -0.025906688, + -0.01276215, + 0.0871204, + -0.042986616, + 0.043273408, + 0.01086615, + 0.03804746, + 0.00956763, + -0.101268694, + -0.024265612, + 0.012794016, + -0.051303525, + 0.0055246884, + -0.025141913, + 0.014140335, + 0.04846749, + 0.030941442, + -0.0062854784, + -0.00948, + 0.029619023, + 0.052864935, + 0.06557929, + 0.023373377, + -0.057453576, + 0.0069347387, + 0.054012097, + 0.008444369, + 0.039099023, + 0.0033538484, + -0.10509256, + -0.04359206, + -0.036517914, + 0.0416164, + 0.003953319, + 0.07016793, + 0.0132481, + 0.0653881, + 0.058887523, + 0.038429845, + 0.0024855123, + -0.019342385, + 0.02874272, + -0.009886284, + 0.0037840332, + -0.011280403, + 0.036294855, + -0.007950453, + -0.047511525, + 0.0032184198, + -0.006420907, + -0.0302404, + -0.06710883, + 0.008763025, + 0.025938552, + 0.018434217, + -0.0059030917, + 0.044006314, + 0.026320938, + 0.0033299492, + 0.0021489325, + -0.012905545, + -0.029794283, + 0.03648605, + 0.00087879197, + -0.0321842, + -0.019167125, + -0.05225949, + 0.038015593, + -0.010842251, + -0.027595561, + 0.029523427, + 0.05898312, + -0.024010686, + 0.064910114, + 0.07137882, + -0.018402351, + -0.025651762, + 0.017621646, + -0.0015355209, + -0.015000705, + 0.0113520995, + -0.022720132, + 0.025221577, + 0.0053135795, + -0.010531562, + -0.008938285, + -0.047065407, + 0.010388168, + 0.0029037476, + -0.0151202, + -0.03661351, + 0.013001142, + 0.027260972, + 0.08253176, + -0.0076955287, + -0.050315693, + 0.045376536, + -0.02466393, + -0.059524834, + -0.0010112331, + -0.078389235, + -0.023771696, + 0.0030132853, + -0.026990116, + 0.044579893, + -0.07979132, + 0.0026528065, + -0.04046924, + -0.031052971, + 0.053597845, + -0.123510845, + -0.0443887, + 0.011360066, + 0.00795842, + 0.035848737, + -0.031881478, + 0.102479585, + -0.0051423023, + -0.0312123, + -0.012865713, + -0.050793678, + 0.039704468, + -0.066981375, + -0.04760712, + 0.013773881, + 0.044866685, + 0.0011182814, + -0.0009878319, + -0.009726957, + -0.019055596, + 0.053502247, + 0.004851529, + 0.03447852, + 0.002808151, + -0.031355694, + 0.044930417, + -0.062169675, + 0.023787629, + -0.021397712, + -0.054394484, + 0.07877162, + -0.022528939, + 0.034287326, + 0.020840066, + -0.0029873946, + -0.0099181505, + -0.018019965, + 0.019931898, + 0.05442635, + 0.016060233, + -0.0302404, + -0.013789814, + -0.019692905, + 0.0017675419, + 0.03339509, + -0.019676972, + 0.02982615, + -0.0011760377, + 0.03769694, + -0.035561945, + -0.020680737, + -0.034223594, + 0.0017018191, + -0.0029774366, + -0.07507522, + 0.029220704, + -0.054362617, + -0.0027284871, + -0.08616443, + 0.032104533, + -0.008093848, + -0.0064687054, + 0.032391325, + 0.0047200834, + -0.030845845, + 0.04454803, + 0.06634406, + -0.06207408, + 0.05248255, + -0.09566036, + -0.005345445, + 0.004210235, + -0.017605713, + -0.019788502, + 0.0026109829, + 0.0075601, + -0.025205646, + 0.019613242, + 0.027468098, + 0.034669712, + -0.020744469, + 0.073418215, + -0.001238773, + 0.044197507, + 0.016856872, + -0.012650621, + -0.05041129, + 0.004397445, + 0.010882083, + 0.026814856, + 0.09024322, + -0.06373109, + 0.014331528, + 0.012029243, + -0.06318937, + -0.004580672, + 0.0066758315, + 0.00060096424, + -0.01574158, + -0.043528333, + 0.013104705, + -0.054872464, + 0.00868336, + 0.013965074, + 0.034797173, + 0.0078389235, + -0.0073211086, + -0.0017476259, + 0.0049072937, + -0.06283885, + 0.031881478, + 0.02966682, + 0.03425546, + -0.027946081, + -0.030543122, + 0.030415662, + -0.007205596, + -0.050538752, + 0.007998251, + -0.01741452, + 0.027515898, + -0.058728196, + 0.050506886, + 0.032662183, + -0.02069667, + 0.063954145, + -0.032980837, + -0.02155704, + 0.01267452, + -0.019055596, + -0.00064428145, + 0.0264484, + -0.010961747, + 0.03546635, + -0.037314553, + 0.03648605, + 0.031769946, + -0.02660773, + -0.006381075, + 0.07271717, + 0.013662351, + -0.050889272, + 0.016275326, + -0.0021887645, + 0.033076435, + -0.02356457, + -0.054171424, + 0.030877711, + 0.05449008, + 0.025619896, + -0.039768197, + -0.012865713, + -0.0046762684, + 0.015136133, + -0.08954218, + 0.02017089, + 0.03868477, + -0.055222988, + 0.008129696, + -0.026543997, + 0.034096133, + 0.007842907, + 0.029061375, + -0.041711997, + -0.020154957, + -0.01170262, + 0.010268671, + 0.008316907, + 0.04289102, + 0.037091494, + 0.013853545, + -0.005839361, + 0.0011292351, + 0.009089646, + 0.04626877, + 0.06653526, + 0.003973235, + 0.08469862, + 0.03995939, + -0.02863119, + -0.016410755, + -0.027037913, + -0.05898312, + -0.03575314, + 0.021158721, + 0.016147865, + 0.005496806, + 0.00397921, + -0.022210283, + 0.029619023, + 0.009153377, + 0.03897156, + -0.005735798, + 0.011670755, + -0.030383795, + 0.054872464, + 0.013805747, + -0.051144198, + 0.007181697, + -0.014387293, + -0.033203896, + -0.02660773, + 0.10738688, + 0.010101377, + -0.08061983, + -0.06127744, + 0.03546635, + -0.018274888, + -0.08049236, + -0.06608914, + -0.031323828, + -0.046077576, + -0.010300537, + -0.021031259, + -0.024217812, + -0.032088604, + -0.04104282, + -0.028997645, + 0.030192602, + -0.025603965, + -0.004990941, + 0.020282418, + 0.0010435965, + 0.018051831, + 0.039768197, + -0.04932786, + 0.03482904, + 0.05283307, + -0.088904865, + -0.016076166, + 0.00965526, + 0.009734924, + -0.066025406, + 0.046874214, + -0.042954754, + -0.036581643, + 0.0006029558, + 0.0031666383, + -0.012666553, + 0.011981444, + -0.055446044, + -0.01353489, + 0.024902923, + 0.033490688, + -0.016410755, + 0.003943361, + 0.0014070629, + -0.022736065, + 0.020537343, + -0.03575314, + 0.00482763, + 0.045280937, + 0.03661351, + 0.0026348822, + -0.0070024533, + 0.037792534, + -0.060958784, + -0.035338886, + -0.03361815, + -0.05082554, + -0.05876006, + -0.006193865, + -0.022863528, + 0.0444843, + -0.023182184, + 0.011941613, + 0.018274888, + 0.053024266, + 0.00014575997, + 0.079408936, + 0.044962283, + 0.017940301, + 0.08042863, + -0.03339509, + 0.06111811, + 0.061022516, + -0.024377141, + 0.01586904, + -0.06927569, + -0.014012872, + 0.046013843, + -0.014873242, + 0.056306414, + -0.053884633, + -0.069084495, + -0.021031259, + -0.007922571, + -0.0063930247, + 0.030782115, + 0.002483521, + 0.03594433, + -0.019788502, + 0.0004199779, + -0.022178419, + -0.00785884, + -2.2498816e-05, + 0.018115561, + 0.00482763, + 0.024871057, + -0.051654045, + -0.022704199, + -0.023612367, + 0.034223594, + 0.073609404, + -0.013749982, + -0.016570082, + -0.04834003, + 0.09457693, + -0.013614553, + 0.0010894033, + 0.019645108, + 0.0144271245, + -0.038206786, + 0.00557647, + -0.032630317, + 0.06653526, + 0.007141865, + 0.020091224, + -0.021222452, + -0.081065945, + -0.0147059485, + 0.018657276, + -0.024361208, + 0.0217801, + -0.021652637, + 0.032630317, + 0.054617543, + -0.06653526, + -0.053820904, + -0.039099023, + -0.011121075, + -0.013789814, + 0.01937425, + -0.008802856, + -0.04881801, + -0.0012557015, + -0.044356838, + 0.027468098, + 0.013168436, + -0.05920618, + -0.0074007725, + -0.059524834, + -0.042158116, + 0.014323561, + -0.006440823, + -0.006022588, + 0.019597309, + 0.0066041336, + 0.018258957, + -0.028583393, + 0.03473344, + 0.008531999, + -0.031929273, + 0.024536468, + 0.04760712, + -0.0727809, + 0.030718384, + 0.013749982, + 0.037665073, + -0.12835442, + 0.011368033, + 0.023978822, + 0.026639594, + -0.029045442, + 0.013630486, + 0.0063213273, + -0.036008064, + -0.031276032, + -0.009217109, + -0.016020402, + -0.006305394, + 0.01069089, + -0.022098754, + -0.006795327, + -0.03425546, + 0.15550385, + 0.038366113, + -0.012849781, + 0.06350803, + 0.032168265, + -0.024647998, + -0.015016638, + 0.076031186, + -0.01758978, + -0.07252598, + 0.023468973, + -0.07354567, + -0.059046853, + 0.06459146, + -0.01684094, + 0.02702198, + -0.0015673864, + -0.006146067, + 0.035020232, + -0.016458552, + 0.020330217, + -0.063093774, + -0.0061221677, + 0.07239851, + -0.043751393, + 0.03224793, + -0.034000535, + 0.038652904, + 0.05168591, + -0.001786462, + 0.0048037306, + -0.01247536, + 0.012722318, + -0.0425405, + -0.029395964, + -0.04783018, + -0.035561945, + -0.074119255, + 0.024616132, + 0.01342336, + -0.009145411, + -0.046651155, + -0.019103393, + 0.007189663, + -0.011989411, + 0.010467831, + -0.01256299, + 0.016362956, + 0.01833862, + 0.025364973, + -0.03795186, + 0.026798923, + 0.05535045, + -0.027053846, + 0.019868167, + -0.014092537, + 0.010706822, + -0.034860905, + -0.0044890586, + 0.0021091006, + 0.006273529, + 0.04247677, + -0.00510247, + 0.023978822, + 0.065324366, + 0.03938581, + 0.008946251, + 0.0027523863, + 0.009033881, + 0.01566988, + -0.021875696, + 0.016713478, + -0.03559381, + 0.00511442, + -0.030128872, + -0.022895392, + 0.013941175, + 0.026225341, + -0.033235762, + -0.030941442, + 0.012395697, + -0.008105798, + -0.06755495, + -0.032582518, + -0.012929444, + -0.042221844, + 0.065165035, + 0.031068904, + -0.005054672, + -0.047161005, + 0.046937946, + -0.00017463812, + -0.040628567, + 0.046077576, + -0.015797343, + -0.018051831, + -0.010212907, + -0.05178151, + 0.019437982, + -0.026305007, + -0.000631834, + 0.049423456, + 0.017621646, + 0.023038788, + -0.009432201, + -0.013264032, + 0.024090352, + 0.014634251, + -0.040564835, + 0.050060768, + -0.024329342, + 0.014952906, + 0.020776335, + -0.015183931, + 0.010921915, + 0.01735079, + -0.014618318, + 0.0066598984, + 0.006938722, + 0.043209676, + 0.0128896125, + 0.043942586, + 0.04655556, + -0.015367159, + -0.004990941, + 0.012371797, + 0.03425546, + -0.018768804, + -0.027595561, + -0.008770991, + 0.017924368, + -0.036008064, + 0.0051064533, + 0.009503898, + 0.017541982, + -0.0406923, + 0.0009330629, + -0.019900031, + -0.04461176, + 0.05477687, + 0.010483764, + -0.026862653, + -0.026305007, + -0.035976198, + 0.011447696, + 0.0060584364, + 0.031929273, + 0.06213781, + -0.037888132, + 0.0007841911, + 0.06341243, + 0.022608602, + 0.034988366, + -0.01190178, + -0.06774615, + -0.037346415, + 0.032040805, + -0.027356569, + -0.022959124, + 0.039736334, + -0.01551852, + -0.01626736, + 0.007918588, + -0.055191122, + -0.014586452, + -0.035657544, + -0.037410147, + 0.016649747, + 0.030734317, + 0.046428096, + -0.0274203, + -0.013957108, + -0.019262722, + 0.060831323, + 0.055892162, + -0.0283922, + 0.01897593, + -0.0056083356, + 0.017956235, + -0.012443495, + 0.042413037, + 0.014586452, + -0.021238385, + 0.03667724, + 0.027229106, + -0.016020402, + 0.022353679, + 0.012180604, + 0.040023122, + 0.019852234, + -0.012132806, + 0.037728805, + -0.04760712, + -0.013654386, + 0.030081073, + -0.0151440995, + -0.0208082, + -0.031881478, + -0.028854249, + 0.0058234283, + -0.027754888, + -0.0050745877, + 0.015685814, + 0.025619896, + 0.017494183, + 0.0009753844, + -0.039736334, + -0.009870352, + -0.006317344, + -0.03989566, + -0.009957982, + 0.044165645, + 0.02201909, + -0.011280403, + -0.021477377, + 0.0112644695, + 0.012443495, + -0.052068297, + -0.040660433, + 0.0028220923, + 0.016665678, + -0.0025691595, + -0.0369003, + 0.014355428, + -0.017637579, + 0.021509241, + 0.014116435, + 0.0053573945, + 0.013686251, + 0.016506352, + -0.0013034999, + -0.023182184, + 0.03460598, + 0.0077154445, + -0.01776504, + -0.03482904, + 0.003435504, + 0.00029052413, + -0.040086854, + 0.018784737, + -0.00019231353, + 0.019549511, + 0.031355694, + -0.028089477, + -0.058537003, + 0.004875428, + 0.039353944, + 0.014538654, + 0.026751123, + 0.03737828, + -0.04591825, + -0.031244164, + -0.028121343, + -0.014299663, + -0.0034733443, + -0.027037913, + 0.0045926212, + -0.041106552, + 0.0006627037, + -0.04834003, + 0.008229276, + 0.027260972, + 0.06774615, + 0.09362096, + 0.021493308, + -0.07131509, + 0.011121075, + 0.016777208, + -0.038557306, + -0.0016072183, + -0.053661574, + 0.013558789, + 0.035976198, + 0.0012178612, + 0.09113546, + -0.0052777305, + 0.051303525, + -0.01313657, + 0.017334856, + -0.040150583, + -0.02351677, + -0.040787894, + -0.027802687, + ], + "technology": [ + -0.011356568, + -0.03970542, + -0.00605712, + 0.0020378397, + 0.067764826, + -0.059217602, + 0.037832525, + 0.05523344, + -0.026305692, + -0.02269611, + 0.004907842, + -0.008006635, + -0.04546032, + -0.045834903, + 0.02659514, + 0.008725998, + -0.036572576, + -0.04440469, + 0.030851725, + 0.008704715, + 0.039501105, + 0.060341343, + 0.024943585, + -0.015817469, + -0.028604249, + 0.034852915, + -0.004712039, + 0.075937465, + 0.0030243034, + -0.048150484, + 0.0028561682, + -0.050057434, + 0.034938045, + -0.05765118, + 0.0655514, + 0.010573356, + 0.04566464, + 0.0074405097, + -0.0065125744, + 0.0025071283, + -0.020857263, + -0.08043242, + -0.013518913, + 0.087379165, + -0.010377553, + -0.0038394392, + -0.09854844, + -0.022219371, + 0.011569397, + 0.043587424, + 0.015306678, + -0.070420936, + -0.03362702, + 0.010224316, + -0.024977637, + 0.01367215, + -0.020499712, + 0.036027733, + -0.015459915, + 0.032758676, + -0.026424877, + -0.025028717, + 0.06817346, + -0.042974476, + -0.03585747, + -0.056084756, + -0.027735904, + 0.05966029, + -0.06865019, + 0.0036564062, + 0.009372999, + 0.03650447, + -0.047128905, + 0.03841142, + 0.0038394392, + 0.043825794, + -0.06466603, + 0.03701526, + 0.09773118, + 0.012539898, + 0.004443874, + -0.012625029, + -0.039603263, + -0.004375769, + -0.0034457052, + -0.017554155, + -0.04975096, + -0.05138549, + -0.017469022, + -0.03236707, + -0.05659555, + 0.027821036, + 0.03565315, + 0.114553206, + -0.006780739, + 0.0058953697, + 0.0020921114, + -0.006282719, + 0.010437145, + 0.05485886, + -0.020942396, + -0.059217602, + -0.0059592184, + -0.0015611023, + 0.047673747, + 0.0011897153, + -0.015936652, + -0.027225114, + -0.033405676, + 0.083565265, + -0.08485927, + -0.052134648, + -0.073077045, + 0.043723635, + 0.03425699, + -0.031686015, + 0.06534708, + -0.04709485, + 0.04430253, + -0.02576085, + -0.10345203, + -0.005278165, + -0.0321287, + 0.012046134, + -0.003328649, + -0.0033563168, + -0.032094646, + -0.008232234, + -0.012829346, + -0.038343314, + 0.015996244, + -0.008096023, + 0.019699473, + -0.008236491, + 0.010573356, + -0.042055055, + 0.0067041204, + 0.040420525, + -0.042770162, + 0.037185524, + 0.028706405, + -0.0029008624, + -0.015723823, + 0.051998436, + -0.00517175, + -0.006997825, + -0.026799455, + 0.023087714, + 0.054926965, + 0.072600305, + -0.056970127, + 0.036742836, + -0.02436469, + -0.02189587, + -0.016404876, + -0.013391215, + 0.008019405, + 0.04379174, + -0.024075242, + 0.000786404, + -0.026510008, + -0.026390824, + -0.037696313, + -0.021878844, + -0.0070744436, + 0.063984975, + 0.012012081, + -0.00691695, + -0.06221424, + -0.02301961, + -0.021010501, + -0.03766226, + -0.026016245, + 0.073077045, + -0.016209073, + 0.0046737297, + 0.06657298, + -0.058127917, + -0.054007545, + -0.04896775, + -0.0017888297, + 0.040284317, + -0.06156724, + -0.014574545, + -0.018558709, + -0.056833915, + -0.006103942, + 0.010752132, + 0.008449321, + 0.0036691758, + -0.052373014, + 0.05063633, + 0.051113065, + 0.032537334, + 0.032945964, + -0.0037777189, + -0.05635718, + -0.049308274, + 0.064972505, + -0.052100595, + 0.056561496, + -0.024926558, + 0.0032924681, + -0.013042175, + -0.06956962, + -0.021282922, + -0.060102973, + 0.031226303, + -0.012599491, + -0.046141375, + 0.014872506, + -0.026390824, + 0.004245943, + 0.019920815, + -0.027276194, + 0.0072276806, + 0.035687204, + 0.032980017, + -0.017358351, + 0.050329857, + -0.020959422, + 0.0011003271, + 0.016651759, + 0.028995853, + -0.038990315, + 0.049206115, + -0.03008554, + -0.036981206, + 0.047537535, + -0.05826413, + 0.015136414, + 0.0075852335, + -0.027310247, + -0.030885777, + -0.00011526033, + 0.05639123, + -0.024909532, + -0.004069295, + -0.035959627, + -0.025522482, + 0.0035521197, + -0.011884384, + -0.04082916, + 0.03650447, + -0.0623164, + 0.0445409, + 0.04685648, + 0.01770739, + -0.015732337, + -0.017256193, + 0.02920017, + -0.036300153, + 0.017171063, + -0.024279559, + 0.13832197, + -0.031907357, + -0.024330636, + 0.012667595, + 0.00964542, + 0.049206115, + -0.022202345, + -0.021691555, + -0.041544266, + -0.030681461, + -0.03458049, + 0.012241937, + -0.0023198386, + 0.026850535, + 0.0100795925, + -0.049580697, + 0.0655514, + -0.004269354, + 0.008751538, + -0.021129686, + -0.08199885, + -0.007900221, + -0.014319151, + 0.059081394, + -0.0034818861, + 0.082407475, + -0.02812751, + 0.007163832, + 0.018865183, + -0.035789363, + -0.035925575, + 0.046243533, + 0.0006108199, + 0.02748051, + 0.053258386, + 0.0011365081, + 0.05686797, + -0.0033201359, + -0.033133253, + -0.033473782, + 0.025692744, + 0.07035283, + 0.016379338, + -0.017571181, + -0.010113644, + -0.09759497, + 0.0135103995, + -0.034631573, + 0.005848547, + 0.01901842, + -0.032213833, + 0.10774267, + -0.001820754, + -0.025624638, + 0.012029108, + -0.011220356, + -0.012999609, + 0.0015664231, + 0.06350824, + -0.004903585, + -0.057855498, + -0.007559694, + -0.015400323, + 0.002003787, + -0.036232047, + -0.12442848, + -0.019103551, + -0.02748051, + 0.037594154, + -0.037185524, + 0.048593167, + -0.04655001, + -0.023240952, + -0.010300934, + 0.018252235, + -0.05611881, + -0.04494953, + 0.017860629, + 0.020380527, + 0.010309448, + 0.03315028, + 0.040284317, + 0.020244315, + 0.039875682, + -0.055676125, + -0.047435377, + -0.035176415, + -0.060647815, + -0.03110712, + 0.03311623, + 0.02729322, + 0.0051079015, + -0.0030306883, + -0.016455956, + -0.011399133, + 0.07341757, + -0.037628207, + 0.002956198, + 0.02901288, + 0.03137954, + -0.044200372, + -0.016898641, + 0.033167306, + 0.0092793545, + -0.016779456, + -0.032009516, + -0.014642651, + 0.06834372, + 0.019103551, + 0.06769672, + -0.03752605, + 0.05649339, + -0.0629634, + -0.046515957, + -0.059251655, + -0.06732214, + -0.065619506, + -0.015664231, + -0.0037117417, + 0.033865385, + -0.03486994, + -0.013561478, + 0.05244112, + 0.068105355, + -0.044370636, + 0.009568802, + 0.06292935, + 0.017000798, + 0.039126527, + -0.095347494, + 0.021334002, + 0.026475955, + -0.038479526, + -0.01450644, + -0.0105393035, + -0.021640476, + 0.06892262, + -0.04198695, + -0.039535157, + -0.06653893, + -0.016498521, + 0.015545047, + 0.01539181, + 0.048082378, + 0.028382905, + -0.040897265, + 0.029540697, + -0.006095429, + -0.029796092, + 0.07164683, + -0.004550289, + -0.03922868, + -0.024892507, + 0.03161791, + 0.05635718, + 0.047741853, + 0.032247886, + -0.049648803, + 0.046788376, + 0.025965165, + -0.02092537, + -0.039535157, + 0.0045119794, + 0.0018313954, + 0.023973083, + -0.031992488, + -0.006227383, + 0.0004602432, + -0.0058144946, + -0.019733526, + 0.015919626, + 0.05063633, + 0.018405471, + 0.0046950127, + 0.051113065, + -0.05472265, + 0.018303314, + 0.015093849, + -0.0033733433, + 0.05700418, + -0.006155021, + 0.006627502, + 0.0023602762, + 0.042361528, + 0.0066956077, + 0.006227383, + -0.008938828, + 0.03202654, + 0.033320542, + -0.049819063, + 0.0066956077, + -0.01627718, + -0.08302043, + 0.0028157306, + -0.03185628, + -0.08411011, + 0.039637316, + 0.0055378163, + 0.016839048, + 0.030272828, + -0.038751945, + -0.012352608, + 0.02111266, + -0.01770739, + 0.02106158, + 0.045085743, + -0.035278574, + -0.025250059, + -0.0053207306, + 0.0049631777, + 0.019699473, + 0.011628989, + -0.012974069, + 0.004843993, + -0.010913882, + -0.0062146136, + 0.025267085, + 0.04590301, + 0.008845183, + -0.04580085, + -0.024194427, + 0.025471402, + 0.04975096, + 0.004507723, + 0.017979814, + 0.004079936, + -0.04620948, + 0.029046932, + -0.04123779, + 0.015621665, + -0.012769753, + 0.054892913, + 0.036708783, + 0.025028717, + -0.01850763, + -0.001682415, + 0.076414205, + -0.0553356, + 0.07723147, + -0.018865183, + -0.015476941, + 0.022219371, + -0.092827596, + -0.008725998, + 0.011586423, + -0.016736891, + -0.0008694074, + -0.025726797, + -0.07300894, + 0.0036947154, + -0.0070233643, + 0.04375769, + 0.029830145, + 0.03194141, + 0.0004187415, + 0.007368148, + 0.04505169, + -0.019699473, + 0.0006102878, + 0.021912897, + -0.029796092, + 0.0017569052, + -0.021708582, + 0.014583059, + -0.008342906, + -0.054314017, + -0.005993271, + 0.010471198, + -0.041408055, + 0.042259373, + 0.01485548, + -0.046379745, + -0.023598505, + -0.034478333, + -0.064972505, + -0.03790063, + 0.0003764417, + -0.033167306, + -0.03473373, + -0.023172846, + 0.007295786, + -0.020176211, + -0.0058442904, + -0.008066228, + -0.06105645, + 0.010964962, + 0.047401324, + 0.018064944, + -0.018439524, + 0.0034159091, + -0.042565845, + 0.039126527, + 0.010973475, + -0.019358946, + 0.013867952, + 0.050227698, + 0.075733155, + -0.043451216, + 0.01767334, + 0.0011333156, + 0.015400323, + -0.012046134, + -0.004092706, + -0.036470417, + 0.007887451, + -0.015757876, + -0.0369131, + -0.010658488, + 0.050704435, + -0.03841142, + -0.028672352, + 0.054109704, + -0.01888221, + 0.0014451104, + -0.050397962, + -0.009407052, + -0.012999609, + 0.03728768, + 0.027906168, + -0.044677112, + 0.0056272047, + 0.03153278, + -0.011611963, + -0.011961003, + 0.04174858, + -0.008879235, + -0.05305407, + 0.049955275, + -0.04263395, + -0.0031796687, + 0.00031631743, + -0.067151874, + 0.018728971, + -0.022100186, + -0.007878938, + 0.026765404, + 0.018609788, + 0.022100186, + -0.0100029735, + -0.028944775, + 0.0039543672, + -0.038104944, + -0.008828157, + 0.0017707392, + -0.022542872, + -0.006023067, + -0.019273814, + -0.025948139, + 0.040624842, + 0.0027603952, + 0.016030297, + -0.0038628504, + -0.0073383516, + 0.00760226, + -0.05063633, + 0.01136508, + 0.028331827, + 0.02227045, + 0.010845778, + -0.02055079, + -0.048661273, + -0.015723823, + 0.036470417, + 0.02342824, + 0.035585046, + 0.029080985, + -0.09888897, + -0.02724214, + 0.008342906, + -0.017588207, + 0.014021189, + -0.01308474, + -0.03446131, + 0.0050483095, + 0.0065508834, + -0.034563467, + 0.025113849, + 0.021470211, + 0.008172642, + -0.004890816, + -0.052134648, + 0.000640616, + 0.036027733, + 0.03616394, + 0.025318164, + -0.044472795, + -0.027940221, + 0.025454376, + -0.022219371, + -0.032230858, + 0.053258386, + 0.04886559, + -0.06415524, + 0.0002992911, + 0.009798657, + 0.0065508834, + -0.0022538614, + -0.02041458, + 0.009892303, + -0.009117604, + 0.049342327, + -0.022900425, + -0.024654137, + 0.027071878, + 0.04542627, + -0.021180764, + -0.002468819, + -0.03534668, + 0.01294853, + -0.009100578, + -0.0085174255, + 0.02399011, + 0.017119983, + 0.01850763, + 0.016345285, + 0.010437145, + 0.03129441, + 0.07055715, + 0.024807375, + 0.010071079, + 0.02589706, + -0.02194695, + 0.023053661, + -0.051691964, + -0.00674243, + 0.07546073, + 0.015493968, + -0.028723432, + -0.034001596, + 0.005069592, + 0.01399565, + 0.0066317585, + 0.028587222, + 0.038547628, + 0.029847171, + -0.024330636, + -0.030051487, + -0.014557519, + 0.063814715, + 0.0015238572, + 0.016294206, + -0.026561087, + 0.056697708, + 0.036027733, + -0.04620948, + 0.008564248, + 0.04328095, + -0.017307272, + -0.045119796, + -0.052849755, + -0.02691864, + 0.017979814, + -0.021095634, + -0.035040203, + 0.025880033, + 0.05560802, + 0.010266881, + -0.049035855, + -0.017366866, + 0.0046864995, + 0.049682856, + 0.0035797877, + -0.0016983772, + 0.028008327, + 0.021265896, + -0.009968921, + 0.0008433358, + -0.05826413, + -0.02041458, + -0.0031626422, + -0.04672027, + -0.0029264018, + -0.057174444, + 0.07532452, + -0.017324299, + -0.023922006, + -0.019273814, + 0.029421512, + 0.015442888, + -0.026101377, + 0.03667473, + 0.008134333, + -0.0445409, + -0.065789774, + 0.005831521, + -0.0015813211, + 0.012735701, + -0.011118199, + -0.007827859, + 0.0025582074, + 0.0273443, + 0.031958435, + 0.004588598, + 0.02664622, + 0.03946705, + 0.009628395, + -0.049172066, + 0.011194818, + -0.010326474, + -0.016804995, + -0.041067526, + -0.033865385, + -0.034188885, + -0.045596533, + -0.011084146, + -0.014702243, + 0.025471402, + 0.027940221, + 0.0012769754, + 0.0054739676, + 0.010522277, + -0.01767334, + -0.0046481905, + 0.00092953164, + ], + "artificial intelligence": [ + 0.0007339762, + -0.0160488, + -0.01467342, + -0.031772066, + 0.014583899, + -0.0077843186, + -0.026823957, + 0.04798363, + -0.0060427147, + 0.009204458, + 0.0289562, + -0.1060588, + -0.04270999, + -0.057651974, + -0.005993885, + 0.0031983661, + 0.002504573, + -0.050750665, + 0.049839173, + -0.07161736, + 0.0074140243, + 0.013884002, + 0.004883002, + -0.028923647, + -0.009961324, + -0.014828049, + 0.027116938, + 0.020720204, + -0.017725296, + 0.0046591978, + -0.0021017254, + -0.038673375, + 0.03851061, + -0.03273239, + 0.04397957, + 0.028288858, + -0.004419117, + 0.009131214, + -0.0039084363, + 0.0060834065, + 0.014754804, + 0.01770902, + 0.048341718, + 0.06312094, + -0.010148506, + 0.007588999, + -0.010026431, + -0.009863663, + -0.004309249, + 0.0666367, + -0.039845295, + -0.007068145, + -0.037892096, + 0.057098567, + -0.033139307, + 0.08060209, + -0.0036703898, + 0.04114743, + 0.012256335, + 0.033464838, + -0.04651873, + 0.0009791437, + 0.036524855, + 0.012085429, + -0.1060588, + -0.062307104, + 0.007259396, + 0.05322472, + -0.016797526, + -0.01819732, + -0.034018245, + 0.009025415, + -0.03825018, + 0.010848402, + 0.021615421, + -0.017041676, + -0.049578745, + 0.0681016, + 0.017725296, + 0.032651007, + -0.015177998, + 0.030828018, + 0.0022319388, + -0.06520435, + -0.014103737, + -0.02480565, + -0.06474861, + -0.0075116847, + -0.067580745, + -0.03668762, + -0.019108813, + 0.03414846, + -0.026058953, + 0.047690652, + 0.00078636676, + 0.060158584, + 0.09082384, + 0.0077314195, + 0.0042644884, + 0.033888035, + -0.059116878, + -0.046225753, + 0.0018870768, + 0.032797497, + 0.0125249, + -0.04319829, + 0.008724296, + 0.013525915, + -0.0021505554, + 0.0017680536, + -0.028240027, + -0.066669255, + -0.056610268, + -0.015576776, + -0.0028158645, + -0.043849356, + 0.0289562, + 0.009643929, + 0.0069989692, + -0.04563979, + -0.032374304, + 0.029135244, + 0.013338733, + 0.028402794, + -0.010783296, + 0.005318403, + 0.029656097, + -0.024594054, + -0.050229814, + -0.01228075, + -0.011605267, + 0.015788373, + 0.037241027, + -0.0063967323, + 0.012093568, + -0.055601116, + 0.027621513, + 0.029460778, + -0.01805083, + -0.04456553, + 0.023666283, + 0.031104721, + -0.06409754, + 0.060191136, + -0.01726955, + -0.02329192, + -0.0063234875, + -0.0289562, + 0.00095778046, + 0.040528916, + -0.025570653, + 0.0013336699, + -0.0070966296, + -0.039552316, + -0.0486347, + -0.013468947, + -0.04290531, + 0.0023947055, + -0.0030742567, + -0.011881971, + -0.02480565, + 0.0014292953, + -0.0012146467, + -0.03385548, + -0.08958681, + 0.037957203, + 0.006482185, + 0.021013185, + -0.03685039, + -0.008683605, + -0.039454654, + -0.0028992824, + -0.0019043707, + 0.013118998, + 0.010685636, + 0.00430518, + 0.013135275, + -0.015348903, + -0.032634728, + -0.033464838, + -0.050718114, + 0.04941598, + -0.031804617, + 0.04700703, + 0.034181014, + -0.016130183, + 0.0058189104, + 0.0042889034, + -0.016911464, + 0.010425209, + 0.0063763866, + 0.030144399, + 0.04212403, + 0.04134275, + 0.06194902, + -0.03805486, + 0.036720175, + 0.008496423, + 0.043230843, + 0.01663476, + 0.07480759, + -0.07077097, + -0.002402844, + 0.021794464, + 0.010832126, + -0.01731838, + 0.048178952, + 0.012728359, + -0.023666283, + -0.018067107, + 0.059181985, + -0.08997745, + 0.06849224, + -0.02034584, + -0.06484626, + -0.020915525, + 0.039617423, + 0.018018277, + -0.029037584, + 0.048374273, + -0.035938893, + 0.012248197, + 0.01692774, + 0.01951573, + -0.028972479, + -0.00694607, + 0.038608268, + -0.046876818, + -0.0035971447, + 0.018425195, + 0.0006439459, + -0.0002784837, + -0.05215046, + -0.010115952, + -0.009237012, + 0.010848402, + 0.01438044, + -0.0038738481, + 0.026693743, + 0.01819732, + 0.027898217, + 0.010994893, + 0.032488238, + -0.01267139, + -0.049123, + 0.05993071, + 0.04970896, + 0.025245119, + 0.009041692, + -0.020557437, + 0.03590634, + -0.077867605, + 0.03336718, + 0.01668359, + 0.019059984, + 0.0045452607, + 0.017692743, + 0.043133184, + 0.032032494, + 0.010522869, + -0.051792372, + 0.030632699, + -0.035776127, + -0.047690652, + 0.035190165, + -0.01941807, + 0.004830103, + 0.038705926, + -0.0074343705, + -0.031625576, + -0.016455716, + 0.065627545, + 0.022787342, + 0.0030905332, + -0.040301044, + 0.0136968205, + 0.0029521815, + 0.039812744, + -0.04990428, + 0.10547284, + 0.007991847, + -0.0071006985, + 0.090758726, + -0.026400764, + -0.02827258, + 0.009546269, + -0.025749696, + -0.06771096, + -0.021696804, + -0.0340508, + 0.020166798, + 0.0007131217, + 0.021957232, + -0.014819911, + 0.025131183, + -0.002539161, + 0.024349902, + 0.08190422, + -0.00043438372, + 0.04251467, + 0.13997939, + -0.04544447, + 0.00042293916, + -0.014014215, + -0.018620513, + 0.07676079, + -0.06657159, + -0.009643929, + 0.063316256, + -0.0175137, + 0.040333595, + 0.00023804634, + -0.0065228767, + 0.0014913501, + -0.052117907, + -0.054298982, + -0.010262442, + -0.020524884, + 0.03414846, + -0.053550255, + -0.050750665, + 0.009570683, + 0.03639464, + -0.052899186, + -0.09349321, + -0.047527883, + 0.022836173, + 0.030665252, + -0.026644913, + -0.026823957, + -0.031153552, + 0.05905177, + -0.0030884987, + 0.014364163, + -0.0021098638, + -0.027572684, + 0.009554407, + 0.029477054, + -0.05885645, + -0.009888079, + -0.035352934, + -0.026726296, + -0.116215445, + 0.061265398, + -0.092777036, + 0.014730389, + -0.0130945835, + -0.06282796, + 0.040594023, + 0.0014954193, + 0.026823957, + -0.04202637, + 0.036296982, + -0.03317186, + -0.09746472, + -0.005338749, + -0.045802556, + -0.012590007, + -0.0036764934, + -0.011979631, + -0.086136155, + 0.012793465, + 0.041049767, + 0.020785311, + -0.0065269456, + 0.018034553, + 0.0005452685, + -0.035873786, + 0.031723235, + -0.016398748, + -0.026303103, + -0.02968865, + 0.01853913, + -0.054657068, + -0.022836173, + -0.024252243, + -0.048178952, + 0.02592874, + -0.061232843, + 0.02446384, + 0.002166832, + -0.04117998, + -0.0016225808, + -0.040333595, + -0.013582883, + 0.023959262, + -0.015064061, + -0.0063967323, + -0.057163674, + 0.010360102, + 0.032618452, + -0.06771096, + 0.021045739, + -0.0128585715, + -0.04964385, + 0.0006876894, + -0.036524855, + -0.023243088, + -0.0063234875, + 0.094404705, + 0.005078322, + -0.0071658054, + 0.012516761, + 0.022771066, + -0.0053061955, + 0.018880941, + -0.012492347, + 0.04095211, + 0.012891125, + 0.057586867, + 0.034311228, + -0.05146684, + 0.040756788, + 0.039064016, + 0.0047202352, + -0.01795317, + 0.016463855, + 0.026433317, + -0.018604238, + -0.016846357, + -0.016610345, + -0.05195514, + 0.06318604, + -0.024756819, + 0.05270387, + 0.07832335, + 0.051499393, + -0.01272022, + 0.0428402, + -0.027279703, + 0.06286051, + 0.048341718, + -0.03199994, + -0.05534069, + -0.031430256, + 0.03234175, + 0.03971508, + 0.027816834, + -0.075523764, + 0.022038614, + 0.012174951, + -0.017350933, + -0.045314256, + -0.084117845, + -0.058628574, + -0.003869779, + -0.04524915, + 0.019255305, + -0.031479087, + -0.08971702, + -0.034994848, + -0.034376334, + -0.009326533, + 0.039389547, + -0.011458778, + -0.05488494, + 0.029607268, + 0.012297027, + 0.002113933, + 0.052215565, + 0.010522869, + -0.058433257, + -0.062079232, + 0.06985948, + 0.01853913, + 0.023991816, + 0.025603207, + 0.030193228, + -0.03322069, + -0.020703929, + -0.08398763, + -0.037468903, + 0.04046381, + -0.0022990801, + 0.008447593, + 0.001362154, + 0.08203443, + -0.031527914, + -0.002675478, + -0.028044708, + -0.03336718, + -0.0060305074, + -0.013200382, + 0.0064984616, + -0.027475024, + 0.046746604, + 0.0069135167, + -0.04349127, + 0.0128585715, + 0.03483208, + -0.0074832, + -0.035125062, + 0.11133245, + -0.01687891, + 0.029298011, + -0.017969446, + 0.037436347, + -0.045802556, + -0.015047784, + -0.01736721, + -0.065269455, + -0.034376334, + -0.06946884, + 0.030242058, + -0.069599055, + 0.004174967, + 0.0022482155, + 0.045216598, + 0.033497393, + 0.004081376, + 0.008223789, + 0.010726327, + 0.015772097, + 0.02710066, + -0.011580853, + 0.02558693, + 0.015145444, + 0.050229814, + 0.04020338, + -0.05654516, + 0.003727358, + -0.07011991, + -0.01907626, + 0.003997958, + 0.037729327, + -0.04651873, + -0.0011312288, + -0.0032817842, + -0.055796433, + -0.026986724, + 0.03532038, + 0.019873818, + 0.04117998, + 0.020606268, + -0.05488494, + 0.010213613, + 0.02656353, + 0.0320976, + -0.07578419, + 0.024984693, + 0.011995908, + -0.013884002, + 0.004443532, + 0.0033875825, + -0.032374304, + 0.022152552, + -0.05019726, + -0.058140274, + -0.00079603103, + 0.0690131, + 0.034115907, + 0.029151522, + 0.01585348, + -0.018148491, + 0.011092553, + 0.004980662, + 0.050360028, + -0.049057893, + -0.00052543136, + -0.011312287, + -0.015129168, + -0.006339764, + 0.053354934, + -0.018653067, + -0.019255305, + 0.0042685573, + 0.023747666, + -0.01017292, + 0.0313977, + 0.007320434, + -0.017204443, + -0.0005155128, + 0.0049969386, + -0.040431257, + -0.0032655075, + 0.0018423159, + 0.03997551, + -0.016944017, + -0.005851464, + 0.03243941, + -0.041993815, + -0.046681497, + -0.011588991, + 0.052573655, + -0.035548255, + 0.021257335, + -0.020280734, + 0.019776158, + 0.021354996, + 0.021550315, + 0.037599113, + 0.03492974, + -0.037794434, + -0.033985693, + -0.0059857466, + -0.018815834, + 0.009155628, + 0.027507577, + -0.02329192, + 0.01824615, + -0.006331626, + 0.0070274537, + 0.035645913, + 0.01927158, + -0.029135244, + -0.030844295, + -0.025180014, + 0.05322472, + 0.02851673, + -0.03395314, + 0.020850418, + 0.0013031511, + 0.00070600066, + -0.020443501, + -0.015837202, + -0.028142367, + 0.0060874755, + 0.034408886, + 0.058237936, + -0.023324473, + -0.06732032, + -0.016862633, + 0.028223751, + 0.007564584, + -0.012329579, + -0.016455716, + -0.021843296, + 0.009595099, + -0.030958232, + -0.0002193536, + 0.013981662, + 0.10755625, + 0.028842265, + -0.026384486, + -0.0060386457, + -0.029070137, + 0.0075971372, + -0.00026653052, + 0.020036584, + -0.033041645, + -0.012459793, + 0.026742574, + -0.0020427224, + -0.07988591, + 0.050164707, + -0.024821926, + -0.029493332, + -0.014209536, + -0.0418636, + 0.0022197312, + -0.030779188, + -0.019955201, + -0.035190165, + 0.0009226839, + 0.059409857, + -0.053387485, + -0.0085127, + -0.023438409, + 0.042970415, + 0.0076093446, + -0.05136918, + -0.04212403, + 0.034864634, + -0.014933848, + 0.02270596, + 0.054754727, + 0.024496393, + 0.043914463, + 0.049676407, + 0.010791434, + -0.004378425, + 0.0049481085, + -0.014518792, + 0.0044923616, + 0.017627636, + -0.045379363, + 0.031544194, + -0.03948721, + 0.015731404, + -0.033432286, + -0.03717592, + -0.018734451, + -0.049090445, + -0.029184075, + 0.04843938, + -0.011279735, + 0.07929995, + 0.019385517, + -0.008154613, + -0.061265398, + -0.05459196, + -0.034115907, + 0.031804617, + 0.022819895, + -0.022771066, + 0.033009093, + 0.017383486, + 0.060744543, + -0.06250242, + 0.04280765, + -0.01795317, + 0.056089416, + 0.06445563, + -0.043816805, + -0.015064061, + 0.04300297, + 0.0069013094, + 0.00875685, + 0.032797497, + 0.022640852, + -0.04726746, + 0.0021261403, + 0.02397554, + 0.009570683, + -0.024756819, + 0.015096614, + 0.014860602, + 0.026775127, + 0.039454654, + -0.041570622, + -0.008675466, + -0.008016261, + -0.0010681567, + 0.00026297, + -0.032716114, + -0.061135184, + -0.029281735, + -0.0035645913, + 0.008862648, + 0.025765974, + -0.0064455625, + -0.028256305, + -0.006970485, + -0.0024435355, + 0.069989696, + -0.0050416994, + -0.0525411, + -0.04085445, + -0.0423519, + -0.009839249, + 0.019645944, + -0.026303103, + 0.015780235, + -0.0019287857, + -0.048992787, + 0.0017955204, + 0.00091505423, + 0.052606206, + -0.0102217505, + -0.015731404, + -0.037468903, + 0.009969462, + 0.007621552, + -0.019629668, + -0.021062015, + 0.0077517657, + -0.016813803, + -0.0681016, + 0.009114937, + 0.02631938, + -0.012142398, + 0.0005050855, + 0.020313287, + -0.0016459785, + 0.029786311, + -0.030909402, + 0.03243941, + -0.03483208, + ], +} diff --git a/tests/pg_vectorizer_test.py b/tests/pg_vectorizer_test.py index b4250dc..2ea6ef4 100644 --- a/tests/pg_vectorizer_test.py +++ b/tests/pg_vectorizer_test.py @@ -2,6 +2,7 @@ from typing import Any import psycopg2 +import pytest from langchain.docstore.document import Document from langchain.text_splitter import CharacterTextSplitter from langchain_community.vectorstores.timescalevector import TimescaleVector @@ -32,6 +33,7 @@ def get_document(blog: dict[str, Any]) -> list[Document]: @http_recorder.use_cassette("pg_vectorizer.yaml") +@pytest.mark.skip("breaks because the langchain vector store is not up to date") def test_pg_vectorizer(service_url: str) -> None: with psycopg2.connect(service_url) as conn, conn.cursor() as cursor: for item in ["blog", "blog_embedding_work_queue", "blog_embedding"]: @@ -69,6 +71,8 @@ def embed_and_write(blog_instances: list[Any], vectorizer: Vectorize) -> None: # delete old embeddings for all ids in the work queue metadata_for_delete = [{"blog_id": blog["locked_id"]} for blog in blog_instances] + # TODO: This delete call fails because the vectore_store in langchain is not set up + # to provide the table names correctly vector_store.delete_by_metadata(metadata_for_delete) documents: list[Document] = [] diff --git a/tests/sample_tables/blog.sql b/tests/sample_tables/blog.sql new file mode 100644 index 0000000..41a7530 --- /dev/null +++ b/tests/sample_tables/blog.sql @@ -0,0 +1,132 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 16.4 (Ubuntu 16.4-1.pgdg22.04+2) +-- Dumped by pg_dump version 16.4 (Ubuntu 16.4-1.pgdg22.04+2) + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +-- +-- Name: blog; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.blog ( + id integer NOT NULL, + title text, + authors text, + contents text, + metadata jsonb +); + + +ALTER TABLE public.blog OWNER TO postgres; + +-- +-- Name: blog_contents_embeddings_store; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.blog_contents_embeddings_store ( + embedding_uuid uuid DEFAULT gen_random_uuid() NOT NULL, + id integer NOT NULL, + chunk_seq integer NOT NULL, + chunk text NOT NULL, + embedding public.vector(768) NOT NULL +); + + +ALTER TABLE public.blog_contents_embeddings_store OWNER TO postgres; + +-- +-- Name: blog_contents_embeddings; Type: VIEW; Schema: public; Owner: postgres +-- + +CREATE VIEW public.blog_contents_embeddings AS + SELECT t.embedding_uuid, + t.chunk_seq, + t.chunk, + t.embedding, + t.id, + s.title, + s.authors, + s.contents, + s.metadata + FROM (public.blog_contents_embeddings_store t + LEFT JOIN public.blog s ON ((t.id = s.id))); + + +ALTER VIEW public.blog_contents_embeddings OWNER TO postgres; + +-- +-- Name: blog_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.blog_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER SEQUENCE public.blog_id_seq OWNER TO postgres; + +-- +-- Name: blog_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.blog_id_seq OWNED BY public.blog.id; + + +-- +-- Name: blog id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.blog ALTER COLUMN id SET DEFAULT nextval('public.blog_id_seq'::regclass); + + +-- +-- Data for Name: blog; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +INSERT INTO public.blog VALUES (1, 'Getting Started with PostgreSQL', 'John Doe', 'PostgreSQL is a powerful, open source object-relational database system...', '{"tags": ["database", "postgresql", "beginner"], "read_time": 5, "published_date": "2024-03-15"}'); +INSERT INTO public.blog VALUES (2, '10 Tips for Effective Blogging', 'Jane Smith, Mike Johnson', 'Blogging can be a great way to share your thoughts and expertise...', '{"tags": ["blogging", "writing", "tips"], "read_time": 8, "published_date": "2024-03-20"}'); +INSERT INTO public.blog VALUES (3, 'The Future of Artificial Intelligence', 'Dr. Alan Turing', 'As we look towards the future, artificial intelligence continues to evolve...', '{"tags": ["AI", "technology", "future"], "read_time": 12, "published_date": "2024-04-01"}'); +INSERT INTO public.blog VALUES (4, 'Healthy Eating Habits for Busy Professionals', 'Samantha Lee', 'Maintaining a healthy diet can be challenging for busy professionals...', '{"tags": ["health", "nutrition", "lifestyle"], "read_time": 6, "published_date": "2024-04-05"}'); +INSERT INTO public.blog VALUES (5, 'Introduction to Cloud Computing', 'Chris Anderson', 'Cloud computing has revolutionized the way businesses operate...', '{"tags": ["cloud", "technology", "business"], "read_time": 10, "published_date": "2024-04-10"}'); + + +-- +-- Data for Name: blog_contents_embeddings_store; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +INSERT INTO public.blog_contents_embeddings_store VALUES ('18d4ea41-bd00-4d21-bdae-a3ad5d812026', 1, 0, 'PostgreSQL is a powerful, open source object-relational database system...', '[-0.025076354,0.027124027,0.032059833,-0.0073158466,0.009841056,-0.02596266,-0.0074915797,0.023624646,-0.064486414,-0.036430243,0.037499923,-0.038569603,-0.0014268766,-0.038202856,0.03343514,0.00011263873,-0.011797042,-0.01832209,-0.019101428,0.04388744,0.01980436,-0.0042978213,-0.01258402,-0.020446168,0.044070814,0.007067528,-0.076466836,0.00053292984,-0.018826367,-0.08777488,0.0041526505,-0.032334894,-0.02007942,0.0009130482,0.007189777,-0.0009970944,0.0527505,0.0055737966,-0.02582513,0.034871567,-0.00213936,-0.00816777,0.06650353,-0.0032873556,0.00033881157,0.025993222,-0.026955934,-0.1127137,0.02489298,0.0023361046,-0.0049854727,0.020537855,0.0246332,-0.009978586,0.063691795,-0.016243853,0.029507885,0.027995052,0.022417435,0.006089535,0.017160723,-0.04147302,0.019911328,-0.022723058,-0.04630186,0.0057036863,-0.050550018,0.0038661289,-0.014685177,-0.004802099,0.020690667,0.03328233,-0.026023785,0.007999677,0.09193135,-0.06509766,0.017542752,0.02289115,-0.007892709,-0.023471834,0.0006260493,0.025855692,0.00011639932,-0.042848323,0.014119775,-0.014135056,-0.030088568,0.0048785047,-0.032365456,0.025580632,-0.073899604,0.014196181,0.05177251,0.035513375,0.01083433,-0.011682433,-0.02984407,-0.011086469,-0.035880122,0.0013370999,-0.022845307,-0.034718756,-0.019972453,-0.010184881,0.041809205,-0.027643586,0.051069576,0.06540328,0.020858759,0.051894758,-0.08349616,0.0058679585,0.008152489,-0.018642994,0.011201077,0.0062538073,0.023196774,0.011544903,0.020262795,-0.03960872,-0.0072356206,-0.027093465,-0.053759057,-0.015074846,0.0709045,-0.019315364,0.031418025,-0.017970623,0.015953511,-0.017619157,0.057732154,-0.00548593,0.054156367,-0.016503634,0.0030046545,0.027124027,-0.060666133,-0.05125295,0.012690988,-0.020583699,0.0040533226,-0.0063072913,0.00061888626,0.010375896,-0.07499985,-0.08685801,0.0024048698,0.03814173,-0.045660052,0.017405221,-0.011223999,0.023135649,-0.011231639,0.015220017,-0.008244176,0.017405221,0.056937534,0.059779827,-0.049724836,-0.0027506056,0.0060551525,0.028942483,0.024786012,0.027857522,0.01887221,0.017023193,-0.027368525,0.012469412,-0.037652735,-0.03786667,0.022906432,-0.03239602,-0.0024144205,0.024969386,-0.035513375,0.06925414,0.028224269,-0.028835515,0.031968147,-0.08471865,-0.034046385,0.031907022,0.017313534,0.046240736,0.046485234,-0.030195536,-0.013554373,0.065158784,-0.036430243,0.076038964,-0.022172937,0.045935113,-0.026512781,0.027215714,0.031112405,0.0021966642,-0.0010610843,0.041839767,-0.08331279,-0.005875599,0.004939629,-0.0071401135,0.031784773,-0.013554373,-0.065708905,-0.081417926,0.02234103,0.008893625,-0.010635675,-0.047035355,0.0025252088,-0.05149745,-0.0020648644,-0.009932742,0.017206566,-0.06405854,-0.0029874633,0.041717518,-0.017481627,-0.053300623,-0.02435814,-0.009466668,0.03890579,-0.008121926,0.06198031,0.046362985,0.06858177,-0.00668932,0.007308206,-0.110757716,-0.028422924,-0.0713935,-0.010887814,-0.05846565,0.0004343187,0.008396988,-0.015426313,0.030440034,-0.016564758,-0.018673556,-0.00022742637,-0.006207964,-0.022111813,-0.019850204,0.025488945,0.0022367772,-0.024113642,0.0072891046,0.0371943,0.030058006,0.070843376,0.016473072,0.025534788,-0.038875226,-0.025320852,-0.07157687,-0.052781064,0.014868551,0.00016665996,-0.008534518,-0.052811626,-0.024847137,-0.043276194,-0.03465763,-0.034290884,0.033740763,0.025336133,-0.010903095,-0.036949802,-0.044987682,0.056937534,0.06754265,0.03716374,-0.0441625,-0.01778725,-0.00762911,0.025870973,0.029935757,0.044743184,0.0030447675,-0.023303742,-0.064486414,-0.024235891,0.048807967,0.04174808,0.01806231,-0.028575735,0.026436375,0.055715043,0.021729784,0.0026550984,-0.03227377,-0.017466346,0.036491368,-0.022447998,0.015953511,0.046790857,0.03450482,-0.039517034,0.00642572,0.08661351,0.05837396,-0.012752113,-0.021470005,-0.029966319,-0.025580632,0.037377674,-0.031784773,-0.011735917,-0.016014636,-0.006987302,-0.0118887285,0.0149908,-0.042084266,-0.052903313,0.008626205,0.010116116,0.0066052736,-0.019651549,-0.087836005,0.014761583,-0.04364294,0.031158248,-0.012721551,-0.04669917,0.03037891,-0.052567128,0.0028919561,0.08068443,0.017282972,0.020721229,-0.0020419424,-0.044498686,0.06564778,0.0039062419,-0.0952932,-0.011025344,0.109412976,-0.042084266,-0.051161263,-0.014173259,0.03667474,-0.03691924,0.06845952,-0.026528062,0.022646653,-0.04935809,0.023502396,0.051741946,-0.038997475,-0.050611142,0.0019884584,0.019055584,0.09455971,0.053025562,-0.08215142,0.020568417,-0.019223677,-0.042848323,0.0057609905,0.0025481305,0.024067799,-0.032059833,-0.020812916,-0.037958357,-0.0037457899,-0.018291527,0.0130271735,-0.055195484,-0.025091635,0.011277483,0.023746895,-0.021897877,-0.019086147,0.037927795,0.0075794463,-0.050488893,0.032640517,-0.047310416,0.059718702,0.010368255,0.04190089,-0.02501523,0.025106916,0.037408236,0.03383245,0.06540328,-0.023166211,-0.039547596,0.026191877,0.075122096,0.009565995,0.022127094,-0.0013199087,-0.094009586,-0.0264975,-0.01552564,-0.005741889,-0.0060704337,0.032212645,-0.034138072,-0.0632028,-0.013286953,-0.0038298361,-0.067481525,0.038691852,-0.015334626,0.08202917,-0.014906754,-0.036980364,0.0016389025,-0.038172293,0.06326392,0.002339925,0.026604468,-0.037958357,-0.059596453,0.013340437,-0.017909499,0.044895995,0.077139206,-0.0066740387,-0.056540225,0.015831262,-0.038202856,0.052108694,0.00031087574,-0.053606246,-0.02328846,-0.025916817,0.039975468,0.007063708,0.017176004,-0.026558625,-0.030088568,-0.0037839927,0.02287587,-0.013157063,0.06931526,-0.0017086227,0.01136917,-0.0077857417,-0.020828197,-0.0052758143,-0.054278616,0.008335863,-0.015953511,-0.02235631,0.01778725,0.03691924,-0.006303471,-0.024510952,0.008503956,-0.021729784,0.059596453,-0.027857522,-0.007892709,-0.010735002,0.0108572515,-0.039364222,0.04095346,0.02823955,-0.080195434,0.066259034,-0.0012654696,-0.09792156,0.044070814,0.06265268,-0.008779016,-0.02342599,-0.001766882,0.055042673,-0.019651549,-0.0067007807,0.042359326,-0.020186389,-0.0056769443,-0.020308638,-0.04963315,-0.07830057,0.033496264,-0.01671757,0.068948515,0.013531451,-0.007426635,0.024510952,0.0035681466,0.0035643263,0.05204757,-0.0012893464,-0.0337102,0.02475545,0.09645457,-0.013668981,-0.078850694,-0.0007640571,-0.101650156,-0.04199258,-0.00063225726,-0.024419265,0.03051644,-0.018536026,-0.070293255,0.026665593,-0.004034221,0.05458424,0.028178426,-0.004187033,0.029630134,-0.039517034,-0.009596557,0.0273074,-0.005845037,-0.008756095,0.03077622,-0.0033905033,-0.0147157395,0.048655156,-0.010673878,-0.044651497,0.013867636,-0.02863686,-0.06259155,-0.006265268,-0.023364866,-0.026329407,-0.05458424,-0.027215714,0.020247513,-0.0511307,0.0030695994,-0.0037572507,0.033679638,-0.03202927,-0.05981039,-0.01619801,-0.030226098,-0.019483456,-0.052689377,0.039944906,-0.023120368,0.015831262,-0.041839767,0.029355073,0.02154641,0.026268283,0.010727362,-0.016014636,0.029324511,0.024388703,0.041839767,0.013256391,-0.00046607482,0.029431479,0.070293255,-0.023059243,-0.018536026,0.02448039,0.011086469,0.06399742,0.015586765,0.015510359,0.02958429,0.0056769443,-0.008481034,0.033404578,0.01243885,-0.06259155,-0.023395428,0.018627713,-0.032457143,0.06387517,-0.035146628,0.03545225,0.0080837235,0.04297057,-0.031081842,-0.029737102,0.070843376,0.009863977,0.0025500406,-0.048013348,-0.015158893,0.031265214,-0.022845307,-0.03731655,0.051191825,0.013088298,0.010200162,0.018688837,-0.0049969335,0.0040265806,-0.016029917,-0.038233418,0.00016307844,-0.012377725,-0.015212377,0.024251172,-0.0264975,0.003466909,0.022707777,-0.019086147,-1.4064918e-06,0.0074228146,-0.0015433953,-0.03572731,0.01619801,0.0067122416,0.013218188,-0.007468658,0.031540275,0.021179663,-0.006265268,-0.027551899,-0.023716332,0.03707205,-0.034076948,0.030333066,0.006677859,-0.05861846,-0.037377674,0.03957816,-0.036613617,0.00909228,0.028667422,0.025106916,-0.055073235,0.009970945,-0.032243207,0.034871567,0.027383806,-0.028682703,0.050152708,-0.0313569,0.071149,0.035238314,0.04590455,-0.026741998,0.04697423,-0.047127042,0.024694325,0.079523064,-0.0016541836,-0.038202856,0.035268877,-0.0238233,-0.02449567,0.02342599,-0.03609406,-0.03092903,0.008725532,-0.018367933,0.047157604,0.008947109,0.00521851,-0.00085335626,-0.006849772,-0.0074113538,0.025106916,0.056906972,-0.047677163,0.027536618,0.023563521,0.011590746,0.008114286,0.0034076946,-0.04978596,0.02475545,0.03426032,-0.018398495,0.010345333,-0.00044888354,0.048532907,-0.0029893734,0.034413133,0.0025882435,0.047279853,-0.023914987,-0.019468175,0.09786043,0.022050688,0.020140545,-0.0011585016,-0.04963315,0.013470327,0.015342266,-0.030944312,-0.0126527855,0.057579342,0.020843478,0.031280495,-0.041411895,0.008221254,0.015831262,0.036155183,-0.036338557,0.010941298,0.051436324,0.020018296,-0.035482813,0.017771969,0.051619697,-0.021699222,-0.08979199,-0.070965625,-0.0030333067,-0.030669251,-0.01566317,-0.020186389,-0.010368255,0.011025344,0.04550724,-0.032732204,-0.00036412096,-0.009374981,-0.011231639,0.009245091,-0.013546732,0.023364866,-0.013004252,-0.004603444,-0.015571483,-0.00084667077,-0.06662578,0.036552493,-0.020354481,0.04309282,0.05727372,-0.08893625,0.0095583545,0.049541462,0.0027945389,0.063019425,0.02435814,0.02006414,-0.02061426,0.010521066,0.00669314,-0.049296964,-0.0036101697,-0.020293357,-0.015594405,-0.050274957,-0.04052559,-0.036216307,-0.06418079,0.0054133446,0.0987773,0.028407643,-0.000816586,-0.033343453,0.008213613,0.049938772,-0.006704601,0.015426313,-0.03973097,-0.028973045,-0.009940383,-0.03921141,0.03691924,-0.021210225,0.04297057,0.01899446,-0.0019655367,-0.021882595,0.019086147,-0.0063340333,-0.009405543]'); +INSERT INTO public.blog_contents_embeddings_store VALUES ('52f1f5be-8409-46f7-8161-5f8d00dda4e5', 2, 0, 'Blogging can be a great way to share your thoughts and expertise...', '[0.063762635,-0.018606776,-0.008967121,0.03490772,0.034747593,-0.07096836,-0.0068294234,0.049671445,-0.038942926,0.04003179,0.018718865,0.0049759517,0.04781397,-0.018078357,0.019119183,0.021457039,-0.038366467,0.0060167783,0.09722921,0.06059212,0.008646866,-0.006453125,0.02457952,0.04150496,-0.00019790717,-0.039071027,0.003951138,-0.0009287375,0.017069556,-0.0462127,0.04480358,-0.021184823,-0.020592352,0.023955023,0.020912608,0.05300209,0.017726077,-0.055628177,0.042721927,0.008182498,0.03282607,0.05607653,0.06962329,0.08698107,-0.015484297,-0.0030023842,-0.09127248,-0.07628458,0.08678892,0.048742708,0.054058928,0.005092044,0.028198393,-0.0029143144,-0.055692226,-0.011489124,-0.040864453,-0.0073418305,-0.067317456,0.017277721,0.007766167,-0.017469874,0.084675245,-0.025780473,-0.014019133,-0.015572366,0.00683743,-0.045604214,-0.04787802,-0.05588438,0.08153675,-0.01657316,-0.01470768,0.015876608,-0.0231704,-0.061168574,-0.021745268,-0.013899038,0.026388956,-0.065716185,-0.04038407,-0.007854237,-0.01002396,-0.043778766,-0.03442734,-0.022946222,-0.054859564,-0.015412239,-0.12829389,0.009831808,-0.021376977,-0.008446707,0.0462127,0.011425073,0.07141671,0.041889265,-0.026485033,0.0043714717,0.017662026,0.023314515,0.020560328,-0.018014306,-0.016845377,0.0067653726,0.06405086,-0.040416095,0.005520384,0.03756583,0.04185724,0.0056925206,-0.10299379,-0.031176759,-0.030280046,-0.054219056,0.033274423,0.012922262,0.04592447,-0.034523416,-0.008983133,-0.041472934,-0.026597122,-0.008270568,-0.03207347,0.0050680246,0.016637212,-0.08057599,-0.07493951,0.06955924,-0.0046597,-0.065139726,0.06427504,-0.05341842,0.07327419,-0.066484794,-0.013242517,-0.0077061197,-0.0070976363,-0.019487476,-0.02611674,-0.07654078,0.06504365,0.017710064,-0.02642098,-0.00196456,-0.022625968,-0.08294587,-0.022706032,0.022113562,0.0017864186,0.0068534426,0.01565243,0.036508992,-0.050952464,0.067125306,0.062769845,-0.008782974,0.000760604,-0.01123292,0.009151267,0.0047757924,0.06904683,0.044195097,-0.038366467,0.03900698,-0.011833397,0.083458275,-0.008446707,0.012738116,-0.045700293,-0.1035062,-0.034875695,-0.08717322,0.029399347,0.026388956,-0.000721573,0.02758991,0.036476966,0.0018925029,-0.008831013,0.027990228,-0.031272836,0.001677332,0.009191299,0.03420316,-0.03526,-0.0033146322,0.016381009,-0.03213752,0.012778147,0.0033466576,-0.057613753,0.02092862,-0.020480264,0.016637212,0.067317456,0.048134226,0.020576341,0.054571338,-0.066933155,0.03391493,0.02576446,0.029015042,-0.038174316,-0.01668525,-0.013442676,0.007293792,-0.016669238,0.0070736175,-0.034587465,-0.066356696,-0.007057605,-0.015620405,-0.012161658,-0.024835723,-0.0443232,-0.0052201455,-0.020800518,0.0462127,-0.05354652,0.02352268,-0.065524034,-0.043074206,0.02794219,-0.020800518,0.0146756545,0.04550814,0.05601248,-0.030632326,0.025460219,-0.039359257,0.06373061,-0.012417861,-0.061937187,-0.052041326,0.0816008,0.011833397,-0.011649251,-0.025860537,0.020063933,0.012946281,0.006845436,-0.02334654,-0.038782798,-0.014779737,-0.025604334,0.04313826,-0.04605257,-0.030904543,0.008863038,0.06465935,0.0740428,0.027766049,-0.0064371116,0.014123215,0.02664516,-0.068342276,0.020672416,-0.02818238,0.048198275,-0.05313019,0.04333041,-0.013170459,0.0031865304,-0.028518647,-0.0010002943,-0.0019045124,-0.0851236,0.037693933,-0.001975569,-0.063954785,-0.00883902,0.016589174,-0.036476966,-0.00899114,0.0045115827,-0.014307362,-0.003042416,-0.0031565067,-0.037181526,0.059343126,-0.034875695,0.0003417714,0.02823042,-0.01815842,-0.004939923,-0.024307303,0.022433816,0.02411515,0.01365084,-0.0046837195,-0.06725341,0.014491508,0.03843052,0.019647602,0.026613135,0.030135931,-0.0037289613,-0.029559474,0.009943897,-0.016477086,-0.010768551,-0.03442734,-0.0026641157,0.05617261,0.0140991965,-0.019359374,0.017710064,-0.01123292,0.013738911,-0.027734024,-0.02670921,0.018526712,0.011945486,-0.046180673,-0.041633062,0.012425868,-0.03378683,-0.0016833368,0.013947076,-0.11561181,0.018718865,-0.040992554,0.06049604,-0.07570812,0.00014674153,-0.03862267,0.030760428,0.04768587,0.009287375,-0.045476113,0.003911106,0.045187883,-0.022930209,0.061392754,-0.0016152827,-0.05322627,0.019711653,-0.027029464,0.024963824,-0.0102001,-0.03314632,-0.0141792605,-0.020031909,-0.018670827,0.03724558,0.009199305,-0.013979102,0.07602838,-0.05594843,0.016364995,-0.017277721,0.016989492,-0.045732316,0.02523604,0.01488382,-0.004783799,-0.027637947,0.011913461,-0.059503254,-0.015164042,0.011985518,-0.0032826068,-0.018526712,0.057581726,-0.050792336,0.07545192,0.0060247844,-0.030183969,-0.04403497,0.012521944,0.010648456,0.06597239,0.014403438,-0.027445795,-0.07385065,-0.0016543138,0.058766667,0.0151320165,-0.07186507,0.05559615,-0.02310635,0.017613988,-0.03990369,-0.041440908,0.022866158,0.037053425,-0.01644506,-0.015083979,-0.02541218,0.044227123,0.046116624,0.01827051,-0.006681306,0.037533805,0.014411445,0.0058726636,0.02158514,-0.009023165,-0.010912666,-0.010216113,-0.049127012,0.030488212,-0.02204951,0.025476232,0.0089991465,0.018366585,-0.025908574,-0.052297533,0.003130486,0.0070816237,-0.01862279,-0.073210135,0.03631684,0.0015682454,-0.061456803,-0.014315369,0.0073858653,0.033850882,0.072057225,-0.009007153,0.012610014,-0.016557148,0.020432226,-0.03583646,0.022065522,0.017053543,-0.0074739354,-0.0056324727,-0.046661053,-0.023442617,-0.015452271,-0.015156036,0.011737321,0.009775763,-0.05972743,-0.041344833,-0.027221618,0.03154505,0.053738676,0.056556914,-0.044195097,0.030408148,-0.02730168,-0.025123952,-0.03679722,-0.03814229,-0.019295324,-0.07532382,-0.03743773,-0.020256085,0.013138434,-0.0813446,-0.028486622,0.011473111,-0.050952464,0.004515586,0.010864628,0.008310599,-0.020240074,-0.021216849,0.008654873,0.0015122009,0.004207341,0.020432226,0.0136428345,-0.042593826,-0.02552427,0.023058312,-0.07987143,-0.015932653,0.025380155,-0.024659583,0.0016002709,0.05501969,-0.09735731,-0.019887794,-0.027077504,-0.017838165,-0.082497515,-0.050600182,-0.0028262443,0.041280784,-0.040960528,0.048966885,-0.0006079828,-0.04214547,0.005348247,-0.011152857,-0.012473905,-0.048966885,0.00022467843,0.032377712,0.01827051,-0.015099991,-0.0142192915,-0.039359257,-0.028566686,-0.02970359,0.06725341,0.025572307,0.017309746,-0.04416307,-0.08313802,0.008879051,0.035227977,-0.004487564,0.023042299,-0.015724488,-0.06427504,0.028742826,-0.046885233,-0.03378683,0.015156036,0.010015954,0.01804633,-0.06350643,-0.025091926,0.0086628795,-0.007650075,0.007333824,-0.003724958,0.03372278,-0.021489065,-0.007914285,-0.010984723,-0.006729344,0.007622053,-0.022033498,-0.011040768,-0.018814942,-0.00040757365,-0.026132753,0.031336885,-0.043906868,-0.03827039,-0.0029183174,-0.03172119,-0.005904689,-0.054090954,-0.012698084,-0.007025579,0.024899773,-0.011104818,0.027429782,-0.020784505,-0.041440908,0.016340977,-0.020784505,0.03695735,0.036829248,0.04044812,-0.04169711,0.019263297,-0.026020663,0.04333041,-0.0059287082,0.019151209,0.0038810822,-0.005788597,0.04339446,-0.03679722,0.019071145,-0.009423483,0.00978377,0.056524888,0.014251317,-0.04179319,-0.0128502045,-0.03231366,0.045668267,-0.010616431,0.060047686,0.01767804,-0.038878873,0.063186176,0.0032565861,0.03900698,0.0034347277,0.06523581,0.013850999,0.006329026,0.01532417,-0.05223348,-0.04240167,-0.0613287,-0.009247344,0.058638565,-0.041120656,0.039807614,-0.018526712,-0.031400938,0.0113209905,0.009391458,0.02046425,0.052457657,-0.0104082655,-0.044611428,6.77413e-05,-0.0072977953,0.013010331,0.04534801,0.014451476,-0.051304743,-0.0043114237,0.008406676,0.012393842,-0.00050865393,-0.017357783,0.045988522,-0.07269773,0.020848555,0.021809319,-0.0068054046,-0.03170518,-0.042465724,0.011737321,0.038526595,-0.016084773,0.038302418,-0.056268685,0.0013911047,0.010416272,-0.017934242,-0.01987178,-0.014995908,0.040287994,0.026004652,-0.068086065,0.02481971,0.016701262,0.031064669,-0.004355459,-0.018911017,0.020512288,-0.030792452,-0.0039531393,0.011096812,-0.031096695,-0.033082273,-0.019151209,0.01055238,0.021889383,-0.042657875,-0.06260972,0.0048358403,0.009751745,0.0061408766,0.06642075,0.02257793,0.0066572865,0.0025900567,0.058862746,0.038462546,0.08435499,0.014715686,-0.02523604,-0.03609266,-0.014611604,-0.0068614488,-0.04304218,-0.0034627498,0.022113562,-0.054955643,-0.025155976,0.0036248786,0.03407506,-0.03036011,-0.036989376,-0.025155976,0.054379184,-0.085059546,0.0034067053,0.02646902,0.016116798,0.023074323,0.03388291,0.019231273,0.0035207958,0.036156714,0.043426488,-0.013050363,0.02345863,0.0014711682,-0.02558832,-0.019839754,-0.009551585,0.0035268008,0.010232125,0.011689283,-0.002526006,0.030456185,0.005228152,-0.017517911,-0.023474641,-0.03666912,-0.016332971,-0.03053625,-0.00129703,0.0030444176,-0.1411681,-0.0002515748,0.044963706,-0.03152904,-0.037982162,0.020176021,-0.035227977,-0.012145645,-0.02758991,0.025396168,-0.0024659582,-0.043490537,-0.006905484,0.03130486,0.02163318,-0.070840254,-0.050728284,-0.016413035,0.017533924,0.033562653,2.7474944e-05,-0.011216908,-0.00091072323,-0.054347157,-0.06667695,0.008887057,-0.030776441,0.02440338,-0.0012349808,-0.02582851,-0.00899114,-0.01945545,0.015788538,0.04781397,-0.012097607,0.026805287,-0.0071216556,0.033626705,0.017822154,-0.049959674,-0.03330645,0.022449829,-0.004179319,0.001994584,0.048326377,0.0146356225,-0.04704536,0.014803756,0.022641981,-0.041248757,0.017373797,-0.007894269,0.0123538105,-0.00018239484,-0.0024259265,0.008070409,0.0006645277,-0.023746857,-0.024675595,-0.018174432,0.020704443,0.011521149,0.020304125,-0.0136428345,-0.0050640213,-0.044002943,-0.030215995,0.011280959,0.022033498]'); +INSERT INTO public.blog_contents_embeddings_store VALUES ('c7e1e7f7-ffb4-4c82-a6ec-61ec9cc1f2de', 3, 0, 'As we look towards the future, artificial intelligence continues to evolve...', '[0.027934227,-0.029258203,0.049363,0.015438196,0.06505455,-0.04122301,0.047303483,0.08493051,-0.01456372,-0.0043764715,0.0019685947,-0.083819024,-0.05070332,-0.036973216,-0.0065340595,0.025335314,0.01889524,-0.041844133,0.05011489,-0.025368005,-0.060347084,-0.025858367,0.060837448,0.002012523,-0.0023516894,-0.00095977937,-0.028555352,0.061850857,-0.01551175,0.011874907,0.020251906,-0.030663904,-0.02425652,-0.013623861,0.020676887,0.040144216,0.0020145662,-0.004372385,-0.058516406,0.04488437,0.02041536,0.015086771,0.030484105,0.035273295,-0.050834082,-0.028555352,-0.047630392,-0.031350408,-0.012839284,0.05962789,-0.06773519,-0.015634341,-0.020644195,-0.02288351,-0.039621163,0.03638478,0.028375553,-0.008095042,-0.0143594025,0.025858367,0.0066689085,0.01124561,0.05730685,-0.011319165,-0.045570876,-0.019385602,-0.051782113,0.061752785,-0.019009659,-0.024730535,0.07218113,0.009267822,-0.019581746,0.013288781,0.012201814,-0.06538146,-0.010224026,0.03873851,0.01371376,0.042072967,-0.04612662,-0.0028624819,-0.036515545,-0.06391037,-0.0043764715,-0.015716068,0.00094088004,-0.041353773,-0.08486513,0.01209557,-0.0056718416,0.022997927,-0.021216283,-0.028963985,0.03198788,0.03726743,0.061720096,0.017342431,0.009758183,0.0345541,-0.0026704238,-0.001246334,0.03769241,0.017603958,0.03053314,-0.051357135,0.008981777,-0.046028547,-0.05557424,0.030565832,-0.09199171,-0.060772065,-0.056653034,-0.0050629764,-0.01801259,0.016418919,0.014710828,0.047466937,-0.0034468286,-0.009047159,-0.041451845,-0.014032495,0.0053817113,0.020562468,0.0019839185,-0.047140032,0.004421421,-0.03403105,-0.07754241,-0.05263207,-0.01560165,0.02337387,0.0071020606,-0.0015333995,0.011637899,-0.04171337,0.031481173,0.03674438,-0.0044908887,-0.042399876,0.002960554,-0.01188308,-0.036973216,0.005594201,-0.01837219,0.018535644,-0.016279982,-0.03893466,0.012250851,0.041419152,-0.02383154,-0.013730106,-0.0662968,0.013198881,-0.036548235,0.045603566,-0.031268682,0.07133117,-0.02023556,0.004037305,-0.069369726,0.042890236,-0.0764963,0.014490166,-0.024926681,0.054462753,0.00548387,-0.010313924,-0.096503034,-0.025989128,-0.0030218493,-0.051487897,-0.022066241,0.020137489,0.03215133,0.031056192,-0.005847554,-0.00938224,-0.014661792,-0.025907403,-0.028015954,0.07401181,-0.030729285,0.0015599607,0.0027255896,-0.019173112,-0.031677317,0.024289211,-0.01685207,0.0074371407,-0.008842842,0.06456419,0.083753645,0.06224315,0.046780434,0.015642514,0.013656552,-0.027950574,0.033900287,0.0019471415,0.069696635,-0.03053314,0.035959803,0.006783326,0.0074248817,-0.043380596,0.0066076135,0.025302624,0.014400266,0.01234075,0.032641694,-0.047466937,0.04403441,0.009962499,-0.08015767,-0.041026864,-0.067800574,0.026250655,-0.028228445,0.013958941,-0.028555352,0.030647557,0.055345405,0.08270755,-0.012479685,-0.0045603565,0.027100613,-0.061229736,0.0071102334,0.0020186524,0.010926876,0.0005480805,-0.04396903,-0.02940531,-0.02471419,-0.035338677,0.012071052,-0.055018496,0.03543675,0.017685683,-0.011474445,0.032641694,0.015871348,0.055280022,-0.00068957004,-0.0016161479,0.017358776,-0.0028297913,0.018813515,0.005197826,0.038509678,-0.076430924,0.06646025,0.018960623,0.028767841,-0.004347867,-0.025253588,0.023292145,-0.0030729284,-0.0041292477,-0.00510384,0.029225511,-0.04834959,-0.01865006,0.039130803,0.01907504,0.019500019,0.0010552976,0.026577562,-0.047270793,0.040438432,0.011261956,-0.008687561,-0.015421852,-0.076365545,-0.03589442,0.00601918,0.07211575,-0.031595588,0.09310319,0.00044643276,-0.05518195,0.10140664,-0.066166036,-0.03293591,0.0154954055,-0.07499253,-0.02778712,-0.020137489,-0.069435105,0.039686546,-0.02383154,0.004973077,0.0056718416,0.0059374534,0.01801259,0.06760443,0.07891542,-0.035142533,0.01889524,0.062962346,-0.06472764,-0.008434208,-0.0013699458,-0.007845775,0.07120041,-0.048088063,-0.0005084941,0.07728088,-0.006006921,-0.0050752354,-0.0033691882,0.053841628,-0.08323059,-0.04798999,-0.027133305,0.053580105,-0.0070898016,0.021673953,-0.061197042,-0.019924998,-0.0017080905,-0.014457474,0.0011451971,-0.042399876,-0.008193114,0.046911195,0.003702225,0.037398193,-0.04753232,-0.08081148,0.03179173,-0.047009267,-0.01669679,-0.06652563,-0.03857506,-0.010698041,0.003030022,-0.022033552,-0.03257631,-0.08394979,-0.041517224,-0.021101866,0.003017763,-0.019238494,0.0075883353,-0.020823995,-0.05459352,0.035730965,-0.0057699136,0.021396082,-0.050507177,0.076430924,0.019222148,-0.020725923,-0.0056391507,0.0025703085,0.013296953,-0.0028563524,-0.021461463,-0.049689908,-0.03367145,0.04037305,0.058876,-0.03117061,0.003953535,-0.00014634209,-0.017440503,0.034063738,-0.046322763,-0.049134165,0.006529973,0.022360459,-0.049624525,-0.014743519,-0.026119892,-0.012626794,0.028571697,-0.058418334,0.062275838,-0.017505886,0.023700777,0.011695108,-0.035011772,-0.023095999,0.029094748,-0.037398193,-0.00027378486,-0.08761115,0.0010777725,0.04122301,-0.052795526,-0.013869042,0.01907504,-0.024518047,-0.028849568,0.004682947,0.020856684,0.0015630254,0.08388441,-0.010828804,-0.058647167,0.023864232,-0.015225707,-0.0028502229,0.037103977,0.0015722198,0.01377097,0.04704196,0.06279889,0.02510648,-0.06891206,0.026168928,-0.034684863,0.007837602,0.00020265697,-0.06917358,0.031595588,-0.0052632075,0.05482235,-0.00089286553,-0.017669339,-0.0047851056,-0.0630931,0.045211278,0.03540406,-0.019810582,0.008548626,0.045963164,-0.010706213,0.016214602,0.018421225,-0.011940288,-0.042497948,-0.017375123,0.04848035,0.026920814,0.023504633,0.07505792,-0.03546944,0.007367673,-0.08839573,0.0041966722,-0.0071184062,-0.026381418,-0.027345795,-0.1085986,0.07446948,-0.04671505,-0.045832403,-0.0010736862,-0.052239783,0.00023866785,0.036417473,-0.057339538,-0.05786259,0.058483712,-0.094606966,0.014678137,0.00035500087,0.01794721,-0.044295937,-0.050507177,0.03991538,-0.016459782,0.021412427,0.034063738,0.021592226,-0.06891206,-0.015405506,-0.027165996,-0.0053326753,-0.009038987,-0.021510499,0.023210417,0.026397763,0.049166854,-0.040438432,-0.023782505,0.017048215,-0.08525742,0.023259453,-0.015773276,0.022082588,-0.065741055,0.038052008,-0.027084269,0.015626168,0.0042130174,0.004335608,-0.024583427,-0.034652174,0.097483754,-0.016100183,0.014375748,-0.024305556,0.0082830135,-0.021183591,-0.04481899,0.019254839,-0.00031081733,0.016329018,-0.015732413,0.005586028,0.013672898,-0.009864427,0.029797599,0.03906542,-0.0065708365,0.030843703,0.015879521,0.04217104,0.018535644,0.025891056,0.0058557265,0.039228875,0.03625402,0.044197865,0.001593673,-0.002960554,0.0013209097,-0.026806397,-0.014727173,0.032184023,0.049493764,-0.0870881,-0.029862981,-0.04893802,-0.05259938,0.0029789426,0.04848035,0.03321378,0.05969327,-0.001480277,-0.03546944,-0.002361905,-0.009513002,0.03141579,-0.104479566,0.024730535,0.015528096,0.03991538,0.01712994,0.008266668,-0.081530675,0.016451608,-0.046911195,-0.041157626,0.019974034,0.044263247,0.06511993,0.022540258,-0.0006262318,-0.015560787,-0.00091278646,-0.020938411,0.011033121,0.00426614,-0.0018010548,0.026773706,0.013182537,-0.0038145995,0.0024293298,0.014514684,0.0057780864,0.0015599607,0.013247917,0.019908654,-0.012994564,0.025956439,-0.032102294,0.0007350306,0.013656552,-0.025907403,-0.017538575,-0.0026029993,0.053187814,0.013068119,0.0048341416,0.04037305,-0.02873515,-0.071984984,-0.0062153246,0.056554962,-0.00685688,0.022687366,-0.015242052,0.028718805,0.021837406,0.03269073,0.024289211,0.022834474,-0.06528339,-0.013354163,0.0027746256,-0.017505886,-0.022703711,0.028784186,-0.01087784,0.03723474,0.013386853,0.013141673,0.013329645,0.0034447855,-0.044328626,-0.033802215,0.0031648711,0.013051773,0.047303483,-0.029977398,-0.008581316,0.009594729,0.014179603,0.016770344,0.016010284,-0.021592226,-0.001993113,0.069435105,0.07695398,-0.007220565,-0.009423102,-0.011319165,-0.005034372,-0.0062929653,0.0075106947,0.022507567,0.0142858485,-0.033965666,-0.009570211,0.02760732,0.005132444,0.061720096,-0.030108161,0.004985336,0.018911587,-0.022327768,0.013828178,-0.028849568,0.027721738,-0.056751106,-0.0031485257,0.051291753,-0.0027337621,-0.041419152,0.016271811,-0.008687561,0.0022536172,-0.022164313,-0.023504633,-0.01364838,-0.01773472,-0.03847699,0.006542232,0.06234122,0.018699097,-0.03507715,-0.055803075,0.020137489,0.058124114,0.01685207,-0.051945567,-0.032658037,-0.0063665193,-0.003236382,0.018568333,0.056783795,0.035665587,0.024763227,0.032494586,0.020889375,-0.03775779,0.030173542,0.044655535,0.023815196,0.024452666,-0.019565402,0.042988308,-0.025188206,0.021837406,0.007690494,-0.015291088,0.03236382,-0.05531271,-0.061981622,0.034815624,-0.029209167,0.039163493,0.011580691,0.033115707,-0.05521464,-0.043740194,-0.022818128,0.021804716,0.012446995,-0.009455794,0.0025560064,-0.0057372227,0.05701263,-0.05263207,-0.08329598,0.02647949,0.058974076,0.0394904,-0.042040277,-0.0142122945,-0.01837219,-0.029797599,-0.0061662886,0.052697454,-0.025825676,-0.051716734,-0.01636171,0.005921108,-0.0112783015,-0.014326712,0.012381613,-0.035665587,0.0040924707,-0.023929613,-0.05743761,0.01359117,-0.016108356,-0.010093262,-0.0067302035,-0.0065994407,-0.074142575,0.018519297,0.053514723,-0.01681938,-0.023864232,-0.0027889279,-0.010289406,-0.006301138,-0.0035060807,0.03955578,0.0041496796,-0.0032792888,-0.011049466,-0.06299503,0.009513002,0.01377097,-0.04717272,-0.007265514,-0.016092012,-0.047695775,0.03184077,-0.002167804,0.060379777,-0.025989128,-0.002192322,-0.022703711,0.012839284,0.0025948265,-0.077673174,0.008062351,0.028081335,-0.0142122945,0.0065463185,0.01288832,-0.028212098,0.005921108,0.021330701,0.013615688,-0.019663474,0.042792164,-0.025433388,0.03811739,0.025580496]'); +INSERT INTO public.blog_contents_embeddings_store VALUES ('18e4a493-7a46-4782-ba46-c20bd0ecf74a', 4, 0, 'Maintaining a healthy diet can be challenging for busy professionals...', '[0.013934722,0.04301111,0.0021016025,-0.0158,0.0297094,0.010643056,0.042167094,0.066846155,-0.016627137,0.009436111,0.03565128,-0.003920459,0.03652906,0.025843803,0.0068956194,0.020121368,0.0030426816,-0.01875406,-0.03811581,0.063537605,0.06870299,0.06016154,0.0720453,0.0039774305,-0.0078029376,0.026012607,-0.029743161,-0.0038761485,0.06617094,-0.020087607,0.040816665,-0.020999145,-0.02025641,0.03163376,0.018365812,0.057730768,0.010052243,-0.001532946,0.033575,-0.0062879273,0.027059188,0.03367628,0.09263931,-0.004211645,0.030941665,-0.0054945513,-0.026907265,0.01632329,0.06407778,0.018737178,-0.03710299,0.07150513,0.019378632,-0.03300107,0.029405555,-0.028240811,-0.031329915,0.022585897,-0.036765385,0.03656282,0.0047349357,0.009106944,0.029489957,0.059047434,-0.07663675,-0.057561964,0.07420598,0.026586538,-0.08163333,-0.03609017,0.004536592,-0.010474252,0.009858119,0.03364252,0.005684455,-0.08156581,-0.02130299,-0.05236282,0.02368312,-0.0010539663,-0.0027240652,-0.045205556,0.026316453,0.028358974,-0.024763461,-0.06850042,-0.07987778,-0.021927563,-0.05833846,0.03517863,0.0021944444,-0.041323077,-0.034908544,-0.01932799,0.050067093,0.00057709665,-0.03360876,0.061984614,0.017943803,-0.0016426683,0.0534094,-0.06772393,0.036731623,0.03568504,0.057899572,-0.07035726,0.02027329,0.0009980502,-0.0063512283,0.019513674,-0.023092307,-0.06330128,-0.008334668,-0.0019053685,0.038892306,-0.020172007,-0.011022863,0.008579434,0.0028422275,-0.032562178,0.018332051,0.04334872,0.0014411592,-0.06438162,0.0066972757,0.00789578,-0.011157906,0.02667094,-0.042369656,-0.10290256,0.0053130873,-0.025506197,0.042234614,-0.07407094,-0.035313673,0.019463034,-0.016441453,0.015394871,-0.043449998,0.03111047,0.01480406,-0.015158547,0.017437393,0.03912863,-0.0040386217,-0.0065411325,0.011107265,0.041289315,-0.026316453,0.058676068,0.012508333,0.010322329,-0.049054272,0.03219081,0.025320511,-0.05104615,0.0584735,0.037373077,0.011461752,-0.010474252,0.01969936,-0.0036060628,-0.03771068,-0.030857265,-0.000815004,0.04956068,0.010119765,0.017504914,-0.047062393,-0.014533974,0.018416453,-0.058439743,0.008533013,0.0058026174,0.04642094,0.028342092,0.00069103896,-0.04895299,-0.03845342,-0.020036966,-0.011478632,0.064179055,0.050472222,-0.03609017,0.026282692,-0.01628953,-0.059992734,-0.05280171,0.035313673,0.019969445,-0.0076256944,-0.033254273,-0.036765385,-0.039770085,-0.023598718,-0.024408974,0.070492305,0.016998503,0.0127699785,0.10310513,-0.034385256,-0.00041356837,-0.03568504,-0.08379401,0.06866923,-0.015513034,-0.008929701,-0.017158868,0.049054272,-0.021488674,0.0120188035,0.008448611,-0.027582478,0.011335149,-0.02667094,0.04736624,-0.033524357,-0.018045085,0.054489743,-0.0011763488,0.016517414,-0.016475214,0.12727778,0.032157052,0.073463246,0.019074786,0.022974145,-0.05975641,0.0035934027,-0.056076493,0.0257594,0.0024961806,-0.038352136,-0.018585255,0.042369656,-0.015116346,0.025945084,-0.04844658,0.026637178,0.0004610443,0.021792522,0.010778098,-0.03121175,-0.03274786,-0.00792532,0.001185844,-0.06563077,-0.0009933026,-0.039972648,-0.049797006,0.052295297,0.051012393,0.0085456725,-0.016559616,-0.0583047,0.03663034,0.013149786,-0.007549733,0.006228846,0.028055128,0.002228205,0.017775,0.019091666,-0.027852563,0.06974957,0.08014786,-0.014255448,-0.02920299,-0.021032905,-0.03804829,0.029034188,0.0026375533,-0.017893162,-0.0143989315,0.014137286,0.025067307,0.005093643,0.04540812,-0.067791454,0.0132848285,-0.08649487,-0.013453633,-0.024476495,-0.108979486,0.0057519763,-0.010221046,-0.0080308225,0.046691023,0.04696111,0.016719978,-0.06515812,0.06549572,0.04935812,0.03220769,0.030891025,-0.010060684,-0.023446795,-0.05833846,0.02280534,0.03956752,0.028865384,0.08872308,-0.042909827,-0.025978845,0.030452136,-0.02820705,0.048581623,0.013369231,-0.020492734,0.042808548,-0.04240342,0.006773237,0.054726068,-0.028916026,0.0045154914,0.025067307,0.004291827,-0.030131409,0.015268269,-0.041829485,0.014179487,-0.037676923,-0.009571154,0.047670085,0.06610341,-0.029067948,0.06080299,0.05286923,-0.027092949,-0.008098343,-0.0603641,0.0051063034,-0.06252479,0.05232906,-0.037609402,-0.03723803,0.025472436,-0.030333973,0.075691454,0.025506197,-0.052497864,-0.07305812,-0.029439315,-0.014162607,-0.004650534,-0.08919572,0.029861324,-0.0079886215,-0.029591238,-0.012930342,0.03163376,0.02770064,-0.0455094,0.028477136,-0.0053721685,0.010828739,-0.003065892,-0.026502136,-0.052160256,-0.016762178,0.029962607,0.02469594,-0.010440491,0.075353846,0.03214017,0.09655555,0.059553843,-0.022670299,-0.0047180555,-0.0075750533,-0.011495513,0.032798503,0.005583173,-0.055435043,-0.12808803,-0.0010281183,-0.013538034,-0.0014590945,-4.187116e-05,-0.0076889955,0.008495032,-0.013217308,0.026333332,0.0016078525,0.07893248,0.04388889,-0.006836538,-0.034132052,-0.097635895,-0.042808548,0.039297435,0.032022007,0.020036966,0.012111645,0.022822222,-0.032444015,0.043855127,-0.0050556622,0.0021058226,-0.041086752,0.021319872,-0.00047739715,-0.03171816,0.044732906,-0.009689316,0.00061982503,-0.019378632,-0.044834185,-0.029844444,0.0010043803,-0.010254808,-0.018129487,0.02474658,0.002823237,0.05776453,-0.046758547,0.009689316,0.05739316,-0.009917201,-0.027042307,-0.023885684,-0.028595299,0.04449658,0.01728547,-0.051349998,0.045813248,-0.03347372,-0.05405085,-0.10168718,-0.0065959934,-0.04746752,0.0017450053,0.0033549678,0.023835042,-0.020813461,-0.029760042,-0.024324572,-0.04895299,0.044665385,-0.010794979,-0.00986656,-0.0010645165,-0.008676495,-0.010794979,-0.032427136,0.044327777,0.029776921,0.042099573,0.02327799,0.014407371,-0.00059977965,-0.033271153,0.02424017,-0.06563077,-0.021927563,0.046319656,-0.019918803,-0.04885171,0.01730235,-0.014896901,0.03909487,-0.0109469015,0.044699144,-0.0025995725,0.0075792735,0.0002190488,0.018332051,0.04054658,0.011833119,0.029017307,0.010592414,0.030823503,0.0036989048,0.066846155,0.044766665,-0.007359829,0.03418269,0.014601495,-0.07305812,0.011039743,-0.01384188,-0.05091111,-0.023986965,0.037778202,0.057123076,-0.05688675,0.093517095,0.03328803,-0.0013609775,-0.0237844,0.0012428152,-0.0035765225,0.055097435,-0.016466772,-0.021792522,-0.0385547,-0.05195769,0.027801922,0.0334906,-0.011394231,0.11100513,-0.043821365,-0.02619829,0.0564141,0.012120085,-0.026046367,0.01583376,0.04240342,-0.025354274,-0.0007079193,-0.06475299,-0.0037896368,0.040917948,-0.013884081,-0.051755127,0.02224829,0.017690597,0.003665144,-0.005903899,0.0049037393,0.005984081,0.028055128,-0.015935043,0.002563702,-0.023159828,-0.03068846,-0.08257863,0.022585897,0.018180128,-0.0063638887,0.019513674,-0.03960128,7.4247124e-05,0.00055757875,-0.028510896,-0.004836218,-0.030789742,-0.016205128,-0.032410257,-0.038892306,-0.0034984509,0.043787606,-0.022940384,0.02817329,-0.009579593,-0.039263673,0.046657264,0.02373376,-0.013504273,-0.00840641,-0.006178205,-0.042234614,0.0076974356,-0.041626923,0.02813953,-0.030823503,0.04152564,0.019108547,0.011444871,0.051653843,0.026383974,-0.005249786,-0.026046367,-0.021522434,-0.03504359,0.017960683,0.011546154,-0.04790641,-0.096690595,0.05800085,0.00591234,-0.008946581,0.008811538,-0.048176493,0.057595726,0.06184957,-0.01237329,-0.0053130873,0.005393269,0.0053721685,0.0070517627,-0.022906624,-0.0534094,-0.038419656,-0.07954017,0.03669786,0.053240597,0.017910043,-0.011638995,0.012964102,-0.0021406382,0.03220769,-0.0046631945,0.043179914,-0.0286797,-0.009452991,-0.058237176,0.02023953,-0.039972648,-0.040276494,0.025877563,0.019547435,-0.0013177217,-0.06421282,-0.008241827,0.004633654,0.035955127,0.05739316,0.033828203,0.017775,0.024324572,0.054692306,0.014795619,-0.007469551,0.013824999,0.03313611,-0.0017850961,0.0072036856,0.018720299,0.024611538,0.03364252,0.06961453,0.024138888,0.0012396501,-0.02074594,0.029287392,-0.039736323,-0.035212394,-0.01433141,-0.031346794,-0.0027599358,-0.008693376,-0.010119765,0.03754188,0.03710299,0.03470598,-0.007937981,-0.03561752,-0.036731623,-0.0494594,0.004794017,-0.0059629804,0.008554113,-0.06617094,0.02368312,0.027970726,-0.0028548879,-0.056785468,0.00045576922,-0.011748718,0.026029486,-0.024949145,0.03261282,0.045644443,-0.017133547,-0.009697756,-0.004089263,0.0014643696,-0.027346153,0.03902735,-0.0138672,0.008068803,-0.00037084,0.032157052,0.03939872,0.07704188,0.030739103,-0.021100426,-0.04608333,0.03956752,0.018365812,0.031093588,0.04348376,0.0042622862,0.013099145,-0.0112254275,0.04490171,0.0035364316,-0.009275747,-0.01335235,-0.020087607,0.0022535257,0.0014569844,0.03717051,0.008760897,-0.023058547,0.049594443,0.037609402,0.059520084,0.06897307,0.0277344,-0.025371153,0.026316453,-0.0035090009,0.013512713,0.018585255,0.031853203,0.046218377,-0.02613077,-0.08318632,0.011090385,0.02913547,0.009545833,0.015158547,-0.03723803,0.009663995,0.0010054354,-0.014576175,0.011993483,-0.03308547,0.010423611,0.03517863,-0.0044226493,0.03376068,0.015740918,-0.05438846,-0.005093643,0.018703418,-0.010297008,-0.02425705,0.004608333,0.025354274,-0.02277158,-0.037811965,0.01630641,-0.01337767,0.051552564,0.024324572,-0.018686539,0.027869444,0.030891025,-0.02521923,0.013900961,-0.015276709,0.020847222,0.032444015,0.0143145295,-0.013141346,-0.001528726,-0.018163247,-0.007258547,-0.07704188,-0.030739103,0.03354124,-0.0032009347,-0.0044901706,-0.007055983,-0.0047686966,-0.007064423,0.0050261216,-0.0630312,0.012820619,0.0017207398,-0.00346047,0.01775812,-0.043146152,-0.0013651976,0.026974786,0.0050176815,-0.017488034,0.05189017,0.0515188,0.014373611,-0.013934722,-0.020712178,-0.022687178,0.026991665,0.013048504]'); +INSERT INTO public.blog_contents_embeddings_store VALUES ('7ffbf7fa-c428-4997-bcb2-9f0ac969e8e0', 5, 0, 'Cloud computing has revolutionized the way businesses operate...', '[-0.016591733,-0.012675295,0.064363174,0.05738038,0.1012202,-0.041441385,-0.0134570645,0.08373284,0.02478893,-0.019157153,0.0058632726,-0.027870469,0.0022010992,-0.02673197,-0.007305372,0.030845748,0.011734135,-0.033304907,-0.009722786,0.020568892,0.035915866,0.013168645,-0.002607164,0.007043517,-0.07492845,0.046359703,-0.058746576,0.011529205,-0.014846034,-0.14597082,0.055983815,-0.02554793,0.008288276,-0.033456706,0.016819432,0.043202262,-0.06727773,0.056985695,0.018671392,0.058260817,-0.0542533,-0.028629469,0.04720978,0.0446899,0.02527469,0.028113348,-0.059991337,-0.10225244,0.030451067,0.0548605,-0.016986413,-0.039103664,0.007954317,-0.059262697,-0.04948678,-0.0028329664,0.039407264,0.035703346,-0.056742817,0.0031422586,0.0440827,0.0016327981,-0.042898662,0.007138392,-0.021464512,0.039710864,0.04478098,-0.040743105,-0.055406976,-0.016242594,0.018489232,0.04851526,0.041077062,0.06758133,0.015802374,-0.06551685,0.016546194,0.007605177,0.028310688,0.039619785,0.024181731,-0.02421209,0.036492705,-0.040105544,0.017350733,0.028750908,-0.036006946,0.02017421,-0.053190697,0.056894615,0.05385862,0.06612405,-0.0027798363,-0.004284553,0.016318493,0.039741226,-0.02489519,0.030845748,0.04572214,0.019384852,0.042503983,-0.07456413,0.009214256,-0.029236669,0.02489519,-0.056985695,-0.010952366,-0.020644791,0.012106045,-0.0019269105,-0.099095,-0.019916153,-0.013221774,0.027096288,0.02123681,0.019840252,0.04890994,0.02369597,-0.015339384,-0.014011134,-0.019809892,-0.02336201,-0.043050464,-0.018352613,0.0028671212,-0.035612267,-0.068856455,-0.004523638,-0.008250327,-0.00033372268,0.055346258,0.0010597534,0.037039183,-0.021221632,0.0009591859,0.019809892,-0.020993931,-0.02525951,0.0015606931,-0.02108501,0.018625852,0.037555303,-0.011248375,0.007730412,-0.06509181,-0.02582117,-0.07717509,0.03151367,-0.011961835,0.04815094,-0.02834105,-0.06806709,-0.04396126,0.04796878,0.021570772,0.006675402,0.037282065,0.079118125,-0.018474052,-0.0014458944,0.027111469,0.03251555,-0.061296813,-0.0428683,-0.045539983,-0.004971448,0.019551832,0.041137785,-0.11567155,-0.106806435,-0.018049013,-0.037373144,0.07177101,0.038557183,-0.007441992,0.038283944,0.021874372,-0.040166263,0.038344663,-0.074685566,0.0054230527,0.010512146,0.011248375,-0.04520602,-0.053403217,-0.04065202,0.0149750635,0.030010847,-0.045114942,0.05155126,-0.040591303,0.043627303,-0.016910514,0.038010705,-0.010033976,0.08021109,0.021312712,0.008576697,-0.04945642,-0.04602574,0.052401338,-0.014443764,0.0062959027,-0.026747148,-0.008136476,-0.008774037,0.017563254,0.021358252,-0.0487885,-0.032454826,0.012508315,0.016333673,-0.021752931,0.017957933,-0.040105544,-0.08919764,-0.044932783,0.060112774,0.015240714,-0.015187584,0.0016318493,-0.0019904766,0.04942606,-0.0437791,-0.027551688,0.017942753,-0.028128529,-0.0434755,0.030314447,-0.02132789,0.035733707,-0.017016772,-0.004307323,-0.005237098,-0.0036318135,0.034913987,0.005062528,-0.04517566,-0.0012143995,0.021449331,-0.032029785,-0.018276712,-0.06606333,-0.02480411,-0.012675295,0.011187656,0.016622093,-0.0037342785,-0.02339237,0.0031137962,-0.040864542,0.0139883645,0.009130767,-0.061418254,-0.030086748,-0.0509137,-0.0020815567,-0.004838623,0.084157884,0.033487067,-0.010944775,-0.012736015,-0.02208689,-0.007832876,-0.004808263,0.013062385,-0.017350733,-0.029479548,-0.043293342,-0.0032086712,0.113121316,0.0471187,0.034519307,-0.06849213,-0.011574745,0.05064046,-0.022618191,-0.015832733,-0.06351309,0.057167858,0.02289143,-0.0036545836,0.018580312,-0.029479548,0.0060340473,-0.058230456,-0.0012950433,0.006561552,0.011195245,-0.057532176,0.029327748,0.043718383,-0.005089093,-0.009252206,0.0052446877,-0.011916295,-0.012553855,-0.029555447,0.014937114,-0.008781627,0.010724666,-0.0456007,-0.0644239,0.039042942,-0.030041208,0.037403505,-0.022253871,0.020295652,-0.02550239,-0.042139664,-0.0644239,0.036857024,0.08045397,-0.031544026,-0.09624116,-0.012576625,0.05048866,-0.044416662,-0.07741797,-0.05495158,0.042686142,-0.033729948,-0.033395987,0.00075757655,-0.021950271,0.012280615,0.007916367,-0.031149346,0.021752931,-0.020386731,-0.060446735,0.030238548,-0.014717004,0.0024382866,0.0029961513,-0.02884199,-0.0047171833,-0.0061706677,-0.009016916,-0.065577574,0.008432487,-0.013821384,0.032181587,-0.02738471,0.009889766,-0.035005067,0.021206452,0.04979038,0.09715196,0.007954317,0.05024578,-0.007426812,-0.0061554876,0.006648837,0.045418542,0.020189391,0.035369385,-0.017411454,0.036401626,0.000820194,0.007024542,0.033517428,0.0142160645,0.0032295438,0.014193295,0.04629898,-0.011422945,0.0027305014,0.04572214,0.02401475,-0.016591733,0.018261533,-0.001754238,-0.02239049,-0.0474223,-0.10632068,-0.016470293,0.08585805,-0.011119345,0.06667053,0.05139946,0.04520602,-0.0021555591,0.04156282,-0.006876537,0.019415213,-0.061023574,-0.02245121,0.0023244366,-0.016515832,0.043050464,-0.018792832,0.02595779,0.016500654,-0.038496464,-0.021874372,0.013859334,0.0023585916,-0.005404078,0.031043088,0.04632934,0.012675295,0.0028026064,-0.06302734,-0.0105956355,-0.033001307,-0.028416948,-0.035126507,-0.034640744,-0.05024578,0.0010730358,0.014132574,-0.0025540339,-0.0019658091,-0.0060340473,0.013586095,-0.04608646,0.04496314,0.012280615,0.058868017,0.04456846,0.02399957,-0.055528417,-0.013973184,-0.04581322,0.050883338,-0.019673271,0.016667632,0.017365914,-0.02465231,-0.008819576,-0.040834185,-0.0040644435,0.021494871,-0.02254229,0.037160624,-0.08543301,-0.066791974,0.039953742,0.0056203925,-0.00030241394,-0.036310546,0.02310395,-0.057532176,-0.014512074,-0.047452662,-0.033669226,-0.016804254,-0.017836493,-0.027794568,0.02132789,-0.02472821,-0.019688452,-0.008629827,-0.08021109,-0.041714624,0.067642055,-0.07553565,0.04156282,0.0029373288,-0.007419222,0.010231316,0.00037736516,0.04156282,0.020842131,0.002827274,0.064363174,0.011999785,-0.04672402,0.011802445,0.04335406,0.08403645,0.033335265,-0.028553568,-0.030329628,-0.019415213,0.0059088124,0.002091044,0.051581617,0.02617031,-0.006979002,0.017973112,-0.058807295,-0.028978609,-0.015756834,0.0014610745,-0.0066450424,0.04793842,-0.007479942,-0.0039430032,-0.02336201,0.019263413,0.108810194,-0.012584215,-0.059657376,-0.0010663946,-0.06272373,-0.0074875318,-0.02389331,0.054010417,0.08057541,0.0040606484,-0.06994941,-0.04125922,0.023878131,0.063755974,0.008811986,0.016986413,0.020143852,-0.03281915,0.031043088,0.017168572,0.03151367,0.043141544,-0.05476942,0.0068689473,0.030587688,0.012910585,-0.018580312,-0.012455185,-0.020189391,0.021373432,0.006713352,0.010193366,0.0154304635,0.013737895,-0.06412029,-0.034428228,0.009631706,-0.030375168,0.028720548,-0.036006946,0.05677318,-0.016303314,-0.011969425,-0.027855288,-0.02360489,0.051794138,-0.02869019,0.029965308,0.018701753,0.029145587,-0.0064287274,0.034913987,-0.021601131,-0.003698226,0.001212502,-0.059475217,-0.003474321,0.035824787,0.038375024,0.0019828866,-0.019764353,0.009912536,0.04459882,-0.011339456,0.015817553,0.029312568,0.0149750635,0.015134454,-0.013593685,0.020614432,0.0031574387,-0.0051574027,0.041805703,0.017031953,-0.020447452,-0.032363746,-0.07681077,0.037160624,-0.02585153,0.086222365,0.032576267,0.012227485,0.015863093,-0.0060416376,0.008166837,-0.028796447,0.015111684,0.020918032,0.001318762,-0.008963786,-0.056742817,-0.005176378,0.018307073,0.018519592,0.015544314,-0.033365626,0.056317776,0.0019942718,0.014420995,-0.0019098329,0.059687737,-0.009775916,-0.04632934,-0.020796591,0.04881886,0.034519307,-0.004656463,0.02158595,0.010102286,0.02747579,0.0037494586,-0.02606405,-0.028735729,0.028887529,0.0023282315,0.016622093,0.037312426,-0.041289583,0.037221346,-0.0058405027,0.011681005,0.012553855,-0.009517856,0.018140092,0.02478893,0.0063528274,0.05568022,0.002432594,-0.057319656,-0.020083131,-0.008159246,-0.021418972,0.016075613,0.009297746,0.046147183,-0.018974992,-0.058685858,-0.014777724,-0.015104094,0.0027115264,-0.005161198,-0.016090794,0.022071712,-0.035703346,0.029737609,0.001394662,0.024986269,-0.060112774,-0.010868875,0.017760593,0.02642837,-0.058412615,0.04699726,0.009009326,-0.0068689473,-0.008827167,0.010459016,-0.00072389597,0.061448615,-0.030602867,0.06916005,0.050974417,-0.0015123069,0.00039894923,-0.009958076,0.005005603,0.03142259,0.051278017,0.039194744,-0.040864542,-0.02595779,0.007498917,-0.02457641,-0.015088914,0.014299554,0.001326352,0.0038898734,0.057866137,-0.038982224,0.07341045,0.086647406,0.02213243,-0.036887385,0.013001665,0.003872796,-0.08342925,0.037524946,0.05237098,-0.034337144,0.009054867,-0.019400032,-0.010588045,-0.019658092,-0.046450783,-0.05495158,0.03221195,0.008227557,-0.011248375,0.00063898286,-0.005605213,0.016409574,-0.027900828,0.0142160645,-0.032333385,0.0466633,0.016060434,-0.0483331,-0.07596069,0.014808084,0.039862663,-0.036674865,-0.04708834,-0.008584286,-0.028675009,-0.036523066,-0.07602141,-0.018762473,0.0033965237,0.021267172,-0.0060264575,0.0015872581,-0.010094696,0.0065767323,-0.015772013,-0.008933427,0.0053585377,-0.0013491219,-0.034853265,-0.012789145,0.002121404,0.009373646,-0.060598534,0.0021327892,-0.010018796,0.02147969,0.039862663,-0.039619785,0.02638283,-0.0041744984,0.029585809,0.005252278,0.02422727,-0.0022124841,-0.015787194,-0.029327748,-0.038739346,-0.0016603118,-0.009145946,-0.07565709,-0.040196624,0.02363525,-0.010360346,-0.021449331,0.016485473,-0.027657948,-0.0026204465,-0.0058898376,0.012500725,-0.039923385,0.009411596,-0.031088628,0.0478777,0.013904874,-0.018838372,-0.028659828,-0.019825071,-0.023422731,-0.019582191,0.029191129,0.013548144,0.007290192,-0.024029931,0.015893454,-0.0032769812,-0.00034012675,0.0027684513]'); + + +-- +-- Name: blog_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres +-- + +SELECT pg_catalog.setval('public.blog_id_seq', 5, true); + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/tests/sync_client_test.py b/tests/sync_client_test.py index 840b991..9f2a9fa 100644 --- a/tests/sync_client_test.py +++ b/tests/sync_client_test.py @@ -5,7 +5,7 @@ import pytest from timescale_vector.client import ( - SEARCH_RESULT_CONTENTS_IDX, + SEARCH_RESULT_CHUNK_IDX, SEARCH_RESULT_DISTANCE_IDX, SEARCH_RESULT_ID_IDX, SEARCH_RESULT_METADATA_IDX, @@ -22,7 +22,16 @@ @pytest.mark.parametrize("schema", ["temp", None]) def test_sync_client(service_url: str, schema: str) -> None: - vec = Sync(service_url, "data_table", 2, schema_name=schema) + vec = Sync( + service_url, + "data_table", + 2, + schema_name=schema, + embedding_table_name="data_table", + id_column_name="id", + metadata_column_name="metadata", + ) + vec.drop_table() vec.create_tables() empty = vec.table_is_empty() @@ -135,16 +144,16 @@ def test_sync_client(service_url: str, schema: str) -> None: assert raised rec = vec.search([1.0, 2.0], filter={"key_1": "val_1", "key_2": "val_2"}) - assert rec[0][SEARCH_RESULT_CONTENTS_IDX] == "the brown fox" - assert rec[0]["contents"] == "the brown fox" # type: ignore + assert rec[0][SEARCH_RESULT_CHUNK_IDX] == "the brown fox" + assert rec[0]["chunk"] == "the brown fox" assert rec[0][SEARCH_RESULT_METADATA_IDX] == { "key_1": "val_1", "key_2": "val_2", } - assert rec[0]["metadata"] == {"key_1": "val_1", "key_2": "val_2"} # type: ignore + assert rec[0]["metadata"] == {"key_1": "val_1", "key_2": "val_2"} assert isinstance(rec[0][SEARCH_RESULT_METADATA_IDX], dict) assert rec[0][SEARCH_RESULT_DISTANCE_IDX] == 0.0009438353921149556 - assert rec[0]["distance"] == 0.0009438353921149556 # type: ignore + assert rec[0]["distance"] == 0.0009438353921149556 rec = vec.search([1.0, 2.0], limit=4, predicates=Predicates("key", "==", "val2")) assert len(rec) == 1 @@ -170,7 +179,16 @@ def test_sync_client(service_url: str, schema: str) -> None: vec.drop_table() vec.close() - vec = Sync(service_url, "data_table", 2, id_type="TEXT", schema_name=schema) + vec = Sync( + service_url, + "data_table", + 2, + id_type="TEXT", + schema_name=schema, + embedding_table_name="data_table", + id_column_name="id", + metadata_column_name="metadata", + ) vec.create_tables() assert vec.table_is_empty() vec.upsert([("Not a valid UUID", {"key": "val"}, "the brown fox", [1.0, 1.2])]) @@ -186,6 +204,9 @@ def test_sync_client(service_url: str, schema: str) -> None: 2, time_partition_interval=timedelta(seconds=60), schema_name=schema, + embedding_table_name="data_table", + id_column_name="id", + metadata_column_name="metadata", ) vec.create_tables() assert vec.table_is_empty() diff --git a/tests/utils.py b/tests/utils.py index 5869561..b57dbdd 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -3,7 +3,8 @@ import vcr -vcr_cassette_path = os.path.join(os.path.dirname(__file__), "vcr_cassettes") +test_file_path = os.path.dirname(__file__) +vcr_cassette_path = os.path.join(test_file_path, "vcr_cassettes") def remove_set_cookie_header(response: dict[str, Any]): diff --git a/timescale_vector/client/__init__.py b/timescale_vector/client/__init__.py index 1758782..baff9ab 100644 --- a/timescale_vector/client/__init__.py +++ b/timescale_vector/client/__init__.py @@ -1,7 +1,7 @@ __all__ = [ "SEARCH_RESULT_ID_IDX", "SEARCH_RESULT_METADATA_IDX", - "SEARCH_RESULT_CONTENTS_IDX", + "SEARCH_RESULT_CHUNK_IDX", "SEARCH_RESULT_EMBEDDING_IDX", "SEARCH_RESULT_DISTANCE_IDX", "uuid_from_time", @@ -39,6 +39,6 @@ SEARCH_RESULT_ID_IDX = 0 SEARCH_RESULT_METADATA_IDX = 1 -SEARCH_RESULT_CONTENTS_IDX = 2 +SEARCH_RESULT_CHUNK_IDX = 2 SEARCH_RESULT_EMBEDDING_IDX = 3 SEARCH_RESULT_DISTANCE_IDX = 4 diff --git a/timescale_vector/client/async_client.py b/timescale_vector/client/async_client.py index 760b84e..4f93db4 100644 --- a/timescale_vector/client/async_client.py +++ b/timescale_vector/client/async_client.py @@ -1,7 +1,6 @@ import json import uuid -from collections.abc import Mapping -from datetime import datetime, timedelta +from datetime import timedelta from typing import Any, Literal, cast from asyncpg import Connection, Pool, Record, connect, create_pool @@ -10,7 +9,7 @@ from timescale_vector.client.index import BaseIndex, QueryParams from timescale_vector.client.predicates import Predicates -from timescale_vector.client.query_builder import QueryBuilder +from timescale_vector.client.query_builder import Filter, QueryBuilder from timescale_vector.client.uuid_time_range import UUIDTimeRange @@ -26,6 +25,9 @@ def __init__( max_db_connections: int | None = None, infer_filters: bool = True, schema_name: str | None = None, + embedding_table_name: str | None = None, + id_column_name: str = "embedding_uuid", + metadata_column_name: str | None = None, ) -> None: """ Initializes a async client for storing vector data. @@ -57,6 +59,9 @@ def __init__( time_partition_interval, infer_filters, schema_name, + embedding_table_name, + id_column_name, + metadata_column_name, ) self.service_url: str = service_url self.pool: Pool | None = None @@ -202,7 +207,7 @@ async def delete_by_ids(self, ids: list[uuid.UUID] | list[str]) -> list[Record]: async with await self.connect() as pool: return await pool.fetch(query, *params) - async def delete_by_metadata(self, filter: dict[str, str] | list[dict[str, str]]) -> list[Record]: + async def delete_by_metadata(self, filter: Filter) -> list[Record]: """ Delete records by metadata filters. """ @@ -270,7 +275,7 @@ async def search( self, query_embedding: list[float] | None = None, limit: int = 10, - filter: Mapping[str, datetime | str] | list[dict[str, str]] | None = None, + filter: Filter = None, predicates: Predicates | None = None, uuid_time_filter: UUIDTimeRange | None = None, query_params: QueryParams | None = None, diff --git a/timescale_vector/client/query_builder.py b/timescale_vector/client/query_builder.py index 8f7e4d7..2aa9c4f 100644 --- a/timescale_vector/client/query_builder.py +++ b/timescale_vector/client/query_builder.py @@ -1,7 +1,7 @@ # pyright: reportPrivateUsage=false import json import uuid -from collections.abc import Callable, Mapping +from collections.abc import Callable, Mapping, Sequence from datetime import datetime, timedelta from typing import Any @@ -11,6 +11,8 @@ from timescale_vector.client.predicates import Predicates from timescale_vector.client.uuid_time_range import UUIDTimeRange +Filter = Mapping[str, datetime | str | int] | Sequence[Mapping[str, datetime | str | int]] | None + class QueryBuilder: def __init__( @@ -22,6 +24,9 @@ def __init__( time_partition_interval: timedelta | None, infer_filters: bool, schema_name: str | None, + embedding_table_name: str | None = None, + id_column_name: str = "embedding_uuid", + metadata_column_name: str | None = None, # Added this parameter ) -> None: """ Initializes a base Vector object to generate queries for vector clients. @@ -42,8 +47,13 @@ def __init__( Whether to infer start and end times from the special __start_date and __end_date filters. schema_name The schema name for the table (optional, uses the database's default schema if not specified). + metadata_column_name + The name of the metadata column (optional, if None metadata will not be queried). """ - self.table_name: str = table_name + self.view_name: str = table_name + self.embedding_table_name = embedding_table_name or table_name + "_store" + self.id_column_name = id_column_name + self.metadata_column_name = metadata_column_name self.schema_name: str | None = schema_name self.num_dimensions: int = num_dimensions if distance_type == "cosine" or distance_type == "<=>": @@ -79,11 +89,11 @@ def _quote_ident(ident: str) -> str: """ return '"{}"'.format(ident.replace('"', '""')) - def _quoted_table_name(self) -> str: + def _quoted_table_name(self, table_name: str) -> str: if self.schema_name is not None: - return self._quote_ident(self.schema_name) + "." + self._quote_ident(self.table_name) + return self._quote_ident(self.schema_name) + "." + self._quote_ident(table_name) else: - return self._quote_ident(self.table_name) + return self._quote_ident(table_name) def get_row_exists_query(self) -> str: """ @@ -93,7 +103,7 @@ def get_row_exists_query(self) -> str: ------- str: The query to check for row existence. """ - return f"SELECT 1 FROM {self._quoted_table_name()} LIMIT 1" + return f"SELECT 1 FROM {self._quoted_table_name(self.view_name)} LIMIT 1" def get_upsert_query(self) -> str: """ @@ -103,11 +113,22 @@ def get_upsert_query(self) -> str: ------- str: The upsert query. """ + if self.embedding_table_name != self.view_name: + # If there is a separate table for metadata (like the one created by pgai) we cannot insert it + return ( + f"INSERT INTO {self._quoted_table_name(self.embedding_table_name)} " + f"({self._quote_ident(self.id_column_name)}, chunk, embedding) " + f"VALUES ($1, $2, $3) ON CONFLICT DO NOTHING" + ) return ( - f"INSERT INTO {self._quoted_table_name()} (id, metadata, contents, embedding) " + f"INSERT INTO {self._quoted_table_name(self.embedding_table_name)} " + f"({self._quote_ident(self.id_column_name)},{self.metadata_or_empty()} chunk, embedding) " f"VALUES ($1, $2, $3, $4) ON CONFLICT DO NOTHING" ) + def metadata_or_empty(self): + return f"{self._quote_ident(self.metadata_column_name)}," if self.metadata_column_name is not None else "" + def get_approx_count_query(self) -> str: """ Generate a query to find the approximate count of records in the table. @@ -117,7 +138,7 @@ def get_approx_count_query(self) -> str: str: the query. """ # todo optimize with approx - return f"SELECT COUNT(*) as cnt FROM {self._quoted_table_name()}" + return f"SELECT COUNT(*) as cnt FROM {self._quoted_table_name(self.embedding_table_name)}" def get_create_query(self) -> str: """ @@ -160,8 +181,8 @@ def get_create_query(self) -> str: IMMUTABLE PARALLEL SAFE RETURNS NULL ON NULL INPUT; - SELECT create_hypertable('{self._quoted_table_name()}', - 'id', + SELECT create_hypertable('{self._quoted_table_name(self.embedding_table_name)}', + '{self.id_column_name}', if_not_exists=> true, time_partitioning_func=>'public.uuid_timestamp', chunk_time_interval => '{str(self.time_partition_interval.total_seconds())} seconds'::interval); @@ -171,21 +192,22 @@ def get_create_query(self) -> str: CREATE EXTENSION IF NOT EXISTS vectorscale; -CREATE TABLE IF NOT EXISTS {self._quoted_table_name()} ( - id {self.id_type} PRIMARY KEY, - metadata JSONB, - contents TEXT, +CREATE TABLE IF NOT EXISTS {self._quoted_table_name(self.embedding_table_name)} ( + {self._quote_ident(self.id_column_name)} {self.id_type} PRIMARY KEY, + {self.metadata_column_name} JSONB, + chunk TEXT, embedding VECTOR({self.num_dimensions}) ); -CREATE INDEX IF NOT EXISTS {self._quote_ident(self.table_name + "_meta_idx")} ON {self._quoted_table_name()} -USING GIN(metadata jsonb_path_ops); +CREATE INDEX IF NOT EXISTS {self._quote_ident(self.view_name + "_meta_idx")} +ON {self._quoted_table_name(self.embedding_table_name)} +USING GIN({self.metadata_column_name} jsonb_path_ops); {hypertable_sql} """ def _get_embedding_index_name_quoted(self) -> str: - return self._quote_ident(self.table_name + "_embedding_idx") + return self._quote_ident(self.embedding_table_name + "_embedding_idx") def _get_schema_qualified_embedding_index_name_quoted(self) -> str: if self.schema_name is not None: @@ -197,22 +219,31 @@ def drop_embedding_index_query(self) -> str: return f"DROP INDEX IF EXISTS {self._get_schema_qualified_embedding_index_name_quoted()};" def delete_all_query(self) -> str: - return f"TRUNCATE {self._quoted_table_name()};" + return f"TRUNCATE {self._quoted_table_name(self.embedding_table_name)};" def delete_by_ids_query(self, ids: list[uuid.UUID] | list[str]) -> tuple[str, list[Any]]: - query = f"DELETE FROM {self._quoted_table_name()} WHERE id = ANY($1::{self.id_type}[]);" + query = ( + f"DELETE FROM {self._quoted_table_name(self.embedding_table_name)} " + f"WHERE {self._quote_ident(self.id_column_name)} = ANY($1::{self.id_type}[]);" + ) return (query, [ids]) - def delete_by_metadata_query( - self, filter_conditions: dict[str, str] | list[dict[str, str]] - ) -> tuple[str, list[Any]]: + def delete_by_metadata_query(self, filter_conditions: Filter) -> tuple[str, list[Any]]: params: list[Any] = [] + using_clause = "" + join_clause = "" + if self.embedding_table_name != self.view_name: + using_clause, join_clause = self._using_join_clause() + (where, params) = self._where_clause_for_filter(params, filter_conditions) - query = f"DELETE FROM {self._quoted_table_name()} WHERE {where};" + query = ( + f"DELETE FROM {self._quoted_table_name(self.embedding_table_name)} {using_clause} WHERE" + f" {join_clause} {where};" + ) return (query, params) def drop_table_query(self) -> str: - return f"DROP TABLE IF EXISTS {self._quoted_table_name()};" + return f"DROP TABLE IF EXISTS {self._quoted_table_name(self.embedding_table_name)};" def default_max_db_connection_query(self) -> str: """ @@ -243,7 +274,7 @@ def create_embedding_index_query(self, index: BaseIndex, num_records_callback: C column_name = "embedding" index_name_quoted = self._get_embedding_index_name_quoted() query = index.create_index_query( - self._quoted_table_name(), + self._quoted_table_name(self.embedding_table_name), self._quote_ident(column_name), index_name_quoted, self.distance_type, @@ -251,21 +282,33 @@ def create_embedding_index_query(self, index: BaseIndex, num_records_callback: C ) return query + def _using_join_clause(self) -> tuple[str, str]: + return ( + f""" + USING {self._quoted_table_name(self.view_name)} + """, + f""" {self._quoted_table_name(self.view_name)}.{self._quote_ident(self.id_column_name)} = + {self._quoted_table_name(self.embedding_table_name)}.{self._quote_ident(self.id_column_name)} + AND""", + ) + def _where_clause_for_filter( - self, params: list[Any], filter: Mapping[str, datetime | str] | list[dict[str, str]] | None + self, + params: list[Any], + filter: Filter = None, ) -> tuple[str, list[Any]]: if filter is None: return "TRUE", params if isinstance(filter, dict): - where = f"metadata @> ${len(params)+1}" + where = f"{self.metadata_column_name} @> ${len(params)+1}" json_object = json.dumps(filter) params = params + [json_object] elif isinstance(filter, list): any_params: list[str] = [] for _idx, filter_dict in enumerate(filter, start=len(params) + 1): any_params.append(json.dumps(filter_dict)) - where = f"metadata @> ANY(${len(params) + 1}::jsonb[])" + where = f"{self.metadata_column_name} @> ANY(${len(params) + 1}::jsonb[])" params = params + [any_params] else: raise ValueError(f"Unknown filter type: {type(filter)}") @@ -276,7 +319,7 @@ def search_query( self, query_embedding: list[float] | np.ndarray[Any, Any] | None, limit: int = 10, - filter: Mapping[str, datetime | str] | list[dict[str, str]] | None = None, + filter: Filter = None, predicates: Predicates | None = None, uuid_time_filter: UUIDTimeRange | None = None, ) -> tuple[str, list[Any]]: @@ -288,7 +331,7 @@ def search_query( """ params: list[Any] = [] if query_embedding is not None: - distance = f"embedding {self.distance_type} ${len(params)+1}" + distance = f"embedding {self.distance_type} ${len(params) + 1}" params = params + [query_embedding] order_by_clause = f"ORDER BY {distance} ASC" else: @@ -312,11 +355,11 @@ def search_query( del filter["__end_date"] where_clauses: list[str] = [] - if filter is not None: + if filter is not None and self.metadata_column_name is not None: (where_filter, params) = self._where_clause_for_filter(params, filter) where_clauses.append(where_filter) - if predicates is not None: + if predicates is not None and self.metadata_column_name is not None: (where_predicates, params) = predicates.build_query(params) where_clauses.append(where_predicates) @@ -328,9 +371,13 @@ def search_query( query = f""" SELECT - id, metadata, contents, embedding, {distance} as distance + {self._quote_ident(self.id_column_name)}, + {self.metadata_or_empty()} + chunk, + embedding, + {distance} as distance FROM - {self._quoted_table_name()} + {self._quoted_table_name(self.view_name)} WHERE {where} {order_by_clause} diff --git a/timescale_vector/client/sync_client.py b/timescale_vector/client/sync_client.py index 091f8fe..e83dc62 100644 --- a/timescale_vector/client/sync_client.py +++ b/timescale_vector/client/sync_client.py @@ -1,9 +1,9 @@ import json import re import uuid -from collections.abc import Iterator, Mapping +from collections.abc import Iterator from contextlib import contextmanager -from datetime import datetime, timedelta +from datetime import timedelta from typing import Any, Literal import numpy as np @@ -11,12 +11,12 @@ from pgvector.psycopg2 import register_vector # type: ignore from psycopg2 import connect from psycopg2.extensions import connection as PSYConnection -from psycopg2.extras import DictCursor, register_uuid +from psycopg2.extras import DictCursor, RealDictRow, register_uuid from psycopg2.pool import SimpleConnectionPool from timescale_vector.client.index import BaseIndex, QueryParams from timescale_vector.client.predicates import Predicates -from timescale_vector.client.query_builder import QueryBuilder +from timescale_vector.client.query_builder import Filter, QueryBuilder from timescale_vector.client.uuid_time_range import UUIDTimeRange @@ -34,6 +34,9 @@ def __init__( max_db_connections: int | None = None, infer_filters: bool = True, schema_name: str | None = None, + embedding_table_name: str | None = None, + id_column_name: str = "embedding_uuid", + metadata_column_name: str | None = None, ) -> None: """ Initializes a sync client for storing vector data. @@ -65,6 +68,9 @@ def __init__( time_partition_interval, infer_filters, schema_name, + embedding_table_name, + id_column_name, + metadata_column_name, ) self.service_url: str = service_url self.pool: SimpleConnectionPool | None = None @@ -236,7 +242,7 @@ def delete_by_ids(self, ids: list[uuid.UUID] | list[str]) -> None: with self.connect() as conn, conn.cursor() as cur: cur.execute(translated_query, translated_params) - def delete_by_metadata(self, filter: dict[str, str] | list[dict[str, str]]) -> None: + def delete_by_metadata(self, filter: Filter) -> None: """ Delete records by metadata filters. """ @@ -304,11 +310,11 @@ def search( self, query_embedding: ndarray[Any, Any] | list[float] | None = None, limit: int = 10, - filter: Mapping[str, datetime | str] | list[dict[str, str]] | None = None, + filter: Filter = None, predicates: Predicates | None = None, uuid_time_filter: UUIDTimeRange | None = None, query_params: QueryParams | None = None, - ) -> list[tuple[Any, ...]]: + ) -> list[RealDictRow]: """ Retrieves similar records using a similarity query. diff --git a/timescale_vector/typings/psycopg2/extensions.pyi b/timescale_vector/typings/psycopg2/extensions.pyi index f28d064..08cbeb4 100644 --- a/timescale_vector/typings/psycopg2/extensions.pyi +++ b/timescale_vector/typings/psycopg2/extensions.pyi @@ -1,10 +1,12 @@ from typing import Any, Protocol +from psycopg2.extras import RealDictRow + class cursor(Protocol): def execute(self, query: str, vars: Any | None = None) -> Any: ... def executemany(self, query: str, vars_list: list[Any]) -> Any: ... def fetchone(self) -> tuple[Any, ...] | None: ... - def fetchall(self) -> list[tuple[Any, ...]]: ... + def fetchall(self) -> list[RealDictRow]: ... def __enter__(self) -> cursor: ... def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None: ... @@ -12,7 +14,10 @@ class connection(Protocol): def cursor(self, cursor_factory: Any | None = None) -> cursor: ... def commit(self) -> None: ... def close(self) -> None: ... + def set_isolation_level(self, isolation_level: int) -> None: ... def __enter__(self) -> connection: ... def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None: ... def register_uuid(oids: Any | None = None, conn_or_curs: Any | None = None) -> None: ... + +ISOLATION_LEVEL_AUTOCOMMIT: int diff --git a/timescale_vector/typings/psycopg2/extras.pyi b/timescale_vector/typings/psycopg2/extras.pyi index 1f39933..c657be7 100644 --- a/timescale_vector/typings/psycopg2/extras.pyi +++ b/timescale_vector/typings/psycopg2/extras.pyi @@ -1,4 +1,5 @@ -from typing import Protocol +from collections.abc import ItemsView, Iterator, KeysView, Mapping, Sequence, ValuesView +from typing import Any, Protocol, TypeVar from psycopg2.extensions import cursor @@ -6,3 +7,19 @@ class DictCursor(cursor, Protocol): def __init__(self) -> None: ... def register_uuid(oids: int | None = None, conn_or_curs: cursor | None = None) -> None: ... + +T = TypeVar("T") + +class RealDictRow(Mapping[str, Any]): + """A row of database results that allows both sequence and mapping access.""" + + def __init__(self, row: Sequence[Any], cursor: Any) -> None: ... + def __getitem__(self, key: str | int) -> Any: ... + def __iter__(self) -> Iterator[str]: ... + def __len__(self) -> int: ... + def __contains__(self, key: object) -> bool: ... + def get(self, key: str, default: T = None) -> Any | T: ... + def items(self) -> ItemsView[str, Any]: ... + def keys(self) -> KeysView[str]: ... + def values(self) -> ValuesView[Any]: ... + def __getattr__(self, name: str) -> Any: ...