Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e2cb2a8

Browse files
Refactor variable name
1 parent 334f169 commit e2cb2a8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

‎ComputeVectors.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,21 @@ SELECT id, CONCAT(
2929
" - Price: €", final_price,
3030
" - Rating: ", rating,
3131
"). ", description, "."
32-
) AS product
32+
) AS product_summary
3333
FROM products
3434
WHERE embedding IS NULL
3535
""").executeAndFetchTableLazy();
3636

3737
for (Row row : table.rows()) {
3838
var id = row.getString("id");
39-
var product = row.getString("product");
39+
var productSummary = row.getString("product_summary");
4040

4141
var requestBody = """
4242
{
4343
"model": "bert-embeddings",
4444
"input": %s
4545
}
46-
""".formatted(new ObjectMapper().writeValueAsString(product));
46+
""".formatted(new ObjectMapper().writeValueAsString(productSummary));
4747

4848
var response = Unirest.post("http://localhost:8080/v1/embeddings")
4949
.header("Content-Type", "application/json")

‎RagDemo.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ SELECT id, CONCAT(
5454
" - Price: €", final_price,
5555
" - Rating: ", rating,
5656
"). ", description, "."
57-
) AS product
57+
) AS product_summary
5858
FROM products
5959
WHERE embedding IS NOT NULL
6060
ORDER BY VEC_DISTANCE_COSINE(embedding, VEC_FromText(JSON_EXTRACT(:response, '$.data[0].embedding')))
@@ -64,7 +64,7 @@ ORDER BY VEC_DISTANCE_COSINE(embedding, VEC_FromText(JSON_EXTRACT(:response, '$.
6464
.executeAndFetchTable();
6565

6666
return table.rows().stream()
67-
.map(row -> row.getString("product"))
67+
.map(row -> row.getString("product_summary"))
6868
.collect(Collectors.joining("\n\n"));
6969
}
7070
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /