Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Go SDK 添加 Tokenizer 并且支持 ChatCompletionMessages 截断逻辑 #583

Merged
merged 6 commits into from
Jun 13, 2024

Conversation

Dobiichi-Origami
Copy link
Collaborator

Go SDK 添加 Tokenizer 并且支持 ChatCompletionMessages 截断逻辑

"UNSPECIFIED_MODEL": {MaxInputChars: 0, MaxInputTokens: 0},
}

var limitMapInEndpoint = map[string]inputLimitInfo{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是不是只维护到endpoint->model的映射就好了


if (limit.MaxInputTokens > 0 && totalMessageTokens > limit.MaxInputTokens) ||
(limit.MaxInputChars > 0 && totalMessageChars > limit.MaxInputChars) {
return
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

break?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Collaborator

@danielhjz danielhjz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

others LGTM

@danielhjz danielhjz merged commit ceed3e1 into main Jun 13, 2024
10 checks passed
@danielhjz danielhjz deleted the golang_tokenizer branch June 13, 2024 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants