mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-21 02:56:38 +08:00
doc: Relax safety settings for Gemini
- Fix an error message in getting image bytes from a URL in Gemini. - Remove safety settings from the Gemini OpenAI request and set all harm categories to block only high. - Add a log statement about how many images are sent to Gemini vision.
This commit is contained in:
parent
671fe78e44
commit
16603e2530
@ -121,9 +121,11 @@ func requestOpenAI2Gemini(textRequest GeneralOpenAIRequest) *GeminiChatRequest {
|
|||||||
|
|
||||||
mimeType, data, err := image.GetImageFromUrl(part.ImageURL.Url)
|
mimeType, data, err := image.GetImageFromUrl(part.ImageURL.Url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
common.LogError(context.TODO(),
|
common.LogWarn(context.TODO(),
|
||||||
fmt.Sprintf("get image from url %s got %+v", part.ImageURL.Url, err))
|
fmt.Sprintf("get image from url %s got %+v", part.ImageURL.Url, err))
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
parts = append(parts, GeminiPart{
|
parts = append(parts, GeminiPart{
|
||||||
InlineData: &GeminiInlineData{
|
InlineData: &GeminiInlineData{
|
||||||
MimeType: mimeType,
|
MimeType: mimeType,
|
||||||
@ -132,6 +134,8 @@ func requestOpenAI2Gemini(textRequest GeneralOpenAIRequest) *GeminiChatRequest {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
common.LogInfo(context.TODO(),
|
||||||
|
fmt.Sprintf("send %d images to gemini-pro-vision", len(parts)))
|
||||||
content.Parts = parts
|
content.Parts = parts
|
||||||
|
|
||||||
// there's no assistant role in gemini and API shall vomit if Role is not user or model
|
// there's no assistant role in gemini and API shall vomit if Role is not user or model
|
||||||
|
Loading…
Reference in New Issue
Block a user