1
## one: runs an LLM on one input
1
## one: runs an LLM on one input
2
2
3
Before running this script, create a `klex.json` file in the
3
Before running this script, create a `klex.json` file in the
4
root of your git repo, with these contents:
4
root of your git repo, with these contents:
5
5
6
```json
6
```json
7
{
7
{
8
"project_name": "**name**",
8
"project_name": "**name**",
9
"owner_username": "**your oscarkilo.com username**",
9
"owner_username": "**your oscarkilo.com username**",
10
"reader_username": "**your oscarkilo.com username**",
10
"reader_username": "**your oscarkilo.com username**",
11
"datasets_dir": "**optional**",
11
"datasets_dir": "**optional**",
12
"klex_url": "https://las.oscarkilo.com/klex",
12
"klex_url": "https://las.oscarkilo.com/klex",
13
"api_key_file": "klex.key"
13
"api_key_file": "klex.key"
14
}
14
}
15
```
15
```
16
16
17
Then put [your Klex API key](https://oscarkilo.com/login/profile) into
17
Then put [your Klex API key](https://oscarkilo.com/login/profile) into
18
the `klex.key` file.
18
the `klex.key` file.
19
19
20
Then run this command once:
20
Then run this command once:
21
21
22
```bash
22
```bash
23
go get oscarkilo.com/klex-git
23
go get oscarkilo.com/klex-git
24
```
24
```
25
25
26
Now you're ready for the examples below.
26
Now you're ready for the examples below.
27
27
28
### Hello World example
28
### Hello World example
29
29
30
```bash
30
```bash
31
go run oscarkilo.com/klex-git/one <<EOF
31
go run oscarkilo.com/klex-git/one <<EOF
32
{
32
{
33
"model": "Any big LLM",
33
"model": "Any big LLM",
34
"messages": [{
34
"messages": [{
35
"role": "user",
35
"role": "user",
36
"content": [{
36
"content": [{
37
"type": "text",
37
"type": "text",
38
"text": "Which band played Hotel California in Lebowski?"
38
"text": "Which band played Hotel California in Lebowski?"
39
}]
39
}]
40
}]
40
}]
41
}
41
}
42
42
43
EOF
43
EOF
44
```
44
```
45
45
46
### Reading prompts from files
46
### Reading prompts from files
47
47
48
```bash
48
```bash
49
echo "Tell me it's going to rain tomorrow." > prompt.txt
49
echo "Tell me it's going to rain tomorrow." > prompt.txt
50
echo "You're a folksy pirate; speak like it." > system.txt
50
echo "You're a folksy pirate; speak like it." > system.txt
51
go run oscarkilo.com/klex-git/one \
51
go run oscarkilo.com/klex-git/one \
52
-model= \
52
-model= \
53
-system=system.txt \
53
-system=system.txt \
54
-prompt=prompt.txt
54
-prompt=prompt.txt
55
rm prompt.txt system.txt
55
```
56
```