diff chatgpt.xml @ 3:7770a4bd42e2 draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit c21d9a2cb410ee30dc47f4a13247862481816266
author bgruening
date Wed, 11 Sep 2024 16:36:21 +0000
parents dab494dce303
children
line wrap: on
line diff
--- a/chatgpt.xml	Fri Aug 23 10:21:21 2024 +0000
+++ b/chatgpt.xml	Wed Sep 11 16:36:21 2024 +0000
@@ -2,29 +2,32 @@
     <description>Integrating OpenAI's ChatGPT into Galaxy</description>
     <macros>
         <token name="@TOOL_VERSION@">2024</token>
-        <token name="@VERSION_SUFFIX@">1</token>
+        <token name="@VERSION_SUFFIX@">2</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[
-    #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
+#import json
+#import os
+#import re
+#set LINK_LIST = []
+#for $input in $context
+    #set file_name = os.path.splitext($input.element_identifier)[0]
+    ## list of supported filetypes in OpenAI. If Galaxy has a filetype that is not in this list, just use the generic `txt`.
+    #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'
+    #set LINK = re.sub('[^\w\-]', '_', $file_name)+'.'+$ext
+    ln -s '$input' '$LINK' &&
+    ## OpenAI has some special handling of "images", so let's annotate this here and pass it to the script
+    #set type = 'image' if $input.ext in ['jpg', 'jpeg', 'png', 'webp', 'gif'] else 'text'
+    $LINK_LIST.append([$LINK, $type])
+#end for
+#set context_files = json.dumps($LINK_LIST)
 
 python '$__tool_directory__/chatgpt.py'
-'$str(",".join($LINK_LIST))'
-'$question'
+'$context_files'
+'$prompt'
 '$model'
 '$openai_api_key_file'
     ]]></command>
@@ -40,7 +43,7 @@
                 <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">
+                <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>
@@ -48,7 +51,7 @@
                 <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">
+                <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>
@@ -58,7 +61,7 @@
                 <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">
+        <param name="prompt" type="text" optional="false" label="Prompt" help="Prompts or tasks you want ChatGPT to perform." area="true">
             <validator type="empty_field"/>
         </param>
     </inputs>
@@ -68,7 +71,7 @@
     <tests>
         <test expect_failure="true" expect_exit_code="1">
             <param name="context" value="chatgpt_test.txt" ftype="txt"/>
-            <param name="question" value="What is this?"/>
+            <param name="prompt" value="What is this?"/>
             <param name="model" value="gpt-4o-mini"/>
             <assert_stdout>
                 <has_text text="OpenAI API key is not provided in user preferences!"/>
@@ -81,14 +84,15 @@
 
 **What it does**
 
-This tool leverages OpenAI's ChatGPT API to generate responses based on user-provided context and questions.
-Users can upload context data in various formats and ask questions related to that data.
+This tool leverages OpenAI's ChatGPT API to generate responses based on user-provided context and prompt.
+Users can upload context data in various formats and ask questions or execute prompts related to that data.
 The tool then uploads the data to a OpenAI server and processes them using the selected ChatGPT model, returning an AI-generated response tailored to the context provided.
 
 To utilize this tool, users need to input their OpenAI API key in the user preferences. To obtain an API key, visit API keys page in your OpenAI Dashboard.
+Make sure to setup the payment method in your OpenAI account to use the API key.
 
 When you run this tool, your input data is sent to OpenAI's servers using your API-key. 
-OpenAI's models process the data and generate a response based on the context and question provided. 
+OpenAI's models process the data and generate a response based on the context and prompt provided. 
 After receiving the response from the OpenAI server, the tool returns it to Galaxy and puts it in your history. 
 The files that have been uploaded are then deleted from the OpenAI's server, so they are not stored beyond their necessary use. 
 If the tool fails to delete your uploaded files automatically, you can manually delete them in your openai account page. You might want to check your OpenAI storage from time to time as they also have a quota.
@@ -103,10 +107,10 @@
 **Input**
 
 1. **Upload Context Data**: Users can upload up to 500 files in formats such as DOC, DOCX, HTML, JSON, PDF, TXT, JPG, JPEG, PNG, WEBP, or GIF. 
-This context data serves as the background information for the question you wish to ask.
+This context data serves as the input for the prompt you wish to execute.
 
-2. **Ask a Question**: Once the context data is added, users can pose a question related to the content. 
-The more specific the question, the more tailored the response will be.
+2. **Provide a Prompt**: Once the context data is added, users can provide a prompt for a task ChatGPT should execute.
+The more specific the prompt, the more tailored the response will be.
 
 3. **Select a Model**: Choose the ChatGPT model that best fits your needs. 
 Information about different models and their pricing can be found on the OpenAI website.
@@ -114,7 +118,7 @@
 
 **Output**
 
-The output is a response generated by ChatGPT, crafted based on the provided context data and the question posed.
+The output is a response generated by ChatGPT, crafted based on the provided context data and the prompt posed.
 This response is saved in the `output.txt` file.