Skip to content

Commit 34e64d8

Browse files
authored
Make JSON pub and add derives for RankResult (#1513)
1 parent 803731b commit 34e64d8

File tree

1 file changed

+3
-3
lines changed
  • pgml-extension/src/bindings/transformers

1 file changed

+3
-3
lines changed

pgml-extension/src/bindings/transformers/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use anyhow::{anyhow, bail, Context, Result};
77
use pgrx::*;
88
use pyo3::prelude::*;
99
use pyo3::types::{PyBool, PyDict, PyFloat, PyInt, PyList, PyString, PyTuple};
10-
use serde::Deserialize;
10+
use serde::{Deserialize, Serialize};
1111
use serde_json::Value;
1212

1313
use crate::create_pymodule;
@@ -23,7 +23,7 @@ pub use transform::*;
2323
create_pymodule!("/src/bindings/transformers/transformers.py");
2424

2525
// Need a wrapper so we can implement traits for it
26-
struct Json(Value);
26+
pub struct Json(pub Value);
2727

2828
impl From<Json> for Value {
2929
fn from(value: Json) -> Self {
@@ -109,7 +109,7 @@ pub fn embed(transformer: &str, inputs: Vec<&str>, kwargs: &serde_json::Value) -
109109
})
110110
}
111111

112-
#[derive(Deserialize)]
112+
#[derive(Debug, Deserialize, Serialize, PartialEq, Clone)]
113113
pub struct RankResult {
114114
pub corpus_id: i64,
115115
pub score: f64,

0 commit comments

Comments
 (0)