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
8fa3f366
Commit
8fa3f366
authored
Oct 17, 2023
by
Arne Müller
Browse files
Removed newline trimming and used buffer directly in POST request.
parent
ee94693b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
llm/llama.go
llm/llama.go
+3
-6
No files found.
llm/llama.go
View file @
8fa3f366
...
...
@@ -545,18 +545,15 @@ func (llm *llama) Predict(ctx context.Context, prevContext []int, prompt string,
}
// Handling JSON marshaling with special characters unescaped.
buf
:=
&
bytes
.
Buffer
{}
enc
:=
json
.
NewEncoder
(
buf
)
buf
fer
:=
&
bytes
.
Buffer
{}
enc
:=
json
.
NewEncoder
(
buf
fer
)
enc
.
SetEscapeHTML
(
false
)
if
err
:=
enc
.
Encode
(
predReq
);
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to marshal data: %v"
,
err
)
}
// Remove trailing newline added by Encode.
data
:=
buf
.
Bytes
()[
:
buf
.
Len
()
-
1
]
req
,
err
:=
http
.
NewRequestWithContext
(
ctx
,
http
.
MethodPost
,
endpoint
,
bytes
.
NewBuffer
(
data
))
req
,
err
:=
http
.
NewRequestWithContext
(
ctx
,
http
.
MethodPost
,
endpoint
,
buffer
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error creating POST request: %v"
,
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