Abhishek Rawat has uploaded a new patch set (#2). ( 
http://gerrit.cloudera.org:8080/21168 )

Change subject: IMPALA-12920: Support ai_generate_text built-in function for 
OpenAI's chat completion API
......................................................................

IMPALA-12920: Support ai_generate_text built-in function for OpenAI's chat 
completion API

Added support for following built-in functions:
- ai_generate_text(prompt)
- ai_generate_text(ai_endpoint, prompt, ai_model,
  ai_api_key_jceks_secret, additional_params)

'ai_endpoint', 'ai_model' and 'ai_api_key_jceks_secret' are flagfile
options. 'ai_generate_text(prompt)' syntax expects all these to be set
to proper values. The other syntax, will try to use the provided input
parameter values, but fallback to instance level values if the inputs
are NULL or empty.

Only public OpenAI (api.openai.com) and Azure OpenAI (openai.azure.com)
API endpoints are currently supported.

Testing:
- Added unit tests for AiGenerateTextInternal function
- Ran manual tests to make sure Impala can talk with OpenAI LLMs using
'ai_generate_text' built-in function. Example sql:
select ai_generate_text("https://api.openai.com/v1/chat/completions";,
"hello", "gpt-3.5-turbo", "open-ai-key",
'{"temperature": 0.9, "model": "gpt-4"}')

Change-Id: Id4446957f6030bab1f985fdd69185c3da07d7c4b
---
M be/src/exprs/CMakeLists.txt
A be/src/exprs/ai-functions-ir.cc
A be/src/exprs/ai-functions.h
M be/src/exprs/expr-test.cc
M be/src/exprs/scalar-expr-evaluator.cc
M be/src/exprs/string-functions-ir.cc
M be/src/exprs/string-functions.cc
M be/src/runtime/exec-env.cc
M be/src/service/frontend.cc
M be/src/service/frontend.h
M common/function-registry/impala_functions.py
M fe/src/main/java/org/apache/impala/service/JniFrontend.java
12 files changed, 514 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/68/21168/2
--
To view, visit http://gerrit.cloudera.org:8080/21168
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id4446957f6030bab1f985fdd69185c3da07d7c4b
Gerrit-Change-Number: 21168
Gerrit-PatchSet: 2
Gerrit-Owner: Abhishek Rawat <ara...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wydbaggio...@gmail.com>

Reply via email to