Skip to content

Commit dad8c12

Browse files
committed
Clippy cleanup
1 parent b4e35a1 commit dad8c12

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

pgml-sdks/pgml/src/builtins.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl Builtins {
8484
query.bind(task.0)
8585
};
8686
let results = query.bind(inputs).bind(args).fetch_all(&pool).await?;
87-
let results = results.get(0).unwrap().get::<serde_json::Value, _>(0);
87+
let results = results.first().unwrap().get::<serde_json::Value, _>(0);
8888
Ok(Json(results))
8989
}
9090
}

pgml-sdks/pgml/src/collection.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ impl Collection {
11261126
}
11271127

11281128
#[instrument(skip(self))]
1129-
pub async fn rag(&self, query: Json, pipeline: &Pipeline) -> anyhow::Result<Json> {
1129+
pub async fn rag(&self, query: Json, pipeline: &mut Pipeline) -> anyhow::Result<Json> {
11301130
let pool = get_or_initialize_pool(&self.database_url).await?;
11311131
let (built_query, values) = build_rag_query(query.clone(), self, pipeline, false).await?;
11321132
let mut results: Vec<(Json,)> = sqlx::query_as_with(&built_query, values)
@@ -1136,7 +1136,11 @@ impl Collection {
11361136
}
11371137

11381138
#[instrument(skip(self))]
1139-
pub async fn rag_stream(&self, query: Json, pipeline: &Pipeline) -> anyhow::Result<RAGStream> {
1139+
pub async fn rag_stream(
1140+
&self,
1141+
query: Json,
1142+
pipeline: &mut Pipeline,
1143+
) -> anyhow::Result<RAGStream> {
11401144
let pool = get_or_initialize_pool(&self.database_url).await?;
11411145

11421146
let (built_query, values) = build_rag_query(query.clone(), self, pipeline, true).await?;

pgml-sdks/pgml/src/transformer_pipeline.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl TransformerPipeline {
3232
a.insert("model".to_string(), model.into());
3333

3434
// We must convert any floating point values to integers or our extension will get angry
35-
for field in vec!["gpu_layers"] {
35+
for field in ["gpu_layers"] {
3636
if let Some(v) = a.remove(field) {
3737
let x: u64 = CustomU64Convertor(v).into();
3838
a.insert(field.to_string(), x.into());
@@ -62,7 +62,7 @@ impl TransformerPipeline {
6262
}
6363

6464
// We must convert any floating point values to integers or our extension will get angry
65-
for field in vec!["max_tokens", "n"] {
65+
for field in ["max_tokens", "n"] {
6666
if let Some(v) = a.remove(field) {
6767
let x: u64 = CustomU64Convertor(v).into();
6868
a.insert(field.to_string(), x.into());
@@ -95,7 +95,7 @@ impl TransformerPipeline {
9595
.fetch_all(&pool)
9696
.await?
9797
};
98-
let results = results.get(0).unwrap().get::<serde_json::Value, _>(0);
98+
let results = results.first().unwrap().get::<serde_json::Value, _>(0);
9999
Ok(Json(results))
100100
}
101101

@@ -121,7 +121,7 @@ impl TransformerPipeline {
121121
}
122122

123123
// We must convert any floating point values to integers or our extension will get angry
124-
for field in vec!["max_tokens", "n"] {
124+
for field in ["max_tokens", "n"] {
125125
if let Some(v) = a.remove(field) {
126126
let x: u64 = CustomU64Convertor(v).into();
127127
a.insert(field.to_string(), x.into());

0 commit comments

Comments
 (0)