generated from songquanpeng/gin-template
-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
接口 /v1/embeddings 仅支持string,不支持数组 #1291
Labels
bug
Something isn't working
Comments
TimchaStudio
changed the title
接口 v1/embeddings 仅支持JSON object,不支持文件块作为内容输入
接口 /v1/embeddings 仅支持JSON object,不支持文件块作为内容输入
Apr 8, 2024
这个会处理 |
7 tasks
这个问题解决了嘛?我好像同样遇到这个问题 labring/FastGPT#1198 (comment) |
@yorke669 我也遇到同样的问题。 |
TimchaStudio
changed the title
接口 /v1/embeddings 仅支持JSON object,不支持文件块作为内容输入
接口 /v1/embeddings 仅支持JSON object,不支持字符串数组
Apr 19, 2024
TimchaStudio
changed the title
接口 /v1/embeddings 仅支持JSON object,不支持字符串数组
接口 /v1/embeddings 仅支持string,不支持数组
Apr 19, 2024
@songquanpeng 应该不是 OneAPI 的问题。和渠道有关,比如我用 ChatAnywhere 是正常的,但智谱只能字符串,不能字符列表: Ref 智谱文档: https://open.bigmodel.cn/dev/api#text_embedding |
输入的日志如下:
解析代码 func (r GeneralOpenAIRequest) ParseInput() []string {
if r.Input == nil {
return nil
}
var input []string
switch r.Input.(type) {
case string:
input = []string{r.Input.(string)}
case []any:
input = make([]string, 0, len(r.Input.([]any)))
for _, item := range r.Input.([]any) {
if str, ok := item.(string); ok {
input = append(input, str)
}
}
}
return input |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
其中input: chunks.map(chunk => chunk.content) ,chunk 是文件处理后字符串数组。
baseURL 为官方接口 https://api.openai.com/v1 时文件能成功上传并响应
baseURL 为one-api接口https://one-api.com/v1 时,文件上传返回以下错误
似乎接口只支持字符串,不支持数组。
https://platform.openai.com/docs/api-reference/embeddings/create
The text was updated successfully, but these errors were encountered: