Skip to content

Commit 109c6cf

Browse files
committed
RD-2603: Update examples of semantic vectors and similar terms endpoints
1 parent 2f7698c commit 109c6cf

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

examples/src/main/java/com/basistech/rosette/examples/SemanticVectorsExample.java

+18-14
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
/*
2-
* Copyright 2022 Basis Technology Corp.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
2+
* Copyright 2023 Basis Technology Corp.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
1616
package com.basistech.rosette.examples;
1717

1818
import com.basistech.rosette.api.HttpRosetteAPI;
1919
import com.basistech.rosette.apimodel.DocumentRequest;
20+
import com.basistech.rosette.apimodel.EmbeddingsMode;
2021
import com.basistech.rosette.apimodel.SemanticVectorsOptions;
2122
import com.basistech.rosette.apimodel.SemanticVectorsResponse;
2223

@@ -50,6 +51,9 @@ private void run() throws IOException {
5051
// When no options, use <?>.
5152
DocumentRequest<SemanticVectorsOptions> request = DocumentRequest.<SemanticVectorsOptions>builder()
5253
.content(semanticVectorsData)
54+
.options(SemanticVectorsOptions.builder()
55+
.embeddingsMode(EmbeddingsMode.GEN_1)
56+
.build())
5357
.build();
5458
SemanticVectorsResponse response = rosetteApi.perform(SEMANTIC_VECTORS_SERVICE_PATH, request, SemanticVectorsResponse.class);
5559
System.out.println(responseToJson(response));

examples/src/main/java/com/basistech/rosette/examples/SimilarTermsExample.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 Basis Technology Corp.
2+
* Copyright 2023 Basis Technology Corp.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
1818

1919
import com.basistech.rosette.api.HttpRosetteAPI;
2020
import com.basistech.rosette.apimodel.DocumentRequest;
21+
import com.basistech.rosette.apimodel.EmbeddingsMode;
2122
import com.basistech.rosette.apimodel.SimilarTermsOptions;
2223
import com.basistech.rosette.apimodel.SimilarTermsResponse;
2324
import com.basistech.util.LanguageCode;
@@ -54,6 +55,7 @@ private void run() throws IOException {
5455
DocumentRequest<SimilarTermsOptions> request = DocumentRequest.<SimilarTermsOptions>builder()
5556
.content(similarTermsData)
5657
.options(SimilarTermsOptions.builder()
58+
.embeddingsMode(EmbeddingsMode.GEN_1)
5759
.resultLanguages(Lists.newArrayList(LanguageCode.SPANISH, LanguageCode.GERMAN, LanguageCode.JAPANESE))
5860
.build())
5961
.build();

0 commit comments

Comments
 (0)