Skip to content

Commit 6ed8d46

Browse files
authored
Update rerank example in the README after breaking changes (#177)
## Problem Rerank endpoint is updated to accept documents as List<Map<String, Object>> instead of List<Map<String, String>> and parameters now accepts Map<String, Object> instead of Map<String, String>. ## Solution Update the example in README for rerank example ## Type of Change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update - [ ] Infrastructure change (CI configs, etc) - [X] Non-code change (docs, etc) - [ ] None of the above: (explain here) ## Test Plan NA
1 parent 902f148 commit 6ed8d46

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -642,23 +642,23 @@ String model = "bge-reranker-v2-m3";
642642
String query = "The tech company Apple is known for its innovative products like the iPhone.";
643643

644644
// Add the documents to rerank
645-
List<Map<String, String>> documents = new ArrayList<>();
646-
Map<String, String> doc1 = new HashMap<>();
645+
List<Map<String, Object>> documents = new ArrayList<>();
646+
Map<String, Object> doc1 = new HashMap<>();
647647
doc1.put("id", "vec1");
648648
doc1.put("my_field", "Apple is a popular fruit known for its sweetness and crisp texture.");
649649
documents.add(doc1);
650650

651-
Map<String, String> doc2 = new HashMap<>();
651+
Map<String, Object> doc2 = new HashMap<>();
652652
doc2.put("id", "vec2");
653653
doc2.put("my_field", "Many people enjoy eating apples as a healthy snack.");
654654
documents.add(doc2);
655655

656-
Map<String, String> doc3 = new HashMap<>();
656+
Map<String, Object> doc3 = new HashMap<>();
657657
doc3.put("id", "vec3");
658658
doc3.put("my_field", "Apple Inc. has revolutionized the tech industry with its sleek designs and user-friendly interfaces.");
659659
documents.add(doc3);
660660

661-
Map<String, String> doc4 = new HashMap<>();
661+
Map<String, Object> doc4 = new HashMap<>();
662662
doc4.put("id", "vec4");
663663
doc4.put("my_field", "An apple a day keeps the doctor away, as the saying goes.");
664664
documents.add(doc4);
@@ -673,7 +673,7 @@ int topN = 2;
673673
boolean returnDocuments = true;
674674

675675
// Additional model-specific parameters for the reranker
676-
Map<String, String> parameters = new HashMap<>();
676+
Map<String, Object> parameters = new HashMap<>();
677677
parameters.put("truncate", "END");
678678

679679
// Send ranking request

0 commit comments

Comments
 (0)