给 vertexai 增加 Gemini 的 embedding 支持

This commit is contained in:
xinghejd 2024-08-27 15:49:30 +08:00 committed by GitHub
parent f9774698e9
commit ac6cf4c841
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 5 deletions

View File

@ -62,10 +62,15 @@ func (a *Adaptor) GetChannelName() string {
func (a *Adaptor) GetRequestURL(meta *meta.Meta) (string, error) { func (a *Adaptor) GetRequestURL(meta *meta.Meta) (string, error) {
suffix := "" suffix := ""
if strings.HasPrefix(meta.ActualModelName, "gemini") { if strings.HasPrefix(meta.ActualModelName, "gemini") {
if meta.IsStream { switch meta.Mode {
suffix = "streamGenerateContent?alt=sse" case relaymode.Embeddings:
} else { suffix = "batchEmbedContents"
suffix = "generateContent" default:
if meta.IsStream {
suffix = "streamGenerateContent?alt=sse"
} else {
suffix = "generateContent"
}
} }
} else { } else {
if meta.IsStream { if meta.IsStream {

View File

@ -15,7 +15,7 @@ import (
) )
var ModelList = []string{ var ModelList = []string{
"gemini-1.5-pro-001", "gemini-1.5-flash-001", "gemini-pro", "gemini-pro-vision", "gemini-1.5-pro-001", "gemini-1.5-flash-001", "gemini-pro", "gemini-pro-vision","text-embedding-004"
} }
type Adaptor struct { type Adaptor struct {