Skip to content

Commit 44cc8a0

Browse files
committed
Verifying on Python and JavaScript
1 parent 027080f commit 44cc8a0

File tree

9 files changed

+21
-13
lines changed

9 files changed

+21
-13
lines changed

pgml-sdks/pgml/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pgml-sdks/pgml/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pgml"
3-
version = "0.10.1"
3+
version = "0.11.0"
44
edition = "2021"
55
authors = ["PosgresML <team@postgresml.org>"]
66
homepage = "https://postgresml.org/"

pgml-sdks/pgml/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "maturin"
55
[project]
66
name = "pgml"
77
requires-python = ">=3.7"
8-
version = "0.10.1"
8+
version = "0.11.0"
99
description = "Python SDK is designed to facilitate the development of scalable vector search applications on PostgreSQL databases."
1010
authors = [
1111
{name = "PostgresML", email = "team@postgresml.org"},

pgml-sdks/pgml/python/tests/test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ def test_can_create_pipeline():
6666
assert pipeline is not None
6767

6868

69+
def test_can_create_multi_field_pipeline():
70+
pipeline = pgml.MultiFieldPipeline("test_p_p_tccmfp_0", {})
71+
assert pipeline is not None
72+
73+
6974
def test_can_create_builtins():
7075
builtins = pgml.Builtins()
7176
assert builtins is not None

pgml-sdks/pgml/src/languages/python.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ use pyo3::types::{PyDict, PyFloat, PyInt, PyList, PyString};
44
use pyo3::{prelude::*, types::PyBool};
55
use std::sync::Arc;
66

7-
use rust_bridge::python::CustomInto;
8-
97
use crate::types::{GeneralJsonAsyncIterator, GeneralJsonIterator, Json};
108

119
////////////////////////////////////////////////////////////////////////////////

pgml-sdks/pgml/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ pub use splitter::Splitter;
4747
pub use transformer_pipeline::TransformerPipeline;
4848

4949
// This is use when inserting collections to set the sdk_version used during creation
50-
static SDK_VERSION: &str = "0.9.2";
50+
// This doesn't actually mean the verion of the SDK it was created on, it means the
51+
// version it is compatible with
52+
static SDK_VERSION: &str = "0.11.0";
5153

5254
// Store the database(s) in a global variable so that we can access them from anywhere
5355
// This is not necessarily idiomatic Rust, but it is a good way to acomplish what we need
@@ -161,7 +163,8 @@ fn pgml(_py: pyo3::Python, m: &pyo3::types::PyModule) -> pyo3::PyResult<()> {
161163
m.add_function(pyo3::wrap_pyfunction!(init_logger, m)?)?;
162164
m.add_function(pyo3::wrap_pyfunction!(migrate, m)?)?;
163165
m.add_function(pyo3::wrap_pyfunction!(cli::cli, m)?)?;
164-
m.add_class::<pipeline::PipelinePython>()?;
166+
// m.add_class::<pipeline::PipelinePython>()?;
167+
m.add_class::<multi_field_pipeline::MultiFieldPipelinePython>()?;
165168
m.add_class::<collection::CollectionPython>()?;
166169
m.add_class::<model::ModelPython>()?;
167170
m.add_class::<splitter::SplitterPython>()?;

pgml-sdks/pgml/src/multi_field_pipeline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use crate::{
2020
};
2121

2222
#[cfg(feature = "python")]
23-
use crate::{model::ModelPython, splitter::SplitterPython, types::JsonPython};
23+
use crate::types::JsonPython;
2424

2525
type ParsedSchema = HashMap<String, FieldAction>;
2626

pgml-sdks/pgml/src/pipeline.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ use crate::{
1313

1414
/// A pipeline that processes documents
1515
/// This has been deprecated in favor of [MultiFieldPipeline]
16-
#[derive(alias, Debug, Clone)]
16+
// #[derive(alias, Debug, Clone)]
1717
pub struct Pipeline {
1818
pub name: String,
1919
pub model: Option<Model>,
2020
pub splitter: Option<Splitter>,
2121
pub parameters: Option<Json>,
2222
}
2323

24-
#[alias_methods(new)]
24+
// #[alias_methods(new)]
2525
impl Pipeline {
2626
/// Creates a new [Pipeline]
2727
///

pgml-sdks/rust-bridge/rust-bridge-macros/src/python.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,9 @@ pub fn generate_python_methods(
221221
let st = r.to_string();
222222
Some(if st.contains('&') {
223223
let st = st.replace("self", &wrapped_type_ident.to_string());
224-
let s = syn::parse_str::<syn::Type>(&st).unwrap_or_else(|_| panic!("Error converting self type to necessary syn type: {:?}",
225-
r));
224+
let s = syn::parse_str::<syn::Type>(&st).unwrap_or_else(|_| {
225+
panic!("Error converting self type to necessary syn type: {:?}", r)
226+
});
226227
s.to_token_stream()
227228
} else {
228229
quote! { #wrapped_type_ident }
@@ -265,6 +266,7 @@ pub fn generate_python_methods(
265266
};
266267

267268
// The new function for pyO3 requires some unique syntax
269+
// The way we use the #convert_from assumes that new has a return type
268270
let (signature, middle) = if method_ident == "new" {
269271
let signature = quote! {
270272
#[new]
@@ -296,7 +298,7 @@ pub fn generate_python_methods(
296298
use rust_bridge::python::CustomInto;
297299
#prepared_wrapper_arguments
298300
#middle
299-
let x: Self = x.custom_into();
301+
let x: #convert_from = x.custom_into();
300302
Ok(x)
301303
};
302304
(signature, middle)

0 commit comments

Comments
 (0)