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
2f804068
Unverified
Commit
2f804068
authored
Mar 12, 2024
by
Bruce MacDonald
Committed by
GitHub
Mar 12, 2024
Browse files
warn when json format is expected but not mentioned in prompt (#3081)
parent
34d00f90
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
llm/dyn_ext_server.go
llm/dyn_ext_server.go
+3
-0
No files found.
llm/dyn_ext_server.go
View file @
2f804068
...
@@ -198,6 +198,9 @@ func (llm *dynExtServer) Predict(ctx context.Context, predict PredictOpts, fn fu
...
@@ -198,6 +198,9 @@ func (llm *dynExtServer) Predict(ctx context.Context, predict PredictOpts, fn fu
if
predict
.
Format
==
"json"
{
if
predict
.
Format
==
"json"
{
request
[
"grammar"
]
=
jsonGrammar
request
[
"grammar"
]
=
jsonGrammar
if
!
strings
.
Contains
(
strings
.
ToLower
(
predict
.
Prompt
),
"json"
)
{
slog
.
Warn
(
"Prompt does not specify that the LLM should response in JSON, but JSON format is expected. For best results specify that JSON is expected in the system prompt."
)
}
}
}
retryDelay
:=
100
*
time
.
Microsecond
retryDelay
:=
100
*
time
.
Microsecond
...
...
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