Skip to content

Commit d7023eb

Browse files
authored
Merge pull request #10717 from soyeric128/openai-key
docs: openai-api-key
2 parents f9ddf2e + 26af036 commit d7023eb

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

docs/doc/15-sql-functions/61-ai-functions/01-ai-to-sql.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,17 @@ The SQL query statements generated adhere to the PostgreSQL standards, so they m
1414

1515
```sql
1616
USE <your-database>;
17-
SELECT * FROM ai_to_sql('<natural-language-instruction>', '<openai-api-key>');
17+
SELECT * FROM ai_to_sql('<natural-language-instruction>'[, '<openai-api-key>']);
1818
```
19-
To obtain your openAI API key, please visit https://platform.openai.com/account/api-keys and generate a new key.
19+
20+
:::tip Obtain and Save openAI API Key
21+
- To obtain your openAI API key, please visit https://platform.openai.com/account/api-keys and generate a new key.
22+
- Instead of manually entering 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.
23+
24+
```toml
25+
openai_api_key = "<your-key>"
26+
```
27+
:::
2028

2129
## Examples
2230

0 commit comments

Comments
 (0)