Interact with LLMs from a DuckDB Extension
Installing and Loading
INSTALL open_prompt FROM community;
LOAD open_prompt;
Example
-- Configure the required extension parameters
SELECT set_api_token('your_api_key_here');
SELECT set_api_url('http://localhost:11434/v1/chat/completions');
-- Prompt any OpenAI Completions API form your query
D SELECT open_prompt('Write a one-line poem about ducks', 'qwen2.5:0.5b') AS response;
┌────────────────────────────────────────────────┐
│ response │
│ varchar │
├────────────────────────────────────────────────┤
│ Ducks quacking at dawn, swimming in the light. │
└────────────────────────────────────────────────┘
About open_prompt
This extension is experimental and potentially unstable. Do not use it in production.
Added Functions
function_name | function_type | description | comment | example |
---|---|---|---|---|
open_prompt | scalar | |||
set_api_token | scalar | |||
set_api_url | scalar | |||
set_model_name | scalar |