text.go 490 B

1234567891011121314151617181920
  1. package ali
  2. import (
  3. "github.com/QuantumNous/new-api/dto"
  4. "github.com/samber/lo"
  5. )
  6. // https://help.aliyun.com/document_detail/613695.html?spm=a2c4g.2399480.0.0.1adb778fAdzP9w#341800c0f8w0r
  7. const EnableSearchModelSuffix = "-internet"
  8. func requestOpenAI2Ali(request dto.GeneralOpenAIRequest) *dto.GeneralOpenAIRequest {
  9. topP := lo.FromPtrOr(request.TopP, 0)
  10. if topP >= 1 {
  11. request.TopP = lo.ToPtr(0.999)
  12. } else if topP <= 0 {
  13. request.TopP = lo.ToPtr(0.001)
  14. }
  15. return &request
  16. }