annotate chatgpt.py @ 1:08c658e9aa9e draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 13c168a7d6a2d5050c04253754fb86321ad57d54
author bgruening
date Wed, 14 Aug 2024 11:33:44 +0000
parents f256dc85e1a0
children dab494dce303
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
1 import os
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
2 import sys
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
3
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
4 from openai import OpenAI
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
5
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
6 context_files = sys.argv[1].split(",")
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
7 question = sys.argv[2]
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
8 model = sys.argv[3]
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
9 with open(sys.argv[4], "r") as f:
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
10 openai_api_key = f.read().strip()
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
11 if not openai_api_key:
1
08c658e9aa9e planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 13c168a7d6a2d5050c04253754fb86321ad57d54
bgruening
parents: 0
diff changeset
12 print("OpenAI API key is not provided in user preferences!")
08c658e9aa9e planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 13c168a7d6a2d5050c04253754fb86321ad57d54
bgruening
parents: 0
diff changeset
13 sys.exit(1)
0
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
14
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
15 client = OpenAI(api_key=openai_api_key)
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
16
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
17 file_search_sup_ext = [
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
18 "c",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
19 "cs",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
20 "cpp",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
21 "doc",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
22 "docx",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
23 "html",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
24 "java",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
25 "json",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
26 "md",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
27 "pdf",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
28 "php",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
29 "pptx",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
30 "py",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
31 "rb",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
32 "tex",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
33 "txt",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
34 "css",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
35 "js",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
36 "sh",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
37 "ts",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
38 ]
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
39
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
40 vision_sup_ext = ["jpg", "jpeg", "png", "webp", "gif"]
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
41
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
42 file_search_file_streams = []
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
43 image_urls = []
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
44
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
45 for path in context_files:
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
46 ext = path.split(".")[-1].lower()
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
47 if ext in vision_sup_ext and model in ["gpt-4o", "gpt-4o-mini", "gpt-4-turbo"]:
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
48 if os.path.getsize(path) > 20 * 1024 * 1024:
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
49 raise Exception(f"File {path} exceeds the 20MB limit and will not be processed.")
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
50 file = client.files.create(file=open(path, "rb"), purpose="vision")
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
51 promt = {"type": "image_file", "image_file": {"file_id": file.id}}
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
52 image_urls.append(promt)
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
53
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
54 elif ext in file_search_sup_ext:
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
55 file_search_file_streams.append(open(path, "rb"))
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
56 else:
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
57 raise Exception("Not supported file!")
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
58
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
59 assistant = client.beta.assistants.create(
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
60 instructions="You are going to get question about the file(s).",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
61 model=model,
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
62 tools=[{"type": "file_search"}] if file_search_file_streams else None,
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
63 )
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
64 if file_search_file_streams:
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
65 vector_store = client.beta.vector_stores.create()
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
66 file_batch = client.beta.vector_stores.file_batches.upload_and_poll(
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
67 vector_store_id=vector_store.id, files=file_search_file_streams
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
68 )
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
69 assistant = client.beta.assistants.update(
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
70 assistant_id=assistant.id, tool_resources={"file_search": {"vector_store_ids": [vector_store.id]}}
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
71 )
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
72
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
73 messages = [
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
74 {
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
75 "role": "user",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
76 "content": [
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
77 {
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
78 "type": "text",
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
79 "text": question,
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
80 },
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
81 *image_urls,
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
82 ],
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
83 }
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
84 ]
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
85 thread = client.beta.threads.create(messages=messages)
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
86 run = client.beta.threads.runs.create_and_poll(thread_id=thread.id, assistant_id=assistant.id)
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
87 messages = list(client.beta.threads.messages.list(thread_id=thread.id, run_id=run.id))
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
88
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
89 message_content = messages[0].content[0].text.value
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
90 print("Output has been saved!")
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
91 with open("output.txt", "w") as f:
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
92 f.write(message_content)
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
93
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
94 for image in image_urls:
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
95 client.files.delete(image["image_file"]["file_id"])
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
96 if file_search_file_streams:
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
97 client.beta.vector_stores.delete(vector_store.id)
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
98 client.beta.threads.delete(thread.id)
f256dc85e1a0 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/chatgpt commit 840e66e7f23cf775ebd3083c6e07d1819b17f74c
bgruening
parents:
diff changeset
99 client.beta.assistants.delete(assistant.id)