Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
5eb712f9
Commit
5eb712f9
authored
Aug 08, 2023
by
Jeffrey Morgan
Browse files
trim whitespace before checking stop conditions
Fixes #295
parent
931a5f3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
llama/llama.go
llama/llama.go
+2
-2
No files found.
llama/llama.go
View file @
5eb712f9
...
@@ -250,9 +250,9 @@ func (llm *LLM) Predict(ctx []int, prompt string, fn func(api.GenerateResponse))
...
@@ -250,9 +250,9 @@ func (llm *LLM) Predict(ctx []int, prompt string, fn func(api.GenerateResponse))
func
(
llm
*
LLM
)
checkStopConditions
(
b
bytes
.
Buffer
)
error
{
func
(
llm
*
LLM
)
checkStopConditions
(
b
bytes
.
Buffer
)
error
{
for
_
,
stopCondition
:=
range
llm
.
Stop
{
for
_
,
stopCondition
:=
range
llm
.
Stop
{
if
stopCondition
==
b
.
String
()
{
if
stopCondition
==
strings
.
TrimSpace
(
b
.
String
()
)
{
return
io
.
EOF
return
io
.
EOF
}
else
if
strings
.
HasPrefix
(
stopCondition
,
b
.
String
())
{
}
else
if
strings
.
HasPrefix
(
stopCondition
,
strings
.
TrimSpace
(
b
.
String
())
)
{
return
errNeedMoreData
return
errNeedMoreData
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment