fix: 增加魔搭社区嵌入模型所需的EncodingFormat参数
This commit is contained in:
@@ -30,7 +30,8 @@ type OpenAIEmbedder struct {
|
|||||||
type OpenAIEmbedRequest struct {
|
type OpenAIEmbedRequest struct {
|
||||||
Model string `json:"model"`
|
Model string `json:"model"`
|
||||||
Input []string `json:"input"`
|
Input []string `json:"input"`
|
||||||
TruncatePromptTokens int `json:"truncate_prompt_tokens"`
|
EncodingFormat string `json:"encoding_format,omitempty"`
|
||||||
|
TruncatePromptTokens int `json:"truncate_prompt_tokens,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// OpenAIEmbedResponse represents an OpenAI embedding response
|
// OpenAIEmbedResponse represents an OpenAI embedding response
|
||||||
@@ -138,6 +139,7 @@ func (e *OpenAIEmbedder) BatchEmbed(ctx context.Context, texts []string) ([][]fl
|
|||||||
reqBody := OpenAIEmbedRequest{
|
reqBody := OpenAIEmbedRequest{
|
||||||
Model: e.modelName,
|
Model: e.modelName,
|
||||||
Input: texts,
|
Input: texts,
|
||||||
|
EncodingFormat: "float",
|
||||||
TruncatePromptTokens: e.truncatePromptTokens,
|
TruncatePromptTokens: e.truncatePromptTokens,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user