Mercurial > repos > bgruening > chatgpt_openai_api
comparison chatgpt.xml @ 4:3803ed45745c draft default tip
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 81bb45731241a082de7b44430afc97a8491a9e47
| author | bgruening |
|---|---|
| date | Wed, 07 Jan 2026 13:00:53 +0000 |
| parents | 430ece17fc20 |
| children |
comparison
equal
deleted
inserted
replaced
| 3:430ece17fc20 | 4:3803ed45745c |
|---|---|
| 1 <tool id="chatgpt_openai_api" name="chatGPT" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="23.0"> | 1 <tool id="chatgpt_openai_api" name="chatGPT" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="25.1"> |
| 2 <description>Integrating OpenAI's ChatGPT into Galaxy</description> | 2 <description>Integrating OpenAI's ChatGPT into Galaxy</description> |
| 3 <macros> | 3 <macros> |
| 4 <token name="@TOOL_VERSION@">2024</token> | 4 <token name="@TOOL_VERSION@">2025</token> |
| 5 <token name="@VERSION_SUFFIX@">2</token> | 5 <token name="@VERSION_SUFFIX@">1</token> |
| 6 </macros> | 6 </macros> |
| 7 <requirements> | 7 <requirements> |
| 8 <requirement type="package" version="3.12">python</requirement> | 8 <requirement type="package" version="3.13">python</requirement> |
| 9 <requirement type="package" version="1.35.13">openai</requirement> | 9 <requirement type="package" version="2.7.1">openai</requirement> |
| 10 <credentials name="openai_credentials" version="1.0" label="OpenAI Credentials" description="Credentials for accessing OpenAI's API."> | |
| 11 <secret name="openai_api_key" inject_as_env="OPENAI_API_KEY" optional="false" label="OpenAI API Key" description="Your OpenAI API key is required to use this tool. You can obtain it from your OpenAI account dashboard."/> | |
| 12 </credentials> | |
| 10 </requirements> | 13 </requirements> |
| 11 <command detect_errors="exit_code"><![CDATA[ | 14 <command detect_errors="exit_code"><![CDATA[ |
| 12 #import json | 15 #import json |
| 13 #import os | 16 #import os |
| 14 #import re | 17 #import re |
| 15 #set LINK_LIST = [] | 18 #set LINK_LIST = [] |
| 16 #for $input in $context | 19 #if $context |
| 17 #set file_name = os.path.splitext($input.element_identifier)[0] | 20 #for $input in $context |
| 18 ## list of supported filetypes in OpenAI. If Galaxy has a filetype that is not in this list, just use the generic `txt`. | 21 #set file_name = os.path.splitext($input.element_identifier)[0] |
| 19 #set ext = $input.ext if $input.ext in ['c', 'cpp', 'css', 'csv', 'docx', 'gif', 'html', 'java', 'jpeg', 'jpg', 'js', 'json', 'md', 'pdf', 'php', 'pkl', 'png', 'pptx', 'py', 'rb', 'tar', 'tex', 'ts', 'txt', 'webp', 'xlsx', 'xml', 'zip'] else 'txt' | 22 ## list of supported filetypes in OpenAI. If Galaxy has a filetype that is not in this list, just use the generic `txt`. |
| 20 #set LINK = re.sub('[^\w\-]', '_', $file_name)+'.'+$ext | 23 #set ext = $input.ext if $input.ext in ['c', 'cpp', 'css', 'csv', 'docx', 'gif', 'html', 'java', 'jpeg', 'jpg', 'js', 'json', 'md', 'pdf', 'php', 'pkl', 'png', 'pptx', 'py', 'rb', 'tar', 'tex', 'ts', 'txt', 'webp', 'xlsx', 'xml', 'zip'] else 'txt' |
| 21 ln -s '$input' '$LINK' && | 24 #set LINK = re.sub('[^\w\-]', '_', $file_name)+'.'+$ext |
| 22 ## OpenAI has some special handling of "images", so let's annotate this here and pass it to the script | 25 ln -s '$input' '$LINK' && |
| 23 #set type = 'image' if $input.ext in ['jpg', 'jpeg', 'png', 'webp', 'gif'] else 'text' | 26 ## OpenAI has some special handling of "images", so let's annotate this here and pass it to the script |
| 24 $LINK_LIST.append([$LINK, $type]) | 27 #set type = 'image' if $input.ext in ['jpg', 'jpeg', 'png', 'webp', 'gif'] else 'text' |
| 25 #end for | 28 $LINK_LIST.append([$LINK, $type]) |
| 29 #end for | |
| 30 #end if | |
| 26 #set context_files = json.dumps($LINK_LIST) | 31 #set context_files = json.dumps($LINK_LIST) |
| 27 | 32 |
| 28 python '$__tool_directory__/chatgpt.py' | 33 python '$__tool_directory__/chatgpt.py' |
| 29 '$context_files' | 34 '$context_files' |
| 30 '$prompt' | 35 '$prompt' |
| 31 '$model' | 36 '$model' |
| 32 '$openai_api_key_file' | |
| 33 ]]></command> | 37 ]]></command> |
| 34 <configfiles> | |
| 35 <configfile name="openai_api_key_file"><![CDATA[ | |
| 36 $__user__.extra_preferences.get('chatgpt|api_key', "") | |
| 37 ]]></configfile> | |
| 38 </configfiles> | |
| 39 <inputs> | 38 <inputs> |
| 40 <conditional name="input_type"> | 39 <param name="model" type="select" optional="false" label="Model" help="Select the model you want to use."> |
| 41 <param name="input_type_selector" type="select" label="Choose the model" help="Vision models are capable to have image as input."> | 40 <option value="gpt-5" selected="true">Flagship model for coding, reasoning, and agentic tasks across domains. (gpt-5)</option> |
| 42 <option value="vision" selected="true">Vision models</option> | 41 <option value="gpt-5-mini">Faster, more cost-efficient version of GPT-5. It's great for well-defined tasks and precise prompts. (gpt-5-mini)</option> |
| 43 <option value="all">All models</option> | 42 <option value="gpt-5-nano">Fastest, cheapest version of GPT-5. It's great for summarization and classification tasks. (gpt-5-nano)</option> |
| 44 </param> | 43 <option value="gpt-4.1">Excels at instruction following and tool calling, with broad knowledge across domains (gpt-4.1)</option> |
| 45 <when value="vision"> | 44 <option value="gpt-4o">High-intelligence flagship model for complex, multi-step tasks (gpt-4o)</option> |
| 46 <param name="model" type="select" optional="false" label="Model" help="Select the model you want to use."> | 45 </param> |
| 47 <option value="gpt-4o-mini" selected="true">Affordable and intelligent small model for fast, lightweight tasks (gpt-4o-mini)</option> | 46 <param name="context" type="data" multiple="true" optional="true" format="docx,html,json,pdf,txt,jpg,png,gif" label="Context" max="500" help="Optional context data that will be uploaded to OpenAI's servers for processing."/> |
| 48 <option value="gpt-4o">High-intelligence flagship model for complex, multi-step tasks (gpt-4o)</option> | |
| 49 <option value="gpt-4-turbo">The previous set of high-intelligence model with vision capabilities (gpt-4-turbo)</option> | |
| 50 </param> | |
| 51 <param name="context" type="data" multiple="true" optional="false" format="doc,docx,html,json,pdf,txt,jpg,jpeg,png,webp,gif" label="Context" max="500" help="This data will be uploaded to OpenAI's servers for processing."/> | |
| 52 </when> | |
| 53 <when value="all"> | |
| 54 <param name="model" type="select" optional="false" label="Model" help="Select the model you want to use."> | |
| 55 <option value="gpt-4o-mini" selected="true">Affordable and intelligent small model for fast, lightweight tasks (gpt-4o-mini)</option> | |
| 56 <option value="gpt-4o">High-intelligence flagship model for complex, multi-step tasks (gpt-4o)</option> | |
| 57 <option value="gpt-4-turbo">The previous set of high-intelligence model with vision capabilities (gpt-4-turbo)</option> | |
| 58 <option value="gpt-4" selected="true">The previous set of high-intelligence model (gpt-4)</option> | |
| 59 <option value="gpt-3.5-turbo">A fast, inexpensive model for simple tasks (GPT-3.5-turbo)</option> | |
| 60 </param> | |
| 61 <param name="context" type="data" multiple="true" optional="false" format="doc,docx,html,json,pdf,txt" label="Context" max="500" help="This data will be uploaded to OpenAI's servers for processing."/> | |
| 62 </when> | |
| 63 </conditional> | |
| 64 <param name="prompt" type="text" optional="false" label="Prompt" help="Prompts or tasks you want ChatGPT to perform." area="true"> | 47 <param name="prompt" type="text" optional="false" label="Prompt" help="Prompts or tasks you want ChatGPT to perform." area="true"> |
| 65 <validator type="empty_field"/> | 48 <validator type="empty_field"/> |
| 66 </param> | 49 </param> |
| 67 </inputs> | 50 </inputs> |
| 68 <outputs> | 51 <outputs> |
| 69 <data name="output" format="txt" label="${tool.name} on ${on_string}" from_work_dir="./output.txt"/> | 52 <data name="output" format="markdown" label="${tool.name} (${model}) #if $on_string then ' on ' + $on_string else ''#" from_work_dir="./output.md"/> |
| 70 </outputs> | 53 </outputs> |
| 71 <tests> | 54 <tests> |
| 72 <test expect_failure="true" expect_exit_code="1"> | 55 <test expect_failure="true" expect_exit_code="1"> |
| 56 <param name="model" value="gpt-5"/> | |
| 73 <param name="context" value="chatgpt_test.txt" ftype="txt"/> | 57 <param name="context" value="chatgpt_test.txt" ftype="txt"/> |
| 74 <param name="prompt" value="What is this?"/> | 58 <param name="prompt" value="What is this?"/> |
| 75 <param name="model" value="gpt-4o-mini"/> | |
| 76 <assert_stdout> | 59 <assert_stdout> |
| 77 <has_text text="OpenAI API key is not provided in user preferences!"/> | 60 <has_text text="OpenAI API key is not provided in credentials!"/> |
| 78 </assert_stdout> | 61 </assert_stdout> |
| 79 </test> | 62 </test> |
| 80 </tests> | 63 </tests> |
| 81 <help><