Skip to content

Commit 35ecac2

Browse files
committed
Update the datatype for parameters in rerank() (#163)
## Problem Update the datatype of `parameters` in `rerank()` from `Map<String, Object>` to `Map<String, String>` to better match the OAS. ## Solution Updated the datatype for the rerank() so the base overloaded method is now: ```java public RerankResult rerank(String model, String query, List<Map<String, String>> documents, List<String> rankFields, int topN, boolean returnDocuments, Map<String, String> parameters) ``` As a part of this change, I have also updated the integration test and README. ## Type of Change - [X] 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) - [ ] Non-code change (docs, etc) - [ ] None of the above: (explain here) ## Test Plan Updated the integration test for rerank and the rest of them should run as it is.
1 parent 416934d commit 35ecac2

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ int topN = 2;
633633
boolean returnDocuments = true;
634634

635635
// Additional model-specific parameters for the reranker
636-
Map<String, Object> parameters = new HashMap<>();
636+
Map<String, String> parameters = new HashMap<>();
637637
parameters.put("truncate", "END");
638638

639639
// Send ranking request

src/integration/java/io/pinecone/integration/inference/RerankTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void testRerank() throws ApiException {
4747
List<String> rankFields = Arrays.asList("my_field");
4848
int topN = 2;
4949
boolean returnDocuments = true;
50-
Map<String, Object> parameters = new HashMap<>();
50+
Map<String, String> parameters = new HashMap<>();
5151
parameters.put("truncate", "END");
5252

5353
RerankResult result = inference.rerank(model, query, documents, rankFields, topN, returnDocuments, parameters);

src/main/java/io/pinecone/clients/Inference.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public RerankResult rerank(String model,
104104
List<String> rankFields,
105105
int topN,
106106
boolean returnDocuments,
107-
Map<String, Object> parameters) throws ApiException {
107+
Map<String, String> parameters) throws ApiException {
108108
RerankRequest rerankRequest = new RerankRequest();
109109

110110
rerankRequest
@@ -114,7 +114,7 @@ public RerankResult rerank(String model,
114114
.rankFields(rankFields)
115115
.topN(topN)
116116
.returnDocuments(returnDocuments)
117-
.putAdditionalProperty("parameters", parameters);
117+
.parameters(parameters);
118118

119119
return inferenceApi.rerank(rerankRequest);
120120
}

0 commit comments

Comments
 (0)