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
06d4fba8
Unverified
Commit
06d4fba8
authored
Sep 07, 2024
by
frob
Committed by
GitHub
Sep 07, 2024
Browse files
openai: align chat temperature and frequency_penalty options with completion (#6688)
parent
108fb6c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
openai/openai.go
openai/openai.go
+3
-3
openai/openai_test.go
openai/openai_test.go
+3
-3
No files found.
openai/openai.go
View file @
06d4fba8
...
@@ -452,7 +452,7 @@ func fromChatRequest(r ChatCompletionRequest) (*api.ChatRequest, error) {
...
@@ -452,7 +452,7 @@ func fromChatRequest(r ChatCompletionRequest) (*api.ChatRequest, error) {
}
}
if
r
.
Temperature
!=
nil
{
if
r
.
Temperature
!=
nil
{
options
[
"temperature"
]
=
*
r
.
Temperature
*
2.0
options
[
"temperature"
]
=
*
r
.
Temperature
}
else
{
}
else
{
options
[
"temperature"
]
=
1.0
options
[
"temperature"
]
=
1.0
}
}
...
@@ -462,11 +462,11 @@ func fromChatRequest(r ChatCompletionRequest) (*api.ChatRequest, error) {
...
@@ -462,11 +462,11 @@ func fromChatRequest(r ChatCompletionRequest) (*api.ChatRequest, error) {
}
}
if
r
.
FrequencyPenalty
!=
nil
{
if
r
.
FrequencyPenalty
!=
nil
{
options
[
"frequency_penalty"
]
=
*
r
.
FrequencyPenalty
*
2.0
options
[
"frequency_penalty"
]
=
*
r
.
FrequencyPenalty
}
}
if
r
.
PresencePenalty
!=
nil
{
if
r
.
PresencePenalty
!=
nil
{
options
[
"presence_penalty"
]
=
*
r
.
PresencePenalty
*
2.0
options
[
"presence_penalty"
]
=
*
r
.
PresencePenalty
}
}
if
r
.
TopP
!=
nil
{
if
r
.
TopP
!=
nil
{
...
...
openai/openai_test.go
View file @
06d4fba8
...
@@ -102,9 +102,9 @@ func TestChatMiddleware(t *testing.T) {
...
@@ -102,9 +102,9 @@ func TestChatMiddleware(t *testing.T) {
"num_predict"
:
999.0
,
// float because JSON doesn't distinguish between float and int
"num_predict"
:
999.0
,
// float because JSON doesn't distinguish between float and int
"seed"
:
123.0
,
"seed"
:
123.0
,
"stop"
:
[]
any
{
"
\n
"
,
"stop"
},
"stop"
:
[]
any
{
"
\n
"
,
"stop"
},
"temperature"
:
6
.0
,
"temperature"
:
3
.0
,
"frequency_penalty"
:
8
.0
,
"frequency_penalty"
:
4
.0
,
"presence_penalty"
:
10
.0
,
"presence_penalty"
:
5
.0
,
"top_p"
:
6.0
,
"top_p"
:
6.0
,
},
},
Format
:
"json"
,
Format
:
"json"
,
...
...
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