linrrzqqq commented on code in PR #62494:
URL: https://github.com/apache/doris/pull/62494#discussion_r3091697493
##########
be/src/exprs/function/ai/ai_adapter.h:
##########
@@ -137,26 +139,70 @@ class AIAdapter {
virtual Status build_embedding_request(const std::vector<std::string>&
inputs,
std::string& request_body) const {
- return Status::NotSupported("{} does not support the Embed feature.",
- _config.provider_type);
+ return embed_not_supported_status();
}
- virtual Status build_multimodal_embedding_request(MultimodalType
/*media_type*/,
- const std::string&
/*media_url*/,
- std::string&
/*request_body*/) const {
+ virtual Status build_multimodal_embedding_request(
+ const std::vector<MultimodalType>& /*media_types*/,
+ const std::vector<std::string>& /*media_urls*/, std::string&
/*request_body*/) const {
return Status::NotSupported("{} does not support multimodal Embed
feature.",
_config.provider_type);
}
virtual Status parse_embedding_response(const std::string& response_body,
std::vector<std::vector<float>>&
results) const {
- return Status::NotSupported("{} does not support the Embed feature.",
- _config.provider_type);
+ return embed_not_supported_status();
}
protected:
TAIResource _config;
+ Status embed_not_supported_status() const {
+ return Status::NotSupported(
+ "{} does not support the Embed feature. Currently supported
providers are "
+ "OpenAI, Gemini, Voyage, Jina, Qwen, and Minimax.",
+ _config.provider_type);
+ }
+
+ // Appends one provider-parsed text result to `results`.
+ // The adapter has already parsed the provider's outer response envelope
before calling here.
+ // Example:
+ // provider response -> choices[0].message.content = "[\"1\",\"0\",\"1\"]"
+ // this helper -> appends "1", "0", "1" into `results`
+ static Status append_parsed_text_result(std::string_view text,
+ std::vector<std::string>& results)
{
Review Comment:
有生命周期问题
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]