You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "Abhishek Rawat (Code Review)" <ge...@cloudera.org> on 2024/06/07 18:50:04 UTC
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Abhishek Rawat has uploaded this change for review. ( http://gerrit.cloudera.org:8080/21493
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Updated the POST request when communicating with Azure Open AI
endpoint. The header now includes 'api-key: <api-key>' instead of
'Authorization: Bearer <api-key>'.
Also, removed 'model' as a required param for the Azure Open AI api
call. This is mainly because the endpoint contains deployment which
is basically already mapped to a model.
Testing:
- Updated existing unit test as per the Azure API reference
- Manually tested builtin 'ai_generate_text' using an Azure Open AI
deployment.
Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
---
M be/src/exprs/ai-functions-ir.cc
M be/src/exprs/ai-functions.h
M be/src/exprs/ai-functions.inline.h
M be/src/exprs/expr-test.cc
4 files changed, 133 insertions(+), 57 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/93/21493/1
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 1
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 8: Verified+1
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 8
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Wed, 12 Jun 2024 22:58:05 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Abhishek Rawat (Code Review)" <ge...@cloudera.org>.
Abhishek Rawat has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 4:
(2 comments)
http://gerrit.cloudera.org:8080/#/c/21493/4/be/src/exprs/ai-functions-ir.cc
File be/src/exprs/ai-functions-ir.cc:
http://gerrit.cloudera.org:8080/#/c/21493/4/be/src/exprs/ai-functions-ir.cc@146
PS4, Line 146: StringVal AiFunctions::AiGenerateText(FunctionContext* ctx, const StringVal& endpoint,
: const StringVal& prompt, const StringVal& model,
: const StringVal& api_key_jceks_secret, const StringVal& params) {
: std::string_view endpoint_sv(FLAGS_ai_endpoint);
: // endpoint validation
: if (endpoint.ptr != nullptr && endpoint.len != 0) {
: endpoint_sv = std::string_view(reinterpret_cast<char*>(endpoint.ptr), endpoint.len);
: // Simple validation for endpoint. It should start with https://
: if (!is_api_endpoint_valid(endpoint_sv)) {
: LOG(ERROR) << "AI Generate Text: \ninvalid protocol: " << endpoint_sv;
: return StringVal(AI_GENERATE_TXT_INVALID_PROTOCOL_ERROR.c_str());
: }
: }
: AI_PLATFORM platform = GetAiPlatformFromEndpoint(endpoint_sv);
: switch(platform) {
: case AI_PLATFORM::OPEN_AI:
: return AiGenerateTextInternal<false, AI_PLATFORM::OPEN_AI>(
: ctx, endpoint_sv, prompt, model, api_key_jceks_secret, params, false);
: case AI_PLATFORM::AZURE_OPEN_AI:
: return AiGenerateTextInternal<false, AI_PLATFORM::AZURE_OPEN_AI>(
: ctx, endpoint_sv, prompt, model, api_key_jceks_secret, params, false);
: default:
: LOG(ERROR) << "AI Generate Text: \nunsupported endpoint: " << endpoint_sv;
: return StringVal(AI_GENERATE_TXT_UNSUPPORTED_ENDPOINT_ERROR.c_str());
: }
: }
:
: StringVal AiFunctions::AiGenerateTextDefault(
: FunctionContext* ctx, const StringVal& prompt) {
: AI_PLATFORM platform = GetAiPlatformFromEndpoint(FLAGS_ai_endpoint);
: switch(platform) {
: case AI_PLATFORM::OPEN_AI:
: return AiGenerateTextInternal<true, AI_PLATFORM::OPEN_AI>(ctx, FLAGS_ai_endpoint,
: prompt, NULL_STRINGVAL, NULL_STRINGVAL, NULL_STRINGVAL, false);
: case AI_PLATFORM::AZURE_OPEN_AI:
: return AiGenerateTextInternal<true, AI_PLATFORM::AZURE_OPEN_AI>(ctx,
: FLAGS_ai_endpoint, prompt, NULL_STRINGVAL, NULL_STRINGVAL, NULL_STRINGVAL,
: false);
: default:
: DCHECK(false) << "Default endpoint " << FLAGS_ai_endpoint << "must be supported";
: LOG(ERROR) << "AI Generate Text: \nunsupported endpoint: " << FLAGS_ai_endpoint;
: return StringVal(AI_GENERATE_TXT_UNSUPPORTED_ENDPOINT_ERROR.c_str());
: }
: }
> Can we remove the duplicated code by using a new function, such as HandleAi
We can't. Note that there is template specialization and so you can't move this into a common code block:
```
StringVal AiFunctions::AiGenerateText(.....)
.......
AI_PLATFORM platform = GetAiPlatformFromEndpoint(endpoint_sv);
switch(platform) {
case AI_PLATFORM::OPEN_AI:
return AiGenerateTextInternal<false, AI_PLATFORM::OPEN_AI>(......);
case AI_PLATFORM::AZURE_OPEN_AI:
return AiGenerateTextInternal<false, AI_PLATFORM::AZURE_OPEN_AI>(.....);
default:
.......
}
```
```
StringVal AiFunctions::AiGenerateTextDefault(....)
...
AI_PLATFORM platform = GetAiPlatformFromEndpoint(FLAGS_ai_endpoint);
switch(platform) {
case AI_PLATFORM::OPEN_AI:
return AiGenerateTextInternal<true, AI_PLATFORM::OPEN_AI>(.....);
case AI_PLATFORM::AZURE_OPEN_AI:
return AiGenerateTextInternal<true, AI_PLATFORM::AZURE_OPEN_AI>(.....);
default:
.........
}
```
http://gerrit.cloudera.org:8080/#/c/21493/4/be/src/exprs/ai-functions.inline.h
File be/src/exprs/ai-functions.inline.h:
http://gerrit.cloudera.org:8080/#/c/21493/4/be/src/exprs/ai-functions.inline.h@79
PS4, Line 79: Status status = getAuthorizationHeader<platform>(authHeader, ai_api_key_);
: if (!status.ok()) return copyErrorMessage(ctx, status.msg().msg());
> Is it okay if we pass the function pointer?
I think I had a missing parenthesis somewhere so the original macro seems to work now.
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 4
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Tue, 11 Jun 2024 20:28:39 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Yida Wu (Code Review)" <ge...@cloudera.org>.
Yida Wu has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 7: Code-Review+2
Carry +1 from Wenzhe. Thanks Abhishek for fixing this.
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 7
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Wed, 12 Jun 2024 17:48:58 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 3:
Build Successful
https://jenkins.impala.io/job/gerrit-code-review-checks/16304/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 3
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Sat, 08 Jun 2024 23:06:23 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Wenzhe Zhou (Code Review)" <ge...@cloudera.org>.
Wenzhe Zhou has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 7: Code-Review+1
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 7
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Wed, 12 Jun 2024 17:41:46 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Abhishek Rawat (Code Review)" <ge...@cloudera.org>.
Abhishek Rawat has uploaded a new patch set (#4). ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Updated the POST request when communicating with Azure Open AI
endpoint. The header now includes 'api-key: <api-key>' instead of
'Authorization: Bearer <api-key>'.
Also, removed 'model' as a required param for the Azure Open AI api
call. This is mainly because the endpoint contains deployment which
is basically already mapped to a model.
Testing:
- Updated existing unit test as per the Azure API reference
- Manually tested builtin 'ai_generate_text' using an Azure Open AI
deployment.
Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
---
M be/src/exprs/ai-functions-ir.cc
M be/src/exprs/ai-functions.h
M be/src/exprs/ai-functions.inline.h
M be/src/exprs/expr-test.cc
4 files changed, 154 insertions(+), 67 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/93/21493/4
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 4
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Yida Wu (Code Review)" <ge...@cloudera.org>.
Yida Wu has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 7: Code-Review+1
(1 comment)
http://gerrit.cloudera.org:8080/#/c/21493/6/be/src/exprs/expr-test.cc
File be/src/exprs/expr-test.cc:
http://gerrit.cloudera.org:8080/#/c/21493/6/be/src/exprs/expr-test.cc@11257
PS6, Line 11257: /completions?a
> I added some negative tests for AiGenerateTextDefault(ctx, prompt). The uni
Done
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 7
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Wed, 12 Jun 2024 14:48:47 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 7:
Build Successful
https://jenkins.impala.io/job/gerrit-code-review-checks/16318/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 7
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Wed, 12 Jun 2024 04:26:50 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Yida Wu (Code Review)" <ge...@cloudera.org>.
Yida Wu has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 4: Code-Review+1
(1 comment)
Thanks Abhishek. It looks good to me.
http://gerrit.cloudera.org:8080/#/c/21493/4/be/src/exprs/ai-functions.inline.h
File be/src/exprs/ai-functions.inline.h:
http://gerrit.cloudera.org:8080/#/c/21493/4/be/src/exprs/ai-functions.inline.h@79
PS4, Line 79: Status status = getAuthorizationHeader<platform>(authHeader, ai_api_key_);
: if (!status.ok()) return copyErrorMessage(ctx, status.msg().msg());
nit. can we use a macro to simplify error handling in this case? If not, the current approach is also good to me.
#define RETURN_STRINGVAL_IF_ERROR(ctx, stmt) \
do { \
const ::impala::Status& _status = (stmt); \
if (UNLIKELY(!_status.ok())) \
return copyErrorMessage(ctx, _status.msg().msg()); \
} while (false)
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 4
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Mon, 10 Jun 2024 16:05:36 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Abhishek Rawat (Code Review)" <ge...@cloudera.org>.
Abhishek Rawat has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 3:
(2 comments)
http://gerrit.cloudera.org:8080/#/c/21493/3/be/src/exprs/ai-functions.inline.h
File be/src/exprs/ai-functions.inline.h:
http://gerrit.cloudera.org:8080/#/c/21493/3/be/src/exprs/ai-functions.inline.h@75
PS3, Line 75: getAuthorizationHeader
> If it is an unsupported platform, would it be better to throw an error and
It's not possible to get 'UnSupported Platform' in getAuthorizationHeader() because we check for platform in the caller function and return error for unsupported platform. Added a Status check and error handling in case this assumption ever changes.
http://gerrit.cloudera.org:8080/#/c/21493/3/be/src/exprs/ai-functions.inline.h@75
PS3, Line 75: getAuthorizationHeader<platform>() + api_key
> Also would it be better to combine the api_key as a parameter to getAuthori
Done
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 3
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Mon, 10 Jun 2024 14:37:26 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Updated the POST request when communicating with Azure Open AI
endpoint. The header now includes 'api-key: <api-key>' instead of
'Authorization: Bearer <api-key>'.
Also, removed 'model' as a required param for the Azure Open AI api
call. This is mainly because the endpoint contains deployment which
is basically already mapped to a model.
Testing:
- Updated existing unit test as per the Azure API reference
- Manually tested builtin 'ai_generate_text' using an Azure Open AI
deployment.
Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Reviewed-on: http://gerrit.cloudera.org:8080/21493
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
M be/src/exprs/ai-functions-ir.cc
M be/src/exprs/ai-functions.h
M be/src/exprs/ai-functions.inline.h
M be/src/exprs/expr-test.cc
4 files changed, 184 insertions(+), 69 deletions(-)
Approvals:
Impala Public Jenkins: Looks good to me, approved; Verified
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 9
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Yida Wu (Code Review)" <ge...@cloudera.org>.
Yida Wu has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 4:
(1 comment)
http://gerrit.cloudera.org:8080/#/c/21493/4/be/src/exprs/ai-functions-ir.cc
File be/src/exprs/ai-functions-ir.cc:
http://gerrit.cloudera.org:8080/#/c/21493/4/be/src/exprs/ai-functions-ir.cc@146
PS4, Line 146: StringVal AiFunctions::AiGenerateText(FunctionContext* ctx, const StringVal& endpoint,
: const StringVal& prompt, const StringVal& model,
: const StringVal& api_key_jceks_secret, const StringVal& params) {
: std::string_view endpoint_sv(FLAGS_ai_endpoint);
: // endpoint validation
: if (endpoint.ptr != nullptr && endpoint.len != 0) {
: endpoint_sv = std::string_view(reinterpret_cast<char*>(endpoint.ptr), endpoint.len);
: // Simple validation for endpoint. It should start with https://
: if (!is_api_endpoint_valid(endpoint_sv)) {
: LOG(ERROR) << "AI Generate Text: \ninvalid protocol: " << endpoint_sv;
: return StringVal(AI_GENERATE_TXT_INVALID_PROTOCOL_ERROR.c_str());
: }
: }
: AI_PLATFORM platform = GetAiPlatformFromEndpoint(endpoint_sv);
: switch(platform) {
: case AI_PLATFORM::OPEN_AI:
: return AiGenerateTextInternal<false, AI_PLATFORM::OPEN_AI>(
: ctx, endpoint_sv, prompt, model, api_key_jceks_secret, params, false);
: case AI_PLATFORM::AZURE_OPEN_AI:
: return AiGenerateTextInternal<false, AI_PLATFORM::AZURE_OPEN_AI>(
: ctx, endpoint_sv, prompt, model, api_key_jceks_secret, params, false);
: default:
: LOG(ERROR) << "AI Generate Text: \nunsupported endpoint: " << endpoint_sv;
: return StringVal(AI_GENERATE_TXT_UNSUPPORTED_ENDPOINT_ERROR.c_str());
: }
: }
:
: StringVal AiFunctions::AiGenerateTextDefault(
: FunctionContext* ctx, const StringVal& prompt) {
: AI_PLATFORM platform = GetAiPlatformFromEndpoint(FLAGS_ai_endpoint);
: switch(platform) {
: case AI_PLATFORM::OPEN_AI:
: return AiGenerateTextInternal<true, AI_PLATFORM::OPEN_AI>(ctx, FLAGS_ai_endpoint,
: prompt, NULL_STRINGVAL, NULL_STRINGVAL, NULL_STRINGVAL, false);
: case AI_PLATFORM::AZURE_OPEN_AI:
: return AiGenerateTextInternal<true, AI_PLATFORM::AZURE_OPEN_AI>(ctx,
: FLAGS_ai_endpoint, prompt, NULL_STRINGVAL, NULL_STRINGVAL, NULL_STRINGVAL,
: false);
: default:
: DCHECK(false) << "Default endpoint " << FLAGS_ai_endpoint << "must be supported";
: LOG(ERROR) << "AI Generate Text: \nunsupported endpoint: " << FLAGS_ai_endpoint;
: return StringVal(AI_GENERATE_TXT_UNSUPPORTED_ENDPOINT_ERROR.c_str());
: }
: }
Can we remove the duplicated code by using a new function, such as HandleAiGenerateText()?
StringVal AiFunctions::HandleAiGenerateText(FunctionContext* ctx,
const StringVal& endpoint, const StringVal& prompt, const StringVal& model,
const StringVal& api_key_jceks_secret, const StringVal& params) {
std::string_view endpoint_sv(FLAGS_ai_endpoint);
if (endpoint.ptr != nullptr && endpoint.len != 0) {
endpoint_sv = std::string_view(reinterpret_cast<char*>(endpoint.ptr), endpoint.len);
if (!is_api_endpoint_valid(endpoint_sv)) {
LOG(ERROR) << "AI Generate Text: \ninvalid protocol: " << endpoint_sv;
return StringVal(AI_GENERATE_TXT_INVALID_PROTOCOL_ERROR.c_str());
}
}
AI_PLATFORM platform = GetAiPlatformFromEndpoint(endpoint_sv);
switch (platform) {
case AI_PLATFORM::OPEN_AI:
return AiGenerateTextInternal<false, AI_PLATFORM::OPEN_AI>(
ctx, endpoint_sv, prompt, model, api_key_jceks_secret, params, false);
case AI_PLATFORM::AZURE_OPEN_AI:
return AiGenerateTextInternal<false, AI_PLATFORM::AZURE_OPEN_AI>(
ctx, endpoint_sv, prompt, model, api_key_jceks_secret, params, false);
default:
LOG(ERROR) << "AI Generate Text: \nunsupported endpoint: " << endpoint_sv;
return StringVal(AI_GENERATE_TXT_UNSUPPORTED_ENDPOINT_ERROR.c_str());
}
}
StringVal AiFunctions::AiGenerateText(FunctionContext* ctx, const StringVal& endpoint,
const StringVal& prompt, const StringVal& model,
const StringVal& api_key_jceks_secret, const StringVal& params) {
return HandleAiGenerateText(ctx, endpoint, prompt, model, api_key_jceks_secret, params);
}
StringVal AiFunctions::AiGenerateTextDefault(
FunctionContext* ctx, const StringVal& prompt) {
return HandleAiGenerateText(
ctx, StringVal(), prompt, NULL_STRINGVAL, NULL_STRINGVAL, NULL_STRINGVAL);
}
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 4
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Tue, 11 Jun 2024 16:34:43 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 8:
Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/10708/ DRY_RUN=false
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 8
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Wed, 12 Jun 2024 17:51:02 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Abhishek Rawat (Code Review)" <ge...@cloudera.org>.
Abhishek Rawat has uploaded a new patch set (#5). ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Updated the POST request when communicating with Azure Open AI
endpoint. The header now includes 'api-key: <api-key>' instead of
'Authorization: Bearer <api-key>'.
Also, removed 'model' as a required param for the Azure Open AI api
call. This is mainly because the endpoint contains deployment which
is basically already mapped to a model.
Testing:
- Updated existing unit test as per the Azure API reference
- Manually tested builtin 'ai_generate_text' using an Azure Open AI
deployment.
Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
---
M be/src/exprs/ai-functions-ir.cc
M be/src/exprs/ai-functions.h
M be/src/exprs/ai-functions.inline.h
M be/src/exprs/expr-test.cc
4 files changed, 164 insertions(+), 69 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/93/21493/5
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 5
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Yida Wu (Code Review)" <ge...@cloudera.org>.
Yida Wu has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 3:
(2 comments)
http://gerrit.cloudera.org:8080/#/c/21493/3/be/src/exprs/ai-functions.inline.h
File be/src/exprs/ai-functions.inline.h:
http://gerrit.cloudera.org:8080/#/c/21493/3/be/src/exprs/ai-functions.inline.h@75
PS3, Line 75: getAuthorizationHeader
If it is an unsupported platform, would it be better to throw an error and return earlier here instead of putting "Unsupported Platform" to the header? How about returning an empty string or null if not supported in getAuthorizationHeader(), so that the caller would take less cost to validate it, or maybe using a Status and a string pointer as the return from getAuthorizationHeader()?
http://gerrit.cloudera.org:8080/#/c/21493/3/be/src/exprs/ai-functions.inline.h@75
PS3, Line 75: getAuthorizationHeader<platform>() + api_key
Also would it be better to combine the api_key as a parameter to getAuthorizationHeader()? It seems more readable.
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 3
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Sun, 09 Jun 2024 02:55:27 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Abhishek Rawat (Code Review)" <ge...@cloudera.org>.
Abhishek Rawat has uploaded a new patch set (#7). ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Updated the POST request when communicating with Azure Open AI
endpoint. The header now includes 'api-key: <api-key>' instead of
'Authorization: Bearer <api-key>'.
Also, removed 'model' as a required param for the Azure Open AI api
call. This is mainly because the endpoint contains deployment which
is basically already mapped to a model.
Testing:
- Updated existing unit test as per the Azure API reference
- Manually tested builtin 'ai_generate_text' using an Azure Open AI
deployment.
Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
---
M be/src/exprs/ai-functions-ir.cc
M be/src/exprs/ai-functions.h
M be/src/exprs/ai-functions.inline.h
M be/src/exprs/expr-test.cc
4 files changed, 184 insertions(+), 69 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/93/21493/7
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 7
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Abhishek Rawat (Code Review)" <ge...@cloudera.org>.
Abhishek Rawat has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 4:
(1 comment)
http://gerrit.cloudera.org:8080/#/c/21493/4/be/src/exprs/ai-functions-ir.cc
File be/src/exprs/ai-functions-ir.cc:
http://gerrit.cloudera.org:8080/#/c/21493/4/be/src/exprs/ai-functions-ir.cc@146
PS4, Line 146: StringVal AiFunctions::AiGenerateText(FunctionContext* ctx, const StringVal& endpoint,
: const StringVal& prompt, const StringVal& model,
: const StringVal& api_key_jceks_secret, const StringVal& params) {
: std::string_view endpoint_sv(FLAGS_ai_endpoint);
: // endpoint validation
: if (endpoint.ptr != nullptr && endpoint.len != 0) {
: endpoint_sv = std::string_view(reinterpret_cast<char*>(endpoint.ptr), endpoint.len);
: // Simple validation for endpoint. It should start with https://
: if (!is_api_endpoint_valid(endpoint_sv)) {
: LOG(ERROR) << "AI Generate Text: \ninvalid protocol: " << endpoint_sv;
: return StringVal(AI_GENERATE_TXT_INVALID_PROTOCOL_ERROR.c_str());
: }
: }
: AI_PLATFORM platform = GetAiPlatformFromEndpoint(endpoint_sv);
: switch(platform) {
: case AI_PLATFORM::OPEN_AI:
: return AiGenerateTextInternal<false, AI_PLATFORM::OPEN_AI>(
: ctx, endpoint_sv, prompt, model, api_key_jceks_secret, params, false);
: case AI_PLATFORM::AZURE_OPEN_AI:
: return AiGenerateTextInternal<false, AI_PLATFORM::AZURE_OPEN_AI>(
: ctx, endpoint_sv, prompt, model, api_key_jceks_secret, params, false);
: default:
: LOG(ERROR) << "AI Generate Text: \nunsupported endpoint: " << endpoint_sv;
: return StringVal(AI_GENERATE_TXT_UNSUPPORTED_ENDPOINT_ERROR.c_str());
: }
: }
:
: StringVal AiFunctions::AiGenerateTextDefault(
: FunctionContext* ctx, const StringVal& prompt) {
: AI_PLATFORM platform = GetAiPlatformFromEndpoint(FLAGS_ai_endpoint);
: switch(platform) {
: case AI_PLATFORM::OPEN_AI:
: return AiGenerateTextInternal<true, AI_PLATFORM::OPEN_AI>(ctx, FLAGS_ai_endpoint,
: prompt, NULL_STRINGVAL, NULL_STRINGVAL, NULL_STRINGVAL, false);
: case AI_PLATFORM::AZURE_OPEN_AI:
: return AiGenerateTextInternal<true, AI_PLATFORM::AZURE_OPEN_AI>(ctx,
: FLAGS_ai_endpoint, prompt, NULL_STRINGVAL, NULL_STRINGVAL, NULL_STRINGVAL,
: false);
: default:
: DCHECK(false) << "Default endpoint " << FLAGS_ai_endpoint << "must be supported";
: LOG(ERROR) << "AI Generate Text: \nunsupported endpoint: " << FLAGS_ai_endpoint;
: return StringVal(AI_GENERATE_TXT_UNSUPPORTED_ENDPOINT_ERROR.c_str());
: }
: }
> I see. How about using a template for use_fast_path?
Done
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 4
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Tue, 11 Jun 2024 23:43:54 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Abhishek Rawat (Code Review)" <ge...@cloudera.org>.
Abhishek Rawat has uploaded a new patch set (#6). ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Updated the POST request when communicating with Azure Open AI
endpoint. The header now includes 'api-key: <api-key>' instead of
'Authorization: Bearer <api-key>'.
Also, removed 'model' as a required param for the Azure Open AI api
call. This is mainly because the endpoint contains deployment which
is basically already mapped to a model.
Testing:
- Updated existing unit test as per the Azure API reference
- Manually tested builtin 'ai_generate_text' using an Azure Open AI
deployment.
Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
---
M be/src/exprs/ai-functions-ir.cc
M be/src/exprs/ai-functions.h
M be/src/exprs/ai-functions.inline.h
M be/src/exprs/expr-test.cc
4 files changed, 170 insertions(+), 69 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/93/21493/6
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 6
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Abhishek Rawat (Code Review)" <ge...@cloudera.org>.
Abhishek Rawat has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 7:
(1 comment)
http://gerrit.cloudera.org:8080/#/c/21493/6/be/src/exprs/expr-test.cc
File be/src/exprs/expr-test.cc:
http://gerrit.cloudera.org:8080/#/c/21493/6/be/src/exprs/expr-test.cc@11257
PS6, Line 11257: /completions?a
> It seems we don't have a testcase for AiFunctions::AiGenerateTextDefault, c
I added some negative tests for AiGenerateTextDefault(ctx, prompt). The unit tests for AiGenerateTextInternal function should provide other coverage.
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 7
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Wed, 12 Jun 2024 04:01:44 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Abhishek Rawat (Code Review)" <ge...@cloudera.org>.
Abhishek Rawat has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 4:
(1 comment)
http://gerrit.cloudera.org:8080/#/c/21493/4/be/src/exprs/ai-functions.inline.h
File be/src/exprs/ai-functions.inline.h:
http://gerrit.cloudera.org:8080/#/c/21493/4/be/src/exprs/ai-functions.inline.h@79
PS4, Line 79: Status status = getAuthorizationHeader<platform>(authHeader, ai_api_key_);
: if (!status.ok()) return copyErrorMessage(ctx, status.msg().msg());
> nit. can we use a macro to simplify error handling in this case? If not, th
It looks like gcc doesn't like passing templatized function as an argument to macros.
I get following errors:
error: unterminated argument list invoking macro "RETURN_STRINGVAL_IF_ERROR"
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 4
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Tue, 11 Jun 2024 16:20:09 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 8: Code-Review+2
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 8
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Wed, 12 Jun 2024 17:51:01 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Wenzhe Zhou (Code Review)" <ge...@cloudera.org>.
Wenzhe Zhou has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 2:
(4 comments)
http://gerrit.cloudera.org:8080/#/c/21493/2/be/src/exprs/ai-functions-ir.cc
File be/src/exprs/ai-functions-ir.cc:
http://gerrit.cloudera.org:8080/#/c/21493/2/be/src/exprs/ai-functions-ir.cc@27
PS2, Line 27: ai_endpoint
rename as default_ai_endpoint
http://gerrit.cloudera.org:8080/#/c/21493/2/be/src/exprs/ai-functions-ir.cc@154
PS2, Line 154: switch(platform) {
: case AI_PLATFORM::OPEN_AI:
: return AiGenerateTextInternal<false, AI_PLATFORM::OPEN_AI>(
: ctx, endpoint_sv, prompt, model, api_key_jceks_secret, params, false);
: case AI_PLATFORM::AZURE_OPEN_AI:
: return AiGenerateTextInternal<false, AI_PLATFORM::AZURE_OPEN_AI>(
: ctx, endpoint_sv, prompt, model, api_key_jceks_secret, params, false);
: default:
simplify as:
if (platform != AI_PLATFORM::UNSUPPORTED) {
return AiGenerateTextInternal<false, platform>(
ctx, endpoint_sv, prompt, model, api_key_jceks_secret, params, false);
} else {
http://gerrit.cloudera.org:8080/#/c/21493/2/be/src/exprs/ai-functions-ir.cc@170
PS2, Line 170: switch(platform) {
same comment as last one
http://gerrit.cloudera.org:8080/#/c/21493/2/be/src/exprs/ai-functions-ir.cc@178
PS2, Line 178: default:
add DCHECK since the default endpoint must be supported.
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 2
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Fri, 07 Jun 2024 21:03:33 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 1:
Build Successful
https://jenkins.impala.io/job/gerrit-code-review-checks/16300/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 1
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Fri, 07 Jun 2024 19:16:14 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 2:
Build Successful
https://jenkins.impala.io/job/gerrit-code-review-checks/16301/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 2
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Fri, 07 Jun 2024 19:27:24 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 6:
Build Successful
https://jenkins.impala.io/job/gerrit-code-review-checks/16317/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 6
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Wed, 12 Jun 2024 00:07:48 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Yida Wu (Code Review)" <ge...@cloudera.org>.
Yida Wu has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 4:
(1 comment)
http://gerrit.cloudera.org:8080/#/c/21493/4/be/src/exprs/ai-functions.inline.h
File be/src/exprs/ai-functions.inline.h:
http://gerrit.cloudera.org:8080/#/c/21493/4/be/src/exprs/ai-functions.inline.h@79
PS4, Line 79: Status status = getAuthorizationHeader<platform>(authHeader, ai_api_key_);
: if (!status.ok()) return copyErrorMessage(ctx, status.msg().msg());
> It looks like gcc doesn't like passing templatized function as an argument
Is it okay if we pass the function pointer?
#define RETURN_STRINGVAL_IF_ERROR(ctx, stmt, errorFunc) \
do { \
const ::impala::Status& _status = (stmt); \
if (UNLIKELY(!_status.ok())) \
return (errorFunc)(ctx, _status.msg().msg()); \
} while (false)
RETURN_STRINGVAL_IF_ERROR(ctx, getAuthorizationHeader<platform>(authHeader, ai_api_key_), copyErrorMessage);
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 4
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Tue, 11 Jun 2024 16:53:00 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Yida Wu (Code Review)" <ge...@cloudera.org>.
Yida Wu has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 5: Code-Review+1
(2 comments)
http://gerrit.cloudera.org:8080/#/c/21493/4/be/src/exprs/ai-functions-ir.cc
File be/src/exprs/ai-functions-ir.cc:
http://gerrit.cloudera.org:8080/#/c/21493/4/be/src/exprs/ai-functions-ir.cc@146
PS4, Line 146: StringVal AiFunctions::AiGenerateText(FunctionContext* ctx, const StringVal& endpoint,
: const StringVal& prompt, const StringVal& model,
: const StringVal& api_key_jceks_secret, const StringVal& params) {
: std::string_view endpoint_sv(FLAGS_ai_endpoint);
: // endpoint validation
: if (endpoint.ptr != nullptr && endpoint.len != 0) {
: endpoint_sv = std::string_view(reinterpret_cast<char*>(endpoint.ptr), endpoint.len);
: // Simple validation for endpoint. It should start with https://
: if (!is_api_endpoint_valid(endpoint_sv)) {
: LOG(ERROR) << "AI Generate Text: \ninvalid protocol: " << endpoint_sv;
: return StringVal(AI_GENERATE_TXT_INVALID_PROTOCOL_ERROR.c_str());
: }
: }
: AI_PLATFORM platform = GetAiPlatformFromEndpoint(endpoint_sv);
: switch(platform) {
: case AI_PLATFORM::OPEN_AI:
: return AiGenerateTextInternal<false, AI_PLATFORM::OPEN_AI>(
: ctx, endpoint_sv, prompt, model, api_key_jceks_secret, params, false);
: case AI_PLATFORM::AZURE_OPEN_AI:
: return AiGenerateTextInternal<false, AI_PLATFORM::AZURE_OPEN_AI>(
: ctx, endpoint_sv, prompt, model, api_key_jceks_secret, params, false);
: default:
: LOG(ERROR) << "AI Generate Text: \nunsupported endpoint: " << endpoint_sv;
: return StringVal(AI_GENERATE_TXT_UNSUPPORTED_ENDPOINT_ERROR.c_str());
: }
: }
:
: StringVal AiFunctions::AiGenerateTextDefault(
: FunctionContext* ctx, const StringVal& prompt) {
: AI_PLATFORM platform = GetAiPlatformFromEndpoint(FLAGS_ai_endpoint);
: switch(platform) {
: case AI_PLATFORM::OPEN_AI:
: return AiGenerateTextInternal<true, AI_PLATFORM::OPEN_AI>(ctx, FLAGS_ai_endpoint,
: prompt, NULL_STRINGVAL, NULL_STRINGVAL, NULL_STRINGVAL, false);
: case AI_PLATFORM::AZURE_OPEN_AI:
: return AiGenerateTextInternal<true, AI_PLATFORM::AZURE_OPEN_AI>(ctx,
: FLAGS_ai_endpoint, prompt, NULL_STRINGVAL, NULL_STRINGVAL, NULL_STRINGVAL,
: false);
: default:
: DCHECK(false) << "Default endpoint " << FLAGS_ai_endpoint << "must be supported";
: LOG(ERROR) << "AI Generate Text: \nunsupported endpoint: " << FLAGS_ai_endpoint;
: return StringVal(AI_GENERATE_TXT_UNSUPPORTED_ENDPOINT_ERROR.c_str());
: }
: }
> We can't. Note that there is template specialization and so you can't move
I see. How about using a template for use_fast_path?
template <bool use_fast_path>
StringVal AiFunctions::HandleAiGenerateText(FunctionContext* ctx,
const StringVal& endpoint, const StringVal& prompt, const StringVal& model,
const StringVal& api_key_jceks_secret, const StringVal& params) {
std::string_view endpoint_sv(FLAGS_ai_endpoint);
if (endpoint.ptr != nullptr && endpoint.len != 0) {
endpoint_sv = std::string_view(reinterpret_cast<char*>(endpoint.ptr), endpoint.len);
if (!is_api_endpoint_valid(endpoint_sv)) {
LOG(ERROR) << "AI Generate Text: \ninvalid protocol: " << endpoint_sv;
return StringVal(AI_GENERATE_TXT_INVALID_PROTOCOL_ERROR.c_str());
}
}
AI_PLATFORM platform = GetAiPlatformFromEndpoint(endpoint_sv);
switch (platform) {
case AI_PLATFORM::OPEN_AI:
return AiGenerateTextInternal<use_fast_path, AI_PLATFORM::OPEN_AI>(
ctx, endpoint_sv, prompt, model, api_key_jceks_secret, params, false);
case AI_PLATFORM::AZURE_OPEN_AI:
return AiGenerateTextInternal<use_fast_path, AI_PLATFORM::AZURE_OPEN_AI>(
ctx, endpoint_sv, prompt, model, api_key_jceks_secret, params, false);
default:
LOG(ERROR) << "AI Generate Text: \nunsupported endpoint: " << endpoint_sv;
if (use_fast_path) {
DCHECK(false) << "Default endpoint " << FLAGS_ai_endpoint << "must be supported";
}
return StringVal(AI_GENERATE_TXT_UNSUPPORTED_ENDPOINT_ERROR.c_str());
}
}
StringVal AiFunctions::AiGenerateText(FunctionContext* ctx, const StringVal& endpoint,
const StringVal& prompt, const StringVal& model,
const StringVal& api_key_jceks_secret, const StringVal& params) {
return HandleAiGenerateText<false>(ctx, endpoint, prompt, model, api_key_jceks_secret, params);
}
StringVal AiFunctions::AiGenerateTextDefault(
FunctionContext* ctx, const StringVal& prompt) {
return HandleAiGenerateText<true>(ctx, StringVal(), prompt, NULL_STRINGVAL, NULL_STRINGVAL, NULL_STRINGVAL);
}
http://gerrit.cloudera.org:8080/#/c/21493/4/be/src/exprs/ai-functions.inline.h
File be/src/exprs/ai-functions.inline.h:
http://gerrit.cloudera.org:8080/#/c/21493/4/be/src/exprs/ai-functions.inline.h@79
PS4, Line 79: string api_key_secret(
: reinterpret_cast<char*>(api_key_jceks_secret.ptr), api_key_jcek
> I think I had a missing parenthesis somewhere so the original macro seems t
That is great, thanks.
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 5
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Tue, 11 Jun 2024 21:49:07 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 5:
Build Successful
https://jenkins.impala.io/job/gerrit-code-review-checks/16316/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 5
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Tue, 11 Jun 2024 20:49:19 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Wenzhe Zhou (Code Review)" <ge...@cloudera.org>.
Wenzhe Zhou has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 3: Code-Review+1
(2 comments)
http://gerrit.cloudera.org:8080/#/c/21493/2/be/src/exprs/ai-functions-ir.cc
File be/src/exprs/ai-functions-ir.cc:
http://gerrit.cloudera.org:8080/#/c/21493/2/be/src/exprs/ai-functions-ir.cc@27
PS2, Line 27: ai_endpoint
> Renaming will be tricky since this is part of 4.4.0. We can clarify this in
ack
http://gerrit.cloudera.org:8080/#/c/21493/2/be/src/exprs/ai-functions-ir.cc@154
PS2, Line 154: switch(platform) {
: case AI_PLATFORM::OPEN_AI:
: return AiGenerateTextInternal<false, AI_PLATFORM::OPEN_AI>(
: ctx, endpoint_sv, prompt, model, api_key_jceks_secret, params, false);
: case AI_PLATFORM::AZURE_OPEN_AI:
: return AiGenerateTextInternal<false, AI_PLATFORM::AZURE_OPEN_AI>(
: ctx, endpoint_sv, prompt, model, api_key_jceks_secret, params, false);
: default:
> This won't work because the template parameter 'platform' must be known at
ack
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 3
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Sat, 08 Jun 2024 23:56:59 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 4:
Build Successful
https://jenkins.impala.io/job/gerrit-code-review-checks/16307/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 4
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Mon, 10 Jun 2024 14:59:42 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Wenzhe Zhou (Code Review)" <ge...@cloudera.org>.
Wenzhe Zhou has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 4: Code-Review+1
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 4
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Mon, 10 Jun 2024 17:08:13 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Abhishek Rawat (Code Review)" <ge...@cloudera.org>.
Abhishek Rawat has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 3:
(3 comments)
http://gerrit.cloudera.org:8080/#/c/21493/2/be/src/exprs/ai-functions-ir.cc
File be/src/exprs/ai-functions-ir.cc:
http://gerrit.cloudera.org:8080/#/c/21493/2/be/src/exprs/ai-functions-ir.cc@27
PS2, Line 27: ai_endpoint
> rename as default_ai_endpoint
Renaming will be tricky since this is part of 4.4.0. We can clarify this in the documentation also?
http://gerrit.cloudera.org:8080/#/c/21493/2/be/src/exprs/ai-functions-ir.cc@154
PS2, Line 154: switch(platform) {
: case AI_PLATFORM::OPEN_AI:
: return AiGenerateTextInternal<false, AI_PLATFORM::OPEN_AI>(
: ctx, endpoint_sv, prompt, model, api_key_jceks_secret, params, false);
: case AI_PLATFORM::AZURE_OPEN_AI:
: return AiGenerateTextInternal<false, AI_PLATFORM::AZURE_OPEN_AI>(
: ctx, endpoint_sv, prompt, model, api_key_jceks_secret, params, false);
: default:
> simplify as:
This won't work because the template parameter 'platform' must be known at compile time and cannot be a variable.
http://gerrit.cloudera.org:8080/#/c/21493/2/be/src/exprs/ai-functions-ir.cc@178
PS2, Line 178: default:
> add DCHECK since the default endpoint must be supported.
Done
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 3
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Sat, 08 Jun 2024 22:42:37 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Abhishek Rawat (Code Review)" <ge...@cloudera.org>.
Abhishek Rawat has uploaded a new patch set (#3). ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Updated the POST request when communicating with Azure Open AI
endpoint. The header now includes 'api-key: <api-key>' instead of
'Authorization: Bearer <api-key>'.
Also, removed 'model' as a required param for the Azure Open AI api
call. This is mainly because the endpoint contains deployment which
is basically already mapped to a model.
Testing:
- Updated existing unit test as per the Azure API reference
- Manually tested builtin 'ai_generate_text' using an Azure Open AI
deployment.
Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
---
M be/src/exprs/ai-functions-ir.cc
M be/src/exprs/ai-functions.h
M be/src/exprs/ai-functions.inline.h
M be/src/exprs/expr-test.cc
4 files changed, 136 insertions(+), 57 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/93/21493/3
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 3
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Abhishek Rawat (Code Review)" <ge...@cloudera.org>.
Abhishek Rawat has uploaded a new patch set (#2). ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Updated the POST request when communicating with Azure Open AI
endpoint. The header now includes 'api-key: <api-key>' instead of
'Authorization: Bearer <api-key>'.
Also, removed 'model' as a required param for the Azure Open AI api
call. This is mainly because the endpoint contains deployment which
is basically already mapped to a model.
Testing:
- Updated existing unit test as per the Azure API reference
- Manually tested builtin 'ai_generate_text' using an Azure Open AI
deployment.
Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
---
M be/src/exprs/ai-functions-ir.cc
M be/src/exprs/ai-functions.h
M be/src/exprs/ai-functions.inline.h
M be/src/exprs/expr-test.cc
4 files changed, 135 insertions(+), 57 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/93/21493/2
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 2
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 1:
(3 comments)
http://gerrit.cloudera.org:8080/#/c/21493/1/be/src/exprs/ai-functions-ir.cc
File be/src/exprs/ai-functions-ir.cc:
http://gerrit.cloudera.org:8080/#/c/21493/1/be/src/exprs/ai-functions-ir.cc@92
PS1, Line 92: AiFunctions::AI_PLATFORM AiFunctions::GetAiPlatformFromEndpoint(const std::string_view& endpoint) {
line too long (99 > 90)
http://gerrit.cloudera.org:8080/#/c/21493/1/be/src/exprs/ai-functions-ir.cc@172
PS1, Line 172: ctx, FLAGS_ai_endpoint, prompt, NULL_STRINGVAL, NULL_STRINGVAL, NULL_STRINGVAL, false);
line too long (97 > 90)
http://gerrit.cloudera.org:8080/#/c/21493/1/be/src/exprs/ai-functions-ir.cc@175
PS1, Line 175: ctx, FLAGS_ai_endpoint, prompt, NULL_STRINGVAL, NULL_STRINGVAL, NULL_STRINGVAL, false);
line too long (97 > 90)
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 1
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Fri, 07 Jun 2024 18:51:28 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
Posted by "Yida Wu (Code Review)" <ge...@cloudera.org>.
Yida Wu has posted comments on this change. ( http://gerrit.cloudera.org:8080/21493 )
Change subject: IMPALA-13131: Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header
......................................................................
Patch Set 6: Code-Review+1
(1 comment)
http://gerrit.cloudera.org:8080/#/c/21493/6/be/src/exprs/expr-test.cc
File be/src/exprs/expr-test.cc:
http://gerrit.cloudera.org:8080/#/c/21493/6/be/src/exprs/expr-test.cc@11257
PS6, Line 11257: AiGenerateText
It seems we don't have a testcase for AiFunctions::AiGenerateTextDefault, can we add one more test using AiFunctions::AiGenerateTextDefault?
--
To view, visit http://gerrit.cloudera.org:8080/21493
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If9cc07940ce355d511bcf0ee615ff31042d13eb5
Gerrit-Change-Number: 21493
Gerrit-PatchSet: 6
Gerrit-Owner: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Abhishek Rawat <ar...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wy...@gmail.com>
Gerrit-Comment-Date: Wed, 12 Jun 2024 00:02:28 +0000
Gerrit-HasComments: Yes