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
f5e2e150
Commit
f5e2e150
authored
Jul 10, 2023
by
Bruce MacDonald
Browse files
allow overriding default generate options
parent
268e362f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
api/types.go
api/types.go
+2
-2
server/routes.go
server/routes.go
+7
-2
No files found.
api/types.go
View file @
f5e2e150
...
...
@@ -33,8 +33,8 @@ type GenerateRequest struct {
Model
string
`json:"model"`
Prompt
string
`json:"prompt"`
ModelOptions
`json:"model_opts,omitempty"`
PredictOptions
`json:"predict_opts,omitempty"`
ModelOptions
*
ModelOptions
`json:"model_opts,omitempty"`
PredictOptions
*
PredictOptions
`json:"predict_opts,omitempty"`
}
type
ModelOptions
struct
{
...
...
server/routes.go
View file @
f5e2e150
...
...
@@ -38,8 +38,13 @@ func cacheDir() string {
func
generate
(
c
*
gin
.
Context
)
{
var
req
api
.
GenerateRequest
req
.
ModelOptions
=
api
.
DefaultModelOptions
req
.
PredictOptions
=
api
.
DefaultPredictOptions
if
req
.
ModelOptions
==
nil
{
req
.
ModelOptions
=
&
api
.
DefaultModelOptions
}
if
req
.
PredictOptions
==
nil
{
req
.
PredictOptions
=
&
api
.
DefaultPredictOptions
}
if
err
:=
c
.
ShouldBindJSON
(
&
req
);
err
!=
nil
{
c
.
JSON
(
http
.
StatusBadRequest
,
gin
.
H
{
"message"
:
err
.
Error
()})
return
...
...
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