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
63861f58
Unverified
Commit
63861f58
authored
Feb 20, 2024
by
Jeffrey Morgan
Committed by
GitHub
Feb 20, 2024
Browse files
Support for `bert` and `nomic-bert` embedding models
parent
f0425d3d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
server/images.go
server/images.go
+4
-0
server/routes.go
server/routes.go
+10
-0
No files found.
server/images.go
View file @
63861f58
...
...
@@ -52,6 +52,10 @@ type Model struct {
Messages
[]
Message
}
func
(
m
*
Model
)
IsEmbedding
()
bool
{
return
slices
.
Contains
(
m
.
Config
.
ModelFamilies
,
"bert"
)
||
slices
.
Contains
(
m
.
Config
.
ModelFamilies
,
"nomic-bert"
)
}
type
Message
struct
{
Role
string
`json:"role"`
Content
string
`json:"content"`
...
...
server/routes.go
View file @
63861f58
...
...
@@ -191,6 +191,11 @@ func GenerateHandler(c *gin.Context) {
return
}
if
model
.
IsEmbedding
()
{
c
.
AbortWithStatusJSON
(
http
.
StatusBadRequest
,
gin
.
H
{
"error"
:
"model does not support generate"
})
return
}
opts
,
err
:=
modelOptions
(
model
,
req
.
Options
)
if
err
!=
nil
{
if
errors
.
Is
(
err
,
api
.
ErrInvalidOpts
)
{
...
...
@@ -1143,6 +1148,11 @@ func ChatHandler(c *gin.Context) {
return
}
if
model
.
IsEmbedding
()
{
c
.
AbortWithStatusJSON
(
http
.
StatusBadRequest
,
gin
.
H
{
"error"
:
"model does not support chat"
})
return
}
opts
,
err
:=
modelOptions
(
model
,
req
.
Options
)
if
err
!=
nil
{
if
errors
.
Is
(
err
,
api
.
ErrInvalidOpts
)
{
...
...
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