Skip to content
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

自定义渠道参数传递不完整 #397

Open
paulcx opened this issue Oct 26, 2024 · 5 comments
Open

自定义渠道参数传递不完整 #397

paulcx opened this issue Oct 26, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@paulcx
Copy link

paulcx commented Oct 26, 2024

例行检查

  • 我已确认目前没有类似 issue
  • 我已确认我已升级到最新版本
  • 我已完整查看过项目 README,尤其是常见问题部分
  • 我理解并愿意跟进此 issue,协助测试和提供反馈
  • 我理解并认可上述内容,并理解项目维护者精力有限,不遵循规则的 issue 可能会被无视或直接关闭

问题描述
自定义渠道或openai渠道,当接口传入参数例如:"temperature": 0.0, "repetition_penalty": 1.2 下游接口接受不到这两个参数?
复现步骤
使用最新的docker
预期结果
向下游传递所有上游请求的参数,如果参数错误向上传递?

@paulcx paulcx added the bug Something isn't working label Oct 26, 2024
MartialBE added a commit that referenced this issue Oct 30, 2024
Some parameter types are changed to pointer types, which can correctly pass values to the provider.

- Update `convertFromChatOpenai` function in `hunyuan/chat.go` to use the actual values for `TopP` and `Temperature` parameters.
- Update `getChatRequestBody` function in `groq/chat.go` to use the actual values for `N` parameter.
- Update `Option` struct in `ollama/type.go` to use the actual values for `TopP` and `Temperature` fields.
- Update `PaLMChatRequest` struct in `palm/type.go` to use the actual values for `TopP` and `Temperature` fields.
- Update `GeminiChatGenerationConfig` struct in `gemini/type.go` to use the actual values for `TopP`, `Temperature`, and `TopK` fields.
- Update `XunfeiParameterChat` struct in `xunfei/type.go` to use the actual values for `Temperature` and `TopK` fields.
- Update `ClaudeRequest` struct in `claude/type.go` to use the actual values for `Temperature`, `TopP`, and `TopK` fields.
- Update `BaichuanChatRequest` struct in `baichuan/type.go` to use the actual values for `Temperature`, `TopP`, and `TopK` fields.
- Update `convertFromChatOpenai` function in `tencent/chat.go` to use the actual values for `Temperature` and `TopP` parameters.
- Update `MiniMaxChatRequest` struct in `minimax/type.go` to use the actual values for `Temperature` and `TopP` fields.
- Update `convertFromChatOpenai` function in `zhipu/chat.go` to use the actual values for `Temperature` and `TopP` parameters.
- Update `BaiduChatRequest` struct in `baidu/type.go` to use the actual values for `Temperature`, `TopP`, and `PenaltyScore` fields.
- Update `MistralChatCompletionRequest` struct in `mistral/type.go` to use the actual values for `Temperature`, `TopP`, and `N` fields.
- Update `CohereRequest` struct in `cohere/type.go` to use the actual values for `Temperature`, `MaxTokens`, `K`, `P`, `Seed`, `FrequencyPenalty`, and `PresencePenalty` fields.
@MartialBE
Copy link
Owner

repetition_penalty 有这个参数么? 应该是presence_penalty吧?
已修复其他参数的问题

@paulcx
Copy link
Author

paulcx commented Oct 30, 2024

repetition_penalty 有这个参数么? 应该是presence_penalty吧? 已修复其他参数的问题

有些推理框架(如vllm)有超出open api reference的参数(repetition_penalty),是否可以在自定义渠道这里直接传上游所有的参数,网关直接传递下游的接口返回异常即可。这样可以比较大的兼容各种类openai的接口?

@MartialBE
Copy link
Owner

后面我再看看怎么处理比较好

@paulcx
Copy link
Author

paulcx commented Oct 31, 2024

后面我再看看怎么处理比较好

另外,#397 中 *float64 是字段只有在有值时才会输出,null 时会被省略吗(我对go不熟悉)?我的建议是,字段null或默认值会随着下游的渠道/推理框架接口的变动而变动。最好是在网关只进行异常捕捉返回,不做严格的限制,要求上游请求的时候自己进行限制和调整。这样后期项目需要不停改动的地方也会比较小。

@MartialBE
Copy link
Owner

是的 指针在没有传入该值时是不会传给供应商的。如果不传,那么就是默认供应商的值了,所以现在的改动是合理的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants