diff chatgpt.xml @ 2:dab494dce303 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit d2d08c3866c0f4a2f10372ae15c5dac5ea2d0bf0
author bgruening
date Fri, 23 Aug 2024 10:21:21 +0000
parents 08c658e9aa9e
children 7770a4bd42e2
line wrap: on
line diff
--- a/chatgpt.xml	Wed Aug 14 11:33:44 2024 +0000
+++ b/chatgpt.xml	Fri Aug 23 10:21:21 2024 +0000
@@ -2,26 +2,28 @@
     <description>Integrating OpenAI's ChatGPT into Galaxy</description>
     <macros>
         <token name="@TOOL_VERSION@">2024</token>
-        <token name="@VERSION_SUFFIX@">0</token>
+        <token name="@VERSION_SUFFIX@">1</token>
     </macros>
     <requirements>
         <requirement type="package" version="3.12">python</requirement>
         <requirement type="package" version="1.35.13">openai</requirement>
     </requirements>
     <command detect_errors="exit_code"><![CDATA[
-#set LINK_LIST = ''
-#for $count, $input in enumerate($context):
-    #set LINK = 'input' + str($count) + '.' + $input.ext
-    ln -s '$input' '$LINK' &&
-    #if count == 0
-        #set LINK_LIST = $LINK
-    #else
-        #set LINK_LIST = $LINK_LIST + ',' + $LINK
-    #end if
-#end for
+    #import os
+    #import re
+    #set $LINK_LIST = []
+    #for $input in $context:
+        #set file_name, ext = os.path.splitext($input.element_identifier)
+        #if ext == ''
+            #set ext = '.'+$input.ext
+        #end if
+        #set LINK = re.sub('[^\w\-]', '_', str($file_name))+$ext
+        ln -s '$input' '$LINK' &&
+        $LINK_LIST.append($LINK)
+    #end for
 
 python '$__tool_directory__/chatgpt.py'
-'$LINK_LIST'
+'$str(",".join($LINK_LIST))'
 '$question'
 '$model'
 '$openai_api_key_file'
@@ -32,17 +34,33 @@
         ]]></configfile>
     </configfiles>
     <inputs>
-        <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."/>
-        <param name="question" type="text" optional="false" label="Question" help="Question about the text provided" area="true">
+        <conditional name="input_type">
+            <param name="input_type_selector" type="select" label="Choose the model" help="Vision models are capable to have image as input.">
+                <option value="vision" selected="true">Vision models</option>
+                <option value="all">All models</option>
+            </param>
+            <when value="vision">
+                <param name="model" type="select" optional="false" label="Model" help="Select the model you want to use">
+                    <option value="gpt-4o-mini" selected="true">Affordable and intelligent small model for fast, lightweight tasks (gpt-4o-mini)</option>
+                    <option value="gpt-4o">High-intelligence flagship model for complex, multi-step tasks (gpt-4o)</option>
+                    <option value="gpt-4-turbo">The previous set of high-intelligence model with vision capabilities (gpt-4-turbo)</option>
+                </param>
+                <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."/>
+            </when>
+            <when value="all">
+                <param name="model" type="select" optional="false" label="Model" help="Select the model you want to use">
+                    <option value="gpt-4o-mini" selected="true">Affordable and intelligent small model for fast, lightweight tasks (gpt-4o-mini)</option>
+                    <option value="gpt-4o">High-intelligence flagship model for complex, multi-step tasks (gpt-4o)</option>
+                    <option value="gpt-4-turbo">The previous set of high-intelligence model with vision capabilities (gpt-4-turbo)</option>
+                    <option value="gpt-4" selected="true">The previous set of high-intelligence model (gpt-4)</option>
+                    <option value="gpt-3.5-turbo">A fast, inexpensive model for simple tasks (GPT-3.5-turbo)</option>
+                </param>
+                <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."/>
+            </when>
+        </conditional>
+        <param name="question" type="text" optional="false" label="Question" help="Question about the text provided." area="true">
             <validator type="empty_field"/>
         </param>
-        <param name="model" type="select" optional="false" label="Model" help="Select the model you want to use">
-            <option value="gpt-4o-mini" selected="true">Affordable and intelligent small model for fast, lightweight tasks (gpt-4o-mini)</option>
-            <option value="gpt-4o">High-intelligence flagship model for complex, multi-step tasks (gpt-4o)</option>
-            <option value="gpt-4-turbo">The previous set of high-intelligence model with vision capabilities (gpt-4-turbo)</option>
-            <option value="gpt-4">The previous set of high-intelligence model (gpt-4) (not supporting images)</option>
-            <option value="gpt-3.5-turbo">A fast, inexpensive model for simple tasks (GPT-3.5-turbo) (not supporting images)</option>
-        </param>
     </inputs>
     <outputs>
         <data name="output" format="txt" label="${tool.name} on ${on_string}" from_work_dir="./output.txt"/>