AI_TEXT_COMPLETION
This document provides an overview of the ai_text_completion
function in PlaidCloud Lakehouse and demonstrates how to generate text completions using this function.
The main code implementation can be found here.
Starting from PlaidCloud Lakehouse v1.1.47, PlaidCloud Lakehouse supports the Azure OpenAI service.
This integration offers improved data privacy.
To use Azure OpenAI, add the following configurations to the [query]
section:
# Azure OpenAI
openai_api_chat_base_url = "https://<name>.openai.azure.com/openai/deployments/<name>/"
openai_api_embedding_base_url = "https://<name>.openai.azure.com/openai/deployments/<name>/"
openai_api_version = "2023-03-15-preview"
PlaidCloud Lakehouse relies on (Azure) OpenAI for AI_TEXT_COMPLETION
and sends the completion prompt data to (Azure) OpenAI.
They will only work when the PlaidCloud Lakehouse configuration includes the openai_api_key
, otherwise they will be inactive.
This function is available by default on PlaidCloud Lakehouse using an Azure OpenAI key. If you use them, you acknowledge that your data will be sent to Azure OpenAI by us.
Overview of ai_text_completion
The ai_text_completion
function in PlaidCloud Lakehouse is a built-in function that generates text completions based on a given prompt. It is useful for natural language processing tasks, such as question answering, text generation, and autocompletion systems.
The function takes a text prompt as input and returns a generated completion for the prompt. The completions are created using pre-trained models on large text corpora, capturing the relationships between words and phrases in a continuous space.
Generating text completions using ai_text_completion
Here is a simple example using the ai_text_completion
function in PlaidCloud Lakehouse to generate a text completion:
SELECT ai_text_completion('What is artificial intelligence?') AS completion;
Result:
+--------------------------------------------------------------------------------------------------------------------+
| completion |
+--------------------------------------------------------------------------------------------------------------------+
| Artificial intelligence (AI) is the field of study focused on creating machines and software capable of thinking, learning, and solving problems in a way that mimics human intelligence. This includes areas such as machine learning, natural language processing, computer vision, and robotics. |
+--------------------------------------------------------------------------------------------------------------------+
In this example, we provide the prompt "What is artificial intelligence?" to the ai_text_completion
function, and it returns a generated completion that briefly describes artificial intelligence.