Skip to main content

One post tagged with "OpenAI"

View All Tags

From Siri to ChatGPT, artificial intelligence has taken the world by storm in the past few years like magic. This benefits everyone by changing the way we live and work. We're getting used to giving instructions, in speech or by text, and expecting prompt replies. In one way or another, AI is becoming a loyal assistant or friend who is always offering help and will never turn you down.

Recently we also successfully brought OpenAI into Databend to make the system smarter. Databend is rolling out a series of AI functions based on the latest OpenAI Codex model. This allows you to interact with Databend effortlessly and intelligently.

You can now use your language to communicate with Databend using the function AI_TO SQL.

SELECT * FROM ai_to_sql('<natural-language-instruction>'[, '<openai-api-key>']);

Through this function, instructions written in a natural language can be converted into SQL query statements that align with the table schema. For example, the function can be provided with a sentence like Get all items that cost 10 dollars or less as input and generate the corresponding SQL query SELECT * FROM items WHERE price <= 10 as output.

Instead of having to manually enter your OpenAI API secret key every time you run the function, you can save time by adding it to the configuration file databend-query.toml through the openai_api_key setting. Databend will automatically use that secret key whenever you run the function without explicitly specifying a key as a parameter.

By the way, the function accepts multiple languages. For example, if you speak French, try Obtenez tous les articles qui coûtent 10 dollars ou moins. For more information about the function, refer to https://docs.databend.com/sql/sql-functions/ai-functions/ai-to-sql

Furthermore, the AI_TO_SQL function is now also available on Databend Cloud, and in case you do not provide an OpenAI API key, the platform will use a complimentary default key.

Alt text

We believe this is not just an alternative way to write SQL statements. Integrating with AI will unlock more potentials to boost productivity and make Databend understand and serve you better. Databend plans to integrate AI with the Embedding Vector function in 2023, enabling users to convert certain columns into Vector format and store them as Vector data types. This will facilitate faster calculation of similarities between vectors, and advance Databend towards "Cloud Data Warehouse + Vector" capabilities.