MCPcopy Create free account
hub / github.com/dashscope/dashscope-sdk-java / basicCall

Method basicCall

samples/TextEmbeddingUsage.java:12–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10
11public final class TextEmbeddingUsage {
12 public static void basicCall() throws ApiException, NoApiKeyException{
13 TextEmbeddingParam param = TextEmbeddingParam
14 .builder()
15 .model(TextEmbedding.Models.TEXT_EMBEDDING_V3)
16 .dimension(128)
17 .outputType(TextEmbeddingParam.OutputType.DENSE)
18 .instruct("Given a web search query, retrieve relevant passages that answer the query")
19 .texts(Arrays.asList("风急天高猿啸哀", "渚清沙白鸟飞回", "无边落木萧萧下", "不尽长江滚滚来")).build();
20 TextEmbedding textEmbedding = new TextEmbedding();
21 TextEmbeddingResult result = textEmbedding.call(param);
22 System.out.println(JsonUtils.gson.toJson(result));
23 }
24
25 public static void callWithCallback() throws ApiException, NoApiKeyException, InterruptedException{
26 TextEmbeddingParam param = TextEmbeddingParam

Callers 1

mainMethod · 0.95

Calls 4

callMethod · 0.95
builderMethod · 0.80
toJsonMethod · 0.80
buildMethod · 0.65

Tested by

no test coverage detected