mirror of
https://github.com/nomic-ai/gpt4all
synced 2024-11-08 07:10:32 +00:00
More conservative default params and trim leading whitespace from response.
This commit is contained in:
parent
7215b9f3fb
commit
f8b962d50a
10
llm.cpp
10
llm.cpp
@ -80,9 +80,17 @@ void LLMObject::resetContext()
|
|||||||
s_ctx = LLModel::PromptContext();
|
s_ctx = LLModel::PromptContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string remove_leading_whitespace(const std::string& input) {
|
||||||
|
auto first_non_whitespace = std::find_if(input.begin(), input.end(), [](unsigned char c) {
|
||||||
|
return !std::isspace(c) || c == '\n';
|
||||||
|
});
|
||||||
|
|
||||||
|
return std::string(first_non_whitespace, input.end());
|
||||||
|
}
|
||||||
|
|
||||||
QString LLMObject::response() const
|
QString LLMObject::response() const
|
||||||
{
|
{
|
||||||
return QString::fromStdString(m_response);
|
return QString::fromStdString(remove_leading_whitespace(m_response));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LLMObject::modelName() const
|
QString LLMObject::modelName() const
|
||||||
|
27
main.qml
27
main.qml
@ -54,11 +54,11 @@ Window {
|
|||||||
title: qsTr("Settings")
|
title: qsTr("Settings")
|
||||||
height: 600
|
height: 600
|
||||||
width: 600
|
width: 600
|
||||||
property real temperature: 0.9
|
property real defaultTemperature: 0.7
|
||||||
property real topP: 0.9
|
property real defaultTopP: 0.95
|
||||||
property int topK: 40
|
property int defaultTopK: 40
|
||||||
property int maxLength: 4096
|
property int defaultMaxLength: 4096
|
||||||
property int promptBatchSize: 9
|
property int defaultPromptBatchSize: 9
|
||||||
|
|
||||||
property string defaultPromptTemplate: "The prompt below is a question to answer, a task to complete, or a conversation to respond to; decide which and write an appropriate response.
|
property string defaultPromptTemplate: "The prompt below is a question to answer, a task to complete, or a conversation to respond to; decide which and write an appropriate response.
|
||||||
### Prompt:
|
### Prompt:
|
||||||
@ -66,18 +66,23 @@ Window {
|
|||||||
### Response:\n"
|
### Response:\n"
|
||||||
|
|
||||||
property string promptTemplate: ""
|
property string promptTemplate: ""
|
||||||
|
property real temperature: 0.0
|
||||||
|
property real topP: 0.0
|
||||||
|
property int topK: 0
|
||||||
|
property int maxLength: 0
|
||||||
|
property int promptBatchSize: 0
|
||||||
|
|
||||||
function restoreDefaults() {
|
function restoreDefaults() {
|
||||||
temperature = 0.9;
|
temperature = defaultTemperature;
|
||||||
topP = 0.9;
|
topP = defaultTopP;
|
||||||
topK = 40;
|
topK = defaultTopK;
|
||||||
maxLength = 4096;
|
maxLength = defaultMaxLength;
|
||||||
promptBatchSize = 9;
|
promptBatchSize = defaultPromptBatchSize;
|
||||||
promptTemplate = defaultPromptTemplate;
|
promptTemplate = defaultPromptTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
promptTemplate = defaultPromptTemplate;
|
restoreDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
GridLayout {
|
GridLayout {
|
||||||
|
Loading…
Reference in New Issue
Block a user