Skip to content

Commit 12b07c4

Browse files
authored
Merge pull request #4 from Evref-BL/ollama
Ollama
2 parents 3c5639c + cb1bc6f commit 12b07c4

File tree

3 files changed

+52
-5
lines changed

3 files changed

+52
-5
lines changed

src/LLM-API/LLMAPI.class.st

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ LLMAPI class >> llmSettingOn: aBuilder [
7373
<systemsettings>
7474
(aBuilder group: #LLMAPI)
7575
parent: #tools;
76-
name: 'LLM API';
76+
name: self settingName;
7777
with: [
7878
(aBuilder setting: #apiKey)
7979
order: -100000;
@@ -112,6 +112,12 @@ LLMAPI class >> port: aPortNumber [
112112
port := aPortNumber
113113
]
114114

115+
{ #category : 'as yet unclassified' }
116+
LLMAPI class >> settingName [
117+
118+
^ 'LLM API'
119+
]
120+
115121
{ #category : 'accessing' }
116122
LLMAPI >> apiKey [
117123

src/LLM-API/LLMAPIChat.class.st

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,48 @@ result := api performRequest.
2323
Class {
2424
#name : 'LLMAPIChat',
2525
#superclass : 'LLMAPI',
26+
#classInstVars : [
27+
'chatModel'
28+
],
2629
#category : 'LLM-API',
2730
#package : 'LLM-API'
2831
}
2932

33+
{ #category : 'accessing' }
34+
LLMAPIChat class >> chatModel [
35+
36+
^ chatModel
37+
]
38+
39+
{ #category : 'accessing' }
40+
LLMAPIChat class >> chatModel: anObject [
41+
42+
chatModel := anObject
43+
]
44+
45+
{ #category : 'as yet unclassified' }
46+
LLMAPIChat class >> llmSettingOn: aBuilder [
47+
48+
<systemsettings>
49+
(aBuilder group: #LLMChat)
50+
parent: super settingName;
51+
name: 'LLM Chat';
52+
with: [
53+
(aBuilder setting: #chatModel)
54+
order: 0;
55+
label: 'LLM Chat default model';
56+
target: self;
57+
default: 'devstral:latest';
58+
ghostHelp: 'devstral:latest' ]
59+
]
60+
61+
{ #category : 'initialization' }
62+
LLMAPIChat >> initialize [
63+
64+
super initialize.
65+
self payload model: self class chatModel
66+
]
67+
3068
{ #category : 'accessing' }
3169
LLMAPIChat >> path [
3270
^ 'v1/chat/completions'

src/LLM-Spec/LLMAPISpecChat.class.st

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,16 @@ Class {
1717
#package : 'LLM-Spec'
1818
}
1919

20-
{ #category : 'initialization' }
20+
{ #category : 'api' }
2121
LLMAPISpecChat >> askLLM [
2222

2323
| api result resultContent |
2424
history addMessage:
2525
(LLMAPIChatObjectMessage role: 'user' content: inputField text).
2626
api := LLMAPI chat.
27-
api host: 'api.mistral.ai'.
2827
api payload
2928
temperature: 0.5;
30-
model: 'mistral-small-latest';
3129
top_p: 1;
32-
max_tokens: 250;
3330
tools:
3431
(LLMAPIChatObjectTool allSubclasses collect: [ :clazz | clazz new ]);
3532
messages: history model.
@@ -61,6 +58,12 @@ LLMAPISpecChat >> defaultLayout [
6158
yourself
6259
]
6360

61+
{ #category : 'accessing' }
62+
LLMAPISpecChat >> history [
63+
64+
^ history
65+
]
66+
6467
{ #category : 'initialization' }
6568
LLMAPISpecChat >> initializePresenters [
6669

0 commit comments

Comments
 (0)