Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/LLM-API/LLMAPI.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ LLMAPI class >> llmSettingOn: aBuilder [
<systemsettings>
(aBuilder group: #LLMAPI)
parent: #tools;
name: 'LLM API';
name: self settingName;
with: [
(aBuilder setting: #apiKey)
order: -100000;
Expand Down Expand Up @@ -112,6 +112,12 @@ LLMAPI class >> port: aPortNumber [
port := aPortNumber
]

{ #category : 'as yet unclassified' }
LLMAPI class >> settingName [

^ 'LLM API'
]

{ #category : 'accessing' }
LLMAPI >> apiKey [

Expand Down
38 changes: 38 additions & 0 deletions src/LLM-API/LLMAPIChat.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,48 @@ result := api performRequest.
Class {
#name : 'LLMAPIChat',
#superclass : 'LLMAPI',
#classInstVars : [
'chatModel'
],
#category : 'LLM-API',
#package : 'LLM-API'
}

{ #category : 'accessing' }
LLMAPIChat class >> chatModel [

^ chatModel
]

{ #category : 'accessing' }
LLMAPIChat class >> chatModel: anObject [

chatModel := anObject
]

{ #category : 'as yet unclassified' }
LLMAPIChat class >> llmSettingOn: aBuilder [

<systemsettings>
(aBuilder group: #LLMChat)
parent: super settingName;
name: 'LLM Chat';
with: [
(aBuilder setting: #chatModel)
order: 0;
label: 'LLM Chat default model';
target: self;
default: 'devstral:latest';
ghostHelp: 'devstral:latest' ]
]

{ #category : 'initialization' }
LLMAPIChat >> initialize [

super initialize.
self payload model: self class chatModel
]

{ #category : 'accessing' }
LLMAPIChat >> path [
^ 'v1/chat/completions'
Expand Down
11 changes: 7 additions & 4 deletions src/LLM-Spec/LLMAPISpecChat.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,16 @@ Class {
#package : 'LLM-Spec'
}

{ #category : 'initialization' }
{ #category : 'api' }
LLMAPISpecChat >> askLLM [

| api result resultContent |
history addMessage:
(LLMAPIChatObjectMessage role: 'user' content: inputField text).
api := LLMAPI chat.
api host: 'api.mistral.ai'.
api payload
temperature: 0.5;
model: 'mistral-small-latest';
top_p: 1;
max_tokens: 250;
tools:
(LLMAPIChatObjectTool allSubclasses collect: [ :clazz | clazz new ]);
messages: history model.
Expand Down Expand Up @@ -61,6 +58,12 @@ LLMAPISpecChat >> defaultLayout [
yourself
]

{ #category : 'accessing' }
LLMAPISpecChat >> history [

^ history
]

{ #category : 'initialization' }
LLMAPISpecChat >> initializePresenters [

Expand Down
Loading