docs: update README to include support for Gemini multimodal output and add relevant images

fix: ensure nil check for content text in token counting function
This commit is contained in:
Laisky.Cai 2025-03-17 03:37:06 +00:00
parent 000f092023
commit 4d9a4f5c85
2 changed files with 14 additions and 1 deletions

View File

@ -36,6 +36,7 @@ Also welcome to register and use my deployed one-api gateway, which supports var
- [Reasoning Format - thinking](#reasoning-format---thinking) - [Reasoning Format - thinking](#reasoning-format---thinking)
- [Support AWS cross-region inferences](#support-aws-cross-region-inferences) - [Support AWS cross-region inferences](#support-aws-cross-region-inferences)
- [Support OpenAI web search models](#support-openai-web-search-models) - [Support OpenAI web search models](#support-openai-web-search-models)
- [Support gemini multimodal output #2197](#support-gemini-multimodal-output-2197)
- [Bug fix](#bug-fix) - [Bug fix](#bug-fix)
## Turtorial ## Turtorial
@ -223,6 +224,16 @@ Supports two URL parameters: `thinking` and `reasoning_format`.
support `gpt-4o-search-preview` & `gpt-4o-mini-search-preview` support `gpt-4o-search-preview` & `gpt-4o-mini-search-preview`
![](https://s3.laisky.com/uploads/2025/03/openai-websearch-models-1.png)
![](https://s3.laisky.com/uploads/2025/03/openai-websearch-models-2.png)
### Support gemini multimodal output #2197
- [feature: support gemini multimodal output #2197](https://github.com/songquanpeng/one-api/pull/2197)
![](https://s3.laisky.com/uploads/2025/03/gemini-multimodal.png)
## Bug fix ## Bug fix
- [BUGFIX: Several issues when updating tokens #1933](https://github.com/songquanpeng/one-api/pull/1933) - [BUGFIX: Several issues when updating tokens #1933](https://github.com/songquanpeng/one-api/pull/1933)

View File

@ -103,7 +103,9 @@ func CountTokenMessages(ctx context.Context,
for _, content := range contents { for _, content := range contents {
switch content.Type { switch content.Type {
case model.ContentTypeText: case model.ContentTypeText:
tokenNum += getTokenNum(tokenEncoder, content.Text) if content.Text != nil {
tokenNum += getTokenNum(tokenEncoder, *content.Text)
}
case model.ContentTypeImageURL: case model.ContentTypeImageURL:
imageTokens, err := countImageTokens( imageTokens, err := countImageTokens(
content.ImageURL.Url, content.ImageURL.Url,