From eee33cebf241fe475635a6219ee8b5bfd3b138ef Mon Sep 17 00:00:00 2001 From: Lorenzo Mangani Date: Sat, 26 Oct 2024 11:23:53 +0200 Subject: [PATCH 1/4] Update open_prompt ref to 0.0.2 --- extensions/open_prompt/description.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/extensions/open_prompt/description.yml b/extensions/open_prompt/description.yml index df66230..ae8dad7 100644 --- a/extensions/open_prompt/description.yml +++ b/extensions/open_prompt/description.yml @@ -1,7 +1,7 @@ extension: name: open_prompt - description: Interact with LLMs from a DuckDB Extension - version: 0.0.1 + description: Interact with LLMs with a simple DuckDB Extension + version: 0.0.2 language: C++ build: cmake license: MIT @@ -11,16 +11,17 @@ extension: repo: github: quackscience/duckdb-extension-openprompt - ref: a970029b83a35d8b812765220617d9cc14ca472d + ref: b734f8274ddb834b81ee7cc287f3c92e98342387 docs: hello_world: | -- Configure the required extension parameters - SELECT set_api_token('your_api_key_here'); - SELECT set_api_url('http://localhost:11434/v1/chat/completions'); + SET VARIABLE openprompt_api_url = 'http://localhost:11434/v1/chat/completions'; + SET VARIABLE openprompt_api_token = 'optional_api_token_here'; + SET VARIABLE openprompt_model_name = 'qwen2.5:0.5b'; -- 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; + D SELECT open_prompt('Write a one-line poem about ducks') AS response; ┌────────────────────────────────────────────────┐ │ response │ │ varchar │ @@ -28,5 +29,8 @@ docs: │ Ducks quacking at dawn, swimming in the light. │ └────────────────────────────────────────────────┘ - extended_description: | - This extension is experimental and potentially unstable. Do not use it in production. + extended_description: | + This extension is in development and potentially unstable. Use at your own risk. + + For examples and instructions check out the `open_prompt` [README](https://github.com/quackscience/duckdb-extension-openprompt) + From 35bf7fd1812a5e672d1c46b52c97aa421206c25c Mon Sep 17 00:00:00 2001 From: Lorenzo Mangani Date: Sat, 26 Oct 2024 12:40:10 +0200 Subject: [PATCH 2/4] Update description.yml --- extensions/open_prompt/description.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/extensions/open_prompt/description.yml b/extensions/open_prompt/description.yml index ae8dad7..bbebec4 100644 --- a/extensions/open_prompt/description.yml +++ b/extensions/open_prompt/description.yml @@ -29,8 +29,5 @@ docs: │ Ducks quacking at dawn, swimming in the light. │ └────────────────────────────────────────────────┘ - extended_description: | - This extension is in development and potentially unstable. Use at your own risk. - + extended_description: | For examples and instructions check out the `open_prompt` [README](https://github.com/quackscience/duckdb-extension-openprompt) - From c1cea702449b067d188676ea635afcd9bab53ada Mon Sep 17 00:00:00 2001 From: Lorenzo Mangani Date: Sat, 26 Oct 2024 16:30:16 +0200 Subject: [PATCH 3/4] Update open_prompt to 0.0.3 --- extensions/open_prompt/description.yml | 28 ++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/extensions/open_prompt/description.yml b/extensions/open_prompt/description.yml index bbebec4..9e26b82 100644 --- a/extensions/open_prompt/description.yml +++ b/extensions/open_prompt/description.yml @@ -1,7 +1,7 @@ extension: name: open_prompt description: Interact with LLMs with a simple DuckDB Extension - version: 0.0.2 + version: 0.0.3 language: C++ build: cmake license: MIT @@ -11,7 +11,7 @@ extension: repo: github: quackscience/duckdb-extension-openprompt - ref: b734f8274ddb834b81ee7cc287f3c92e98342387 + ref: 616bdfc4e7b01c4095a2dda8d4104c179922efd6 docs: hello_world: | @@ -28,6 +28,30 @@ docs: ├────────────────────────────────────────────────┤ │ Ducks quacking at dawn, swimming in the light. │ └────────────────────────────────────────────────┘ + + -- Prompt requesting JSON Structured Output for ChatGPT, LLama3, etc + SET VARIABLE openprompt_model_name = 'llama3.2:3b'; + SELECT open_prompt('I want ice cream', json_schema := '{ + "type": "object", + "properties": { + "summary": { "type": "string" }, + "sentiment": { "type": "string", "enum": ["pos", "neg", "neutral"] } + }, + "required": ["summary", "sentiment"], + "additionalProperties": false + }'); + + -- Use Custom System Prompt to request JSON Output in smaller models + SET VARIABLE openprompt_model_name = 'qwen2.5:1.5b'; + SELECT open_prompt('I want ice cream.', system_prompt:='Response MUST be JSON with the following schema: { + "type": "object", + "properties": { + "summary": { "type": "string" }, + "sentiment": { "type": "string", "enum": ["pos", "neg", "neutral"] } + }, + "required": ["summary", "sentiment"], + "additionalProperties": false + }'); extended_description: | For examples and instructions check out the `open_prompt` [README](https://github.com/quackscience/duckdb-extension-openprompt) From c716ee0e1db1d182d2e770f2af7f0656be794514 Mon Sep 17 00:00:00 2001 From: Lorenzo Mangani Date: Sun, 22 Dec 2024 13:49:42 +0100 Subject: [PATCH 4/4] Update open_prompt to 0.0.4 --- extensions/open_prompt/description.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/open_prompt/description.yml b/extensions/open_prompt/description.yml index 9e26b82..9b89edc 100644 --- a/extensions/open_prompt/description.yml +++ b/extensions/open_prompt/description.yml @@ -1,7 +1,7 @@ extension: name: open_prompt description: Interact with LLMs with a simple DuckDB Extension - version: 0.0.3 + version: 0.0.4 language: C++ build: cmake license: MIT @@ -11,7 +11,7 @@ extension: repo: github: quackscience/duckdb-extension-openprompt - ref: 616bdfc4e7b01c4095a2dda8d4104c179922efd6 + ref: e7e54de7cfc0bc61599c7ab018399508077202a5 docs: hello_world: |