Skip to content

Commit 1f203ed

Browse files
authored
Merge branch 'main' into jinja-substitutions
Signed-off-by: AT <[email protected]>
2 parents 02972db + 1c89447 commit 1f203ed

30 files changed

+2234
-616
lines changed

common/common.cmake

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ function(gpt4all_add_warning_options target)
1111
-Wextra-semi
1212
-Wformat=2
1313
-Wmissing-include-dirs
14-
-Wstrict-overflow=2
1514
-Wsuggest-override
1615
-Wvla
1716
# errors

gpt4all-chat/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
88

99
### Added
1010
- Automatically substitute chat templates that are not compatible with Jinja2Cpp in GGUFs ([#3327](https://github.com/nomic-ai/gpt4all/pull/3327))
11+
- Built-in javascript code interpreter tool plus model ([#3173](https://github.com/nomic-ai/gpt4all/pull/3173))
1112

1213
### Fixed
1314
- Fix remote model template to allow for XML in messages ([#3318](https://github.com/nomic-ai/gpt4all/pull/3318))

gpt4all-chat/CMakeLists.txt

+7-1
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,9 @@ qt_add_executable(chat
193193
src/chatapi.cpp src/chatapi.h
194194
src/chatlistmodel.cpp src/chatlistmodel.h
195195
src/chatllm.cpp src/chatllm.h
196-
src/chatmodel.h
196+
src/chatmodel.h src/chatmodel.cpp
197197
src/chatviewtextprocessor.cpp src/chatviewtextprocessor.h
198+
src/codeinterpreter.cpp src/codeinterpreter.h
198199
src/database.cpp src/database.h
199200
src/download.cpp src/download.h
200201
src/embllm.cpp src/embllm.h
@@ -208,6 +209,9 @@ qt_add_executable(chat
208209
src/mysettings.cpp src/mysettings.h
209210
src/network.cpp src/network.h
210211
src/server.cpp src/server.h
212+
src/tool.cpp src/tool.h
213+
src/toolcallparser.cpp src/toolcallparser.h
214+
src/toolmodel.cpp src/toolmodel.h
211215
src/xlsxtomd.cpp src/xlsxtomd.h
212216
${CHAT_EXE_RESOURCES}
213217
${MACOS_SOURCES}
@@ -226,8 +230,10 @@ qt_add_qml_module(chat
226230
qml/AddHFModelView.qml
227231
qml/ApplicationSettings.qml
228232
qml/ChatDrawer.qml
233+
qml/ChatCollapsibleItem.qml
229234
qml/ChatItemView.qml
230235
qml/ChatMessageButton.qml
236+
qml/ChatTextItem.qml
231237
qml/ChatView.qml
232238
qml/CollectionsDrawer.qml
233239
qml/HomeView.qml

gpt4all-chat/metadata/models3.json

+16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
[
22
{
33
"order": "a",
4+
"md5sum": "a54c08a7b90e4029a8c2ab5b5dc936aa",
5+
"name": "Reasoner v1",
6+
"filename": "qwen2.5-coder-7b-instruct-q4_0.gguf",
7+
"filesize": "4431390720",
8+
"requires": "3.5.4-dev0",
9+
"ramrequired": "8",
10+
"parameters": "8 billion",
11+
"quant": "q4_0",
12+
"type": "qwen2",
13+
"description": "<ul><li>Based on <a href=\"https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct\">Qwen2.5-Coder 7B</a></li><li>Uses built-in javascript code interpreter</li><li>Use for complex reasoning tasks that can be aided by computation analysis</li><li>License: <a href=\"https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct/blob/main/LICENSE\">Apache License Version 2.0</a></li><li>#reasoning</li></ul>",
14+
"url": "https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF/resolve/main/qwen2.5-coder-7b-instruct-q4_0.gguf",
15+
"chatTemplate": "{{- '<|im_start|>system\\n' }}\n{% if toolList|length > 0 %}You have access to the following functions:\n{% for tool in toolList %}\nUse the function '{{tool.function}}' to: '{{tool.description}}'\n{% if tool.parameters|length > 0 %}\nparameters:\n{% for info in tool.parameters %}\n {{info.name}}:\n type: {{info.type}}\n description: {{info.description}}\n required: {{info.required}}\n{% endfor %}\n{% endif %}\n# Tool Instructions\nIf you CHOOSE to call this function ONLY reply with the following format:\n'{{tool.symbolicFormat}}'\nHere is an example. If the user says, '{{tool.examplePrompt}}', then you reply\n'{{tool.exampleCall}}'\nAfter the result you might reply with, '{{tool.exampleReply}}'\n{% endfor %}\nYou MUST include both the start and end tags when you use a function.\n\nYou are a helpful AI assistant who uses the functions to break down, analyze, perform, and verify complex reasoning tasks. You SHOULD try to verify your answers using the functions where possible.\n{% endif %}\n{{- '<|im_end|>\\n' }}\n{% for message in messages %}\n{{'<|im_start|>' + message['role'] + '\\n' + message['content'] + '<|im_end|>' + '\\n' }}\n{% endfor %}\n{% if add_generation_prompt %}\n{{ '<|im_start|>assistant\\n' }}\n{% endif %}\n",
16+
"systemPrompt": ""
17+
},
18+
{
19+
"order": "aa",
420
"md5sum": "c87ad09e1e4c8f9c35a5fcef52b6f1c9",
521
"name": "Llama 3 8B Instruct",
622
"filename": "Meta-Llama-3-8B-Instruct.Q4_0.gguf",

gpt4all-chat/qml/AddGPT4AllModelView.qml

+46
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,52 @@ ColumnLayout {
5656
Accessible.description: qsTr("Displayed when the models request is ongoing")
5757
}
5858

59+
RowLayout {
60+
ButtonGroup {
61+
id: buttonGroup
62+
exclusive: true
63+
}
64+
MyButton {
65+
text: qsTr("All")
66+
checked: true
67+
borderWidth: 0
68+
backgroundColor: checked ? theme.lightButtonBackground : "transparent"
69+
backgroundColorHovered: theme.lighterButtonBackgroundHovered
70+
backgroundRadius: 5
71+
padding: 15
72+
topPadding: 8
73+
bottomPadding: 8
74+
textColor: theme.lighterButtonForeground
75+
fontPixelSize: theme.fontSizeLarge
76+
fontPixelBold: true
77+
checkable: true
78+
ButtonGroup.group: buttonGroup
79+
onClicked: {
80+
ModelList.gpt4AllDownloadableModels.filter("");
81+
}
82+
83+
}
84+
MyButton {
85+
text: qsTr("Reasoning")
86+
borderWidth: 0
87+
backgroundColor: checked ? theme.lightButtonBackground : "transparent"
88+
backgroundColorHovered: theme.lighterButtonBackgroundHovered
89+
backgroundRadius: 5
90+
padding: 15
91+
topPadding: 8
92+
bottomPadding: 8
93+
textColor: theme.lighterButtonForeground
94+
fontPixelSize: theme.fontSizeLarge
95+
fontPixelBold: true
96+
checkable: true
97+
ButtonGroup.group: buttonGroup
98+
onClicked: {
99+
ModelList.gpt4AllDownloadableModels.filter("#reasoning");
100+
}
101+
}
102+
Layout.bottomMargin: 10
103+
}
104+
59105
ScrollView {
60106
id: scrollView
61107
ScrollBar.vertical.policy: ScrollBar.AsNeeded
+160
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
import Qt5Compat.GraphicalEffects
2+
import QtCore
3+
import QtQuick
4+
import QtQuick.Controls
5+
import QtQuick.Controls.Basic
6+
import QtQuick.Layouts
7+
8+
import gpt4all
9+
import mysettings
10+
import toolenums
11+
12+
ColumnLayout {
13+
property alias textContent: innerTextItem.textContent
14+
property bool isCurrent: false
15+
property bool isError: false
16+
17+
Layout.topMargin: 10
18+
Layout.bottomMargin: 10
19+
20+
Item {
21+
Layout.preferredWidth: childrenRect.width
22+
Layout.preferredHeight: 38
23+
RowLayout {
24+
anchors.left: parent.left
25+
anchors.top: parent.top
26+
anchors.bottom: parent.bottom
27+
28+
Item {
29+
width: myTextArea.width
30+
height: myTextArea.height
31+
TextArea {
32+
id: myTextArea
33+
text: {
34+
if (isError)
35+
return qsTr("Analysis encountered error");
36+
if (isCurrent)
37+
return qsTr("Analyzing");
38+
return qsTr("Analyzed");
39+
}
40+
padding: 0
41+
font.pixelSize: theme.fontSizeLarger
42+
enabled: false
43+
focus: false
44+
readOnly: true
45+
color: headerMA.containsMouse ? theme.mutedDarkTextColorHovered : theme.mutedTextColor
46+
hoverEnabled: false
47+
}
48+
49+
Item {
50+
id: textColorOverlay
51+
anchors.fill: parent
52+
clip: true
53+
visible: false
54+
Rectangle {
55+
id: animationRec
56+
width: myTextArea.width * 0.3
57+
anchors.top: parent.top
58+
anchors.bottom: parent.bottom
59+
color: theme.textColor
60+
61+
SequentialAnimation {
62+
running: isCurrent
63+
loops: Animation.Infinite
64+
NumberAnimation {
65+
target: animationRec;
66+
property: "x";
67+
from: -animationRec.width;
68+
to: myTextArea.width * 3;
69+
duration: 2000
70+
}
71+
}
72+
}
73+
}
74+
OpacityMask {
75+
visible: isCurrent
76+
anchors.fill: parent
77+
maskSource: myTextArea
78+
source: textColorOverlay
79+
}
80+
}
81+
82+
Item {
83+
id: caret
84+
Layout.preferredWidth: contentCaret.width
85+
Layout.preferredHeight: contentCaret.height
86+
Image {
87+
id: contentCaret
88+
anchors.centerIn: parent
89+
visible: false
90+
sourceSize.width: theme.fontSizeLarge
91+
sourceSize.height: theme.fontSizeLarge
92+
mipmap: true
93+
source: {
94+
if (contentLayout.state === "collapsed")
95+
return "qrc:/gpt4all/icons/caret_right.svg";
96+
else
97+
return "qrc:/gpt4all/icons/caret_down.svg";
98+
}
99+
}
100+
101+
ColorOverlay {
102+
anchors.fill: contentCaret
103+
source: contentCaret
104+
color: headerMA.containsMouse ? theme.mutedDarkTextColorHovered : theme.mutedTextColor
105+
}
106+
}
107+
}
108+
109+
MouseArea {
110+
id: headerMA
111+
hoverEnabled: true
112+
anchors.fill: parent
113+
onClicked: {
114+
if (contentLayout.state === "collapsed")
115+
contentLayout.state = "expanded";
116+
else
117+
contentLayout.state = "collapsed";
118+
}
119+
}
120+
}
121+
122+
ColumnLayout {
123+
id: contentLayout
124+
spacing: 0
125+
state: "collapsed"
126+
clip: true
127+
128+
states: [
129+
State {
130+
name: "expanded"
131+
PropertyChanges { target: contentLayout; Layout.preferredHeight: innerContentLayout.height }
132+
},
133+
State {
134+
name: "collapsed"
135+
PropertyChanges { target: contentLayout; Layout.preferredHeight: 0 }
136+
}
137+
]
138+
139+
transitions: [
140+
Transition {
141+
SequentialAnimation {
142+
PropertyAnimation {
143+
target: contentLayout
144+
property: "Layout.preferredHeight"
145+
duration: 300
146+
easing.type: Easing.InOutQuad
147+
}
148+
}
149+
}
150+
]
151+
152+
ColumnLayout {
153+
id: innerContentLayout
154+
Layout.leftMargin: 30
155+
ChatTextItem {
156+
id: innerTextItem
157+
}
158+
}
159+
}
160+
}

0 commit comments

Comments
 (0)