Skip to content

Commit a3350ee

Browse files
committed
feature: support tencent hunyuan embeddings
1 parent ed5b04b commit a3350ee

File tree

1 file changed

+5
-0
lines changed
  • plugins/wasm-go/extensions/ai-proxy/provider

1 file changed

+5
-0
lines changed

plugins/wasm-go/extensions/ai-proxy/provider/hunyuan.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const (
4343
// docs: https://cloud.tencent.com/document/product/1729/111007
4444
hunyuanOpenAiDomain = "api.hunyuan.cloud.tencent.com"
4545
hunyuanOpenAiRequestPath = "/v1/chat/completions"
46+
hunyuanOpenAiEmbeddings = "/v1/embeddings"
4647
)
4748

4849
type hunyuanProviderInitializer struct {
@@ -104,6 +105,7 @@ func (m *hunyuanProviderInitializer) ValidateConfig(config *ProviderConfig) erro
104105
func (m *hunyuanProviderInitializer) DefaultCapabilities() map[string]string {
105106
return map[string]string{
106107
string(ApiNameChatCompletion): hunyuanOpenAiRequestPath,
108+
string(ApiNameEmbeddings): hunyuanOpenAiEmbeddings,
107109
}
108110
}
109111

@@ -435,6 +437,9 @@ func (m *hunyuanProvider) convertChunkFromHunyuanToOpenAI(ctx wrapper.HttpContex
435437
}
436438

437439
func (m *hunyuanProvider) TransformResponseBody(ctx wrapper.HttpContext, apiName ApiName, body []byte, log wrapper.Log) ([]byte, error) {
440+
if m.config.IsOriginal() || m.useOpenAICompatibleAPI() {
441+
return body, nil
442+
}
438443
log.Debugf("#debug nash5# onRespBody's resp is: %s", string(body))
439444
hunyuanResponse := &hunyuanTextGenResponseNonStreaming{}
440445
if err := json.Unmarshal(body, hunyuanResponse); err != nil {

0 commit comments

Comments
 (0)