-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path_12_LanguageModel_ModelTuningTest.java
More file actions
35 lines (28 loc) · 1.2 KB
/
_12_LanguageModel_ModelTuningTest.java
File metadata and controls
35 lines (28 loc) · 1.2 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
31
32
33
34
35
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;
public class _12_LanguageModel_ModelTuningTest {
@Test
public void shouldFineTuneYourRequest() {
LanguageModel llm = VertexAiLanguageModel.builder()
.publisher(GCP_PROJECT_PUBLISHER)
.project(GCP_PROJECT_ID)
.endpoint(GCP_PROJECT_ENDPOINT)
.location(GCP_PROJECT_LOCATION)
.modelName("text-bison")
.temperature(0.7)
.topK(3)
.topP(.8) // no both at same time
.maxRetries(3)
.maxOutputTokens(2000)
.build();
Response<String> response = llm.generate("What it the capital of France?");
System.out.println(response.content());
}
}