Skip to content

Commit f0099cf

Browse files
authored
Merge pull request #3 from psilberk/pom_and_demos1
Sample wip #2
2 parents e5e4ae3 + df07b40 commit f0099cf

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

  • samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/data/vectorstores/oracle

samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/data/vectorstores/oracle/Main.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,40 @@ public static void main(String[] args) {
3939
collection.createCollectionIfNotExistsAsync().block();
4040

4141
collection.upsertBatchAsync(getHotels(), null).block();
42+
43+
// Retrieve the upserted record.
44+
var retrievedHotel = collection.getAsync("1", null).block();
45+
46+
// Generate a vector for your search text, using your chosen embedding generation implementation.
47+
// Just showing a placeholder method here for brevity.
48+
// var searchVector = generateEmbeddingsAsync(
49+
// "I'm looking for a hotel where customer happiness is the priority.").block();
50+
51+
// Do the search.
52+
// var searchResult = collection.searchAsync(searchVector, VectorSearchOptions.builder()
53+
// .withTop(1).build()).block();
54+
55+
// Hotel record = searchResult.getResults().get(0).getRecord();
56+
// System.out.printf("Found hotel description: %s\n", record.getDescription());
57+
58+
}
59+
60+
private static List<Hotel> getHotels() {
61+
return Arrays.asList(
62+
new Hotel("id_1", "Hotel 1", 1, "Hotel 1 description",
63+
Arrays.asList(0.5f, 3.2f, 7.1f, -4.0f, 2.8f, 10.0f, -1.3f, 5.5f), null, null, null,
64+
4.0),
65+
new Hotel("id_2", "Hotel 2", 2, "Hotel 2 description",
66+
Arrays.asList(-2.0f, 8.1f, 0.9f, 5.4f, -3.3f, 2.2f, 9.9f, -4.5f), null, null, null,
67+
4.0),
68+
new Hotel("id_3", "Hotel 3", 3, "Hotel 3 description",
69+
Arrays.asList(4.5f, -6.2f, 3.1f, 7.7f, -0.8f, 1.1f, -2.2f, 8.3f), null, null, null,
70+
5.0),
71+
new Hotel("id_4", "Hotel 4", 4, "Hotel 4 description",
72+
Arrays.asList(7.0f, 1.2f, -5.3f, 2.5f, 6.6f, -7.8f, 3.9f, -0.1f), null, null, null,
73+
4.0),
74+
new Hotel("id_5", "Hotel 5", 5, "Hotel 5 description",
75+
Arrays.asList(-3.5f, 4.4f, -1.2f, 9.9f, 5.7f, -6.1f, 7.8f, -2.0f), null, null, null,
76+
4.0));
4277
}
4378
}

0 commit comments

Comments
 (0)