-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path_11_LanguageModel_SayHelloTest.java
More file actions
30 lines (24 loc) · 1.04 KB
/
_11_LanguageModel_SayHelloTest.java
File metadata and controls
30 lines (24 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package devoxx.demo._1_vertexai;
import dev.langchain4j.model.language.LanguageModel;
import dev.langchain4j.model.output.Response;
import dev.langchain4j.model.vertexai.VertexAiLanguageModel;
import org.junit.jupiter.api.Test;
import static devoxx.demo.devoxx.Utilities.GCP_PROJECT_ENDPOINT;
import static devoxx.demo.devoxx.Utilities.GCP_PROJECT_ID;
import static devoxx.demo.devoxx.Utilities.GCP_PROJECT_LOCATION;
import static devoxx.demo.devoxx.Utilities.GCP_PROJECT_PUBLISHER;
class _11_LanguageModel_SayHelloTest {
@Test
public void shouldSayHelloToLLM() {
LanguageModel llm = VertexAiLanguageModel.builder()
.publisher(GCP_PROJECT_PUBLISHER)
.project(GCP_PROJECT_ID)
.endpoint(GCP_PROJECT_ENDPOINT)
.location(GCP_PROJECT_LOCATION)
.publisher(GCP_PROJECT_PUBLISHER)
.modelName("text-bison")
.build();
Response<String> response = llm.generate("Hello, LLM!");
System.out.println(response.content());
}
}