-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path_21_GemmaChat.java
More file actions
52 lines (46 loc) · 1.25 KB
/
_21_GemmaChat.java
File metadata and controls
52 lines (46 loc) · 1.25 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package devoxx.demo._2_gemma;
import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.ollama.OllamaChatModel;
import org.junit.jupiter.api.Test;
/**
* OLLAMA
*
* Installation
* https://ollama.com/download/mac
*
* Install & Test Gemma
* ollama run gemma:7b
* ollama list
*
* Test Gemma
*
*
curl http://localhost:11434/api/generate -d '{
"model": "gemma:7b",
"prompt": "Why is the sky blue?"
}'
clear
curl -N -s http://localhost:11434/api/generate -d '{
"model": "gemma:7b",
"prompt": "Why is the sky b
clear
curl -N -s http://localhost:11434/api/generate -d '{
"model": "gemma:7b",
"prompt": "Why is the sky blue?"
}' | while IFS= read -r line; do
echo "$line" | jq -r '.response' 2>/dev/null | tr '\n' ' ' | cut -b 1-50
donelue?"
}' | while IFS= read -r line; do
echo "$line" | jq -r '.response' 2>/dev/null | tr '\n' ' ' | cut -b 1-50
done
*/
public class _21_GemmaChat {
@Test
public void talkWithGemma() {
ChatLanguageModel gemma = OllamaChatModel.builder()
.baseUrl("http://localhost:11434/api/")
.modelName("gemma:7b")
.build();
System.out.println(gemma.generate("Present yourself , the name of the model, who trained you ?"));
}
}