Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
577daf34
authored
May 21, 2023
by
JustSong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: use gpt-3.5's encoder if not found (close #110)
parent
ea395dd9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
+5
-1
controller/relay-utils.go
+5
-1
No files found.
controller/relay-utils.go
View file @
577daf34
...
@@ -15,7 +15,11 @@ func getTokenEncoder(model string) *tiktoken.Tiktoken {
...
@@ -15,7 +15,11 @@ func getTokenEncoder(model string) *tiktoken.Tiktoken {
}
}
tokenEncoder
,
err
:=
tiktoken
.
EncodingForModel
(
model
)
tokenEncoder
,
err
:=
tiktoken
.
EncodingForModel
(
model
)
if
err
!=
nil
{
if
err
!=
nil
{
common
.
FatalLog
(
fmt
.
Sprintf
(
"failed to get token encoder for model %s: %s"
,
model
,
err
.
Error
()))
common
.
SysError
(
fmt
.
Sprintf
(
"failed to get token encoder for model %s: %s, using encoder for gpt-3.5-turbo"
,
model
,
err
.
Error
()))
tokenEncoder
,
err
=
tiktoken
.
EncodingForModel
(
"gpt-3.5-turbo"
)
if
err
!=
nil
{
common
.
FatalLog
(
fmt
.
Sprintf
(
"failed to get token encoder for model gpt-3.5-turbo: %s"
,
err
.
Error
()))
}
}
}
tokenEncoderMap
[
model
]
=
tokenEncoder
tokenEncoderMap
[
model
]
=
tokenEncoder
return
tokenEncoder
return
tokenEncoder
...
...
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