diff --git a/pgml-sdks/rust/pgml/javascript/tests/typescript-tests/test.ts b/pgml-sdks/rust/pgml/javascript/tests/typescript-tests/test.ts index ae21bf573..711f2c5a6 100644 --- a/pgml-sdks/rust/pgml/javascript/tests/typescript-tests/test.ts +++ b/pgml-sdks/rust/pgml/javascript/tests/typescript-tests/test.ts @@ -16,7 +16,7 @@ if (!DATABASE_URL) { } const LOG_LEVEL = process.env.LOG_LEVEL ? process.env.LOG_LEVEL : "ERROR"; -pgml.js_init_logger(DATABASE_URL, LOG_LEVEL); +pgml.js_init_logger(LOG_LEVEL); const generate_dummy_documents = (count: number) => { let docs = []; @@ -127,9 +127,10 @@ it("pipeline to dict", async () => { let model = pgml.newModel("text-embedding-ada-002", "openai"); let splitter = pgml.newSplitter(); let pipeline = pgml.newPipeline("test_j_p_ptd_0", model, splitter); - let collection = pgml.newCollection("test_j_c_ptd_1"); + let collection = pgml.newCollection("test_j_c_ptd_2"); await collection.add_pipeline(pipeline); let pipeline_dict = await pipeline.to_dict(); console.log(JSON.stringify(pipeline_dict)) expect(pipeline_dict["name"]).toBe("test_j_p_ptd_0"); + await collection.archive(); }); diff --git a/pgml-sdks/rust/pgml/src/collection.rs b/pgml-sdks/rust/pgml/src/collection.rs index 39ae112b3..d680cac53 100644 --- a/pgml-sdks/rust/pgml/src/collection.rs +++ b/pgml-sdks/rust/pgml/src/collection.rs @@ -939,7 +939,7 @@ impl Collection { FROM %s p INNER JOIN pgml.models m ON p.model_id = m.id - INNER JOIN pgml.sdk_splitters s ON p.splitter_id = s.id + INNER JOIN pgml.splitters s ON p.splitter_id = s.id WHERE p.active = TRUE "#, @@ -1002,7 +1002,7 @@ impl Collection { FROM %s p INNER JOIN pgml.models m ON p.model_id = m.id - INNER JOIN pgml.sdk_splitters s ON p.splitter_id = s.id + INNER JOIN pgml.splitters s ON p.splitter_id = s.id WHERE p.active = TRUE AND p.name = $1 diff --git a/pgml-sdks/rust/pgml/src/pipeline.rs b/pgml-sdks/rust/pgml/src/pipeline.rs index 2963ca78c..594d05e57 100644 --- a/pgml-sdks/rust/pgml/src/pipeline.rs +++ b/pgml-sdks/rust/pgml/src/pipeline.rs @@ -257,7 +257,7 @@ impl Pipeline { self.model = Some(model); let splitter: models::Splitter = - sqlx::query_as("SELECT * FROM pgml.sdk_splitters WHERE id = $1") + sqlx::query_as("SELECT * FROM pgml.splitters WHERE id = $1") .bind(p.splitter_id) .fetch_one(&pool) .await?; diff --git a/pgml-sdks/rust/pgml/src/queries.rs b/pgml-sdks/rust/pgml/src/queries.rs index bd6913a45..31122aac4 100644 --- a/pgml-sdks/rust/pgml/src/queries.rs +++ b/pgml-sdks/rust/pgml/src/queries.rs @@ -18,7 +18,7 @@ CREATE TABLE IF NOT EXISTS %s ( name text NOT NULL, created_at timestamp NOT NULL DEFAULT now(), model_id int8 NOT NULL REFERENCES pgml.models ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED, - splitter_id int8 NOT NULL REFERENCES pgml.sdk_splitters ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED, + splitter_id int8 NOT NULL REFERENCES pgml.splitters ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED, active BOOLEAN NOT NULL DEFAULT TRUE, parameters jsonb NOT NULL DEFAULT '{}', UNIQUE (name) @@ -37,7 +37,7 @@ CREATE TABLE IF NOT EXISTS %s ( "#; pub const CREATE_SPLITTERS_TABLE: &str = r#" -CREATE TABLE IF NOT EXISTS pgml.sdk_splitters ( +CREATE TABLE IF NOT EXISTS pgml.splitters ( id serial8 PRIMARY KEY, created_at timestamp NOT NULL DEFAULT now(), name text NOT NULL, @@ -49,7 +49,7 @@ CREATE TABLE IF NOT EXISTS pgml.sdk_splitters ( pub const CREATE_CHUNKS_TABLE: &str = r#"CREATE TABLE IF NOT EXISTS %s ( id serial8 PRIMARY KEY, created_at timestamp NOT NULL DEFAULT now(), document_id int8 NOT NULL REFERENCES %s ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED, - splitter_id int8 NOT NULL REFERENCES pgml.sdk_splitters ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED, + splitter_id int8 NOT NULL REFERENCES pgml.splitters ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED, chunk_index int8 NOT NULL, chunk text NOT NULL, UNIQUE (document_id, splitter_id, chunk_index) @@ -241,7 +241,7 @@ WITH splitter as ( name, parameters FROM - pgml.sdk_splitters + pgml.splitters WHERE id = $1 ) @@ -291,7 +291,7 @@ WITH splitter as ( name, parameters FROM - pgml.sdk_splitters + pgml.splitters WHERE id = $1 ) diff --git a/pgml-sdks/rust/pgml/src/splitter.rs b/pgml-sdks/rust/pgml/src/splitter.rs index 91a3dfa2a..7a745771a 100644 --- a/pgml-sdks/rust/pgml/src/splitter.rs +++ b/pgml-sdks/rust/pgml/src/splitter.rs @@ -72,7 +72,7 @@ impl Splitter { .expect("Cannot verify splitter without project info"); let splitter: Option = sqlx::query_as( - "SELECT * FROM pgml.sdk_splitters WHERE project_id = $1 AND name = $2 and parameters = $3", + "SELECT * FROM pgml.splitters WHERE project_id = $1 AND name = $2 and parameters = $3", ) .bind(project_info.id) .bind(&self.name) @@ -85,7 +85,7 @@ impl Splitter { s } else { sqlx::query_as( - "INSERT INTO pgml.sdk_splitters (project_id, name, parameters) VALUES ($1, $2, $3) RETURNING *", + "INSERT INTO pgml.splitters (project_id, name, parameters) VALUES ($1, $2, $3) RETURNING *", ) .bind(project_info.id) .bind(&self.name)