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
1d0ebe67
Unverified
Commit
1d0ebe67
authored
Sep 30, 2023
by
Jay Nakrani
Committed by
GitHub
Sep 29, 2023
Browse files
Document response stream chunk delimiter. (#632)
Document response stream chunk delimiter.
parent
a1b2d95f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
0 deletions
+5
-0
docs/api.md
docs/api.md
+4
-0
server/routes.go
server/routes.go
+1
-0
No files found.
docs/api.md
View file @
1d0ebe67
...
...
@@ -23,6 +23,10 @@ Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` a
All durations are returned in nanoseconds.
### Streaming responses
Certain endpoints stream responses as JSON objects delineated with the newline (
`\n`
) character.
## Generate a completion
```
shell
...
...
server/routes.go
View file @
1d0ebe67
...
...
@@ -610,6 +610,7 @@ func streamResponse(c *gin.Context, ch chan any) {
return
false
}
// Delineate chunks with new-line delimiter
bts
=
append
(
bts
,
'\n'
)
if
_
,
err
:=
w
.
Write
(
bts
);
err
!=
nil
{
log
.
Printf
(
"streamResponse: w.Write failed with %s"
,
err
)
...
...
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