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
5fe7ba1b
Unverified
Commit
5fe7ba1b
authored
Oct 20, 2025
by
Jeffrey Morgan
Committed by
GitHub
Oct 20, 2025
Browse files
runner: always truncate embeddings requests (#12714)
parent
d2b63c19
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
2 deletions
+29
-2
integration/embed_test.go
integration/embed_test.go
+13
-0
runner/llamarunner/runner.go
runner/llamarunner/runner.go
+8
-1
runner/ollamarunner/runner.go
runner/ollamarunner/runner.go
+8
-1
No files found.
integration/embed_test.go
View file @
5fe7ba1b
...
@@ -258,6 +258,19 @@ func TestAllMiniLMEmbedTruncate(t *testing.T) {
...
@@ -258,6 +258,19 @@ func TestAllMiniLMEmbedTruncate(t *testing.T) {
}
}
},
},
},
},
{
name
:
"boundary truncation"
,
request
:
api
.
EmbedRequest
{
Model
:
"all-minilm"
,
Input
:
"why is the sky blue? Why is the sky blue? hi there my"
,
Options
:
map
[
string
]
any
{
"num_ctx"
:
16
},
},
check
:
func
(
res
*
api
.
EmbedResponse
,
err
error
)
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
},
},
}
}
for
_
,
req
:=
range
cases
{
for
_
,
req
:=
range
cases
{
...
...
runner/llamarunner/runner.go
View file @
5fe7ba1b
...
@@ -697,7 +697,14 @@ func (s *Server) embeddings(w http.ResponseWriter, r *http.Request) {
...
@@ -697,7 +697,14 @@ func (s *Server) embeddings(w http.ResponseWriter, r *http.Request) {
w
.
Header
()
.
Set
(
"Content-Type"
,
"application/json"
)
w
.
Header
()
.
Set
(
"Content-Type"
,
"application/json"
)
seq
,
err
:=
s
.
NewSequence
(
req
.
Content
,
nil
,
NewSequenceParams
{
embedding
:
true
})
seq
,
err
:=
s
.
NewSequence
(
req
.
Content
,
nil
,
NewSequenceParams
{
embedding
:
true
,
// TODO (jmorganca): this should be provided by the server via the
// request options and truncated here in the runner, instead of relying on
// the server's truncate logic
truncate
:
true
,
})
if
err
!=
nil
{
if
err
!=
nil
{
http
.
Error
(
w
,
fmt
.
Sprintf
(
"Failed to create new sequence: %v"
,
err
),
http
.
StatusInternalServerError
)
http
.
Error
(
w
,
fmt
.
Sprintf
(
"Failed to create new sequence: %v"
,
err
),
http
.
StatusInternalServerError
)
return
return
...
...
runner/ollamarunner/runner.go
View file @
5fe7ba1b
...
@@ -946,7 +946,14 @@ func (s *Server) embeddings(w http.ResponseWriter, r *http.Request) {
...
@@ -946,7 +946,14 @@ func (s *Server) embeddings(w http.ResponseWriter, r *http.Request) {
}
}
w
.
Header
()
.
Set
(
"Content-Type"
,
"application/json"
)
w
.
Header
()
.
Set
(
"Content-Type"
,
"application/json"
)
seq
,
err
:=
s
.
NewSequence
(
req
.
Content
,
nil
,
NewSequenceParams
{
embedding
:
true
})
seq
,
err
:=
s
.
NewSequence
(
req
.
Content
,
nil
,
NewSequenceParams
{
embedding
:
true
,
// TODO (jmorganca): this should be provided by the server via the
// request options and truncated here in the runner, instead of relying on
// the server's truncate logic
truncate
:
true
,
})
if
err
!=
nil
{
if
err
!=
nil
{
http
.
Error
(
w
,
fmt
.
Sprintf
(
"failed to create new sequence: %v"
,
err
),
http
.
StatusInternalServerError
)
http
.
Error
(
w
,
fmt
.
Sprintf
(
"failed to create new sequence: %v"
,
err
),
http
.
StatusInternalServerError
)
return
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