Skip to content

Commit a092bc1

Browse files
committed
Clippy cleanup
1 parent c47ab35 commit a092bc1

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
@@ -1060,7 +1060,7 @@ impl Collection {
10601060
}
10611061

10621062
#[instrument(skip(self))]
1063-
pub async fn rag(&self, query: Json, pipeline: &Pipeline) -> anyhow::Result<Json> {
1063+
pub async fn rag(&self, query: Json, pipeline: &mut Pipeline) -> anyhow::Result<Json> {
10641064
let pool = get_or_initialize_pool(&self.database_url).await?;
10651065
let (built_query, values) = build_rag_query(query.clone(), self, pipeline, false).await?;
10661066
let mut results: Vec<(Json,)> = sqlx::query_as_with(&built_query, values)
@@ -1070,7 +1070,11 @@ impl Collection {
10701070
}
10711071

10721072
#[instrument(skip(self))]
1073-
pub async fn rag_stream(&self, query: Json, pipeline: &Pipeline) -> anyhow::Result<RAGStream> {
1073+
pub async fn rag_stream(
1074+
&self,
1075+
query: Json,
1076+
pipeline: &mut Pipeline,
1077+
) -> anyhow::Result<RAGStream> {
10741078
let pool = get_or_initialize_pool(&self.database_url).await?;
10751079

10761080
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)