Skip to content

Commit 9367769

Browse files
committed
chore(community): format
1 parent 237c75b commit 9367769

File tree

1 file changed

+35
-20
lines changed

1 file changed

+35
-20
lines changed

libs/langchain-community/src/vectorstores/tests/pgvector/pgvector.int.test.ts

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -843,16 +843,19 @@ describe("PGVectorStore with skipInitializationCheck", () => {
843843
},
844844
};
845845

846-
pgvectorVectorStore = await PGVectorStore.initialize(embeddingsEngine, config);
847-
846+
pgvectorVectorStore = await PGVectorStore.initialize(
847+
embeddingsEngine,
848+
config
849+
);
850+
848851
const result = await pgvectorVectorStore.pool.query(
849852
`SELECT EXISTS (
850853
SELECT FROM information_schema.tables
851854
WHERE table_schema = 'public'
852855
AND table_name = '${tableName}'
853856
)`
854857
);
855-
858+
856859
expect(result.rows[0].exists).toBe(true);
857860
await pgvectorVectorStore.end();
858861
});
@@ -869,25 +872,28 @@ describe("PGVectorStore with skipInitializationCheck", () => {
869872
metadataColumnName: "metadata",
870873
},
871874
};
872-
873-
pgvectorVectorStore = await PGVectorStore.initialize(embeddingsEngine, config);
874-
875+
876+
pgvectorVectorStore = await PGVectorStore.initialize(
877+
embeddingsEngine,
878+
config
879+
);
880+
875881
const tableExists = await pgvectorVectorStore.pool.query(
876882
`SELECT EXISTS (
877883
SELECT FROM information_schema.tables
878884
WHERE table_schema = 'public'
879885
AND table_name = '${tableName}'
880886
)`
881887
);
882-
888+
883889
expect(tableExists.rows[0].exists).toBe(false);
884-
890+
885891
await pgvectorVectorStore.end();
886892
});
887893

888894
test("skipInitializationCheck=true should work with addDocuments", async () => {
889895
const setupPool = new pg.Pool(postgresConnectionOptions);
890-
896+
891897
await setupPool.query(`CREATE EXTENSION IF NOT EXISTS vector`);
892898
await setupPool.query(`
893899
CREATE TABLE "${tableName}" (
@@ -897,9 +903,9 @@ describe("PGVectorStore with skipInitializationCheck", () => {
897903
"vector" vector(1536)
898904
);
899905
`);
900-
906+
901907
await setupPool.end();
902-
908+
903909
const config: PGVectorStoreArgs = {
904910
postgresConnectionOptions,
905911
tableName,
@@ -911,22 +917,31 @@ describe("PGVectorStore with skipInitializationCheck", () => {
911917
metadataColumnName: "metadata",
912918
},
913919
};
914-
915-
pgvectorVectorStore = await PGVectorStore.initialize(embeddingsEngine, config);
916-
920+
921+
pgvectorVectorStore = await PGVectorStore.initialize(
922+
embeddingsEngine,
923+
config
924+
);
925+
917926
const documents = [
918927
{ pageContent: "Hello world", metadata: { source: "test" } },
919-
{ pageContent: "Testing skipInitializationCheck", metadata: { source: "test" } },
928+
{
929+
pageContent: "Testing skipInitializationCheck",
930+
metadata: { source: "test" },
931+
},
920932
];
921-
933+
922934
await pgvectorVectorStore.addDocuments(documents);
923-
935+
924936
const query = await embeddingsEngine.embedQuery("Hello");
925-
const results = await pgvectorVectorStore.similaritySearchVectorWithScore(query, 1);
926-
937+
const results = await pgvectorVectorStore.similaritySearchVectorWithScore(
938+
query,
939+
1
940+
);
941+
927942
expect(results).toHaveLength(1);
928943
expect(results[0][0].pageContent).toBe("Hello world");
929-
944+
930945
await pgvectorVectorStore.end();
931946
});
932947
});

0 commit comments

Comments
 (0)