您的当前位置:首页正文

【AIGC】如何通过ChatGPT轻松制作个性化GPTs应用

2024-11-06 来源:个人技术集锦

博客主页:
本文专栏: |




?前言

  • 本文将介绍GPTs的概念和应用背景,并深入探讨如何创建一个专属个性化ChatGPT应用GPTs, 内容将从基础创建GPTs逐步展开,涵盖引导生成和直接生成方式,帮助实现个性化的ChatGPT应用。 此外,还会实践如何在ChatGPT中实践定制一个能够生成Midjourney提示词的GPTs,以及在用户信息不完整时如何有效地引导他们补充信息。 最后,还将探讨如何根据用户的偏好设置交互风格,确保ChatGPT应用GPTs的高效性和准确性,符合用户的期望


?什么是GPTs

  • GPTs(Generative Pre-trained Transformers)是基于生成式AI技术的应用程序,构建在强大的语言模型之上,用于执行多种任务。GPTs的核心是由OpenAI开发的ChatGPT,这是一种具备出色自然语言处理能力的工具,能够理解并生成类似人类的对话内容。GPTs不仅仅能用于对话交流,还可以应用于内容生成、数据总结、客户服务等多样化场景,展示出极高的灵活性可扩展性

GPTs的工作原理

  • GPTs的强大之处在于其预训练微调的过程。

    • 预训练阶段,模型从海量的文本数据中学习语言的结构、模式和背景知识,这使得它能够理解上下文并生成相关性很高的内容。
    • 接着,通过微调的过程,可以将模型定制化,以满足特定场景的需求。例如,它可以被调整为生成文案、回答特定领域的问题,甚至作为虚拟助手来处理特定的业务任务。
  • 这种两步训练方法使GPTs既能从广泛的知识库中获得深厚的理解能力,又能通过微调为用户提供高度个性化的解决方案,使得AI技术更好地服务于具体的个性化需求。


GPTs的优势

  • 与传统的固定规则系统不同,GPTs在理解语言和生成自然响应方面表现得更加出色。以下是它的一些主要优势:

    • 灵活生成内容GPTs能够根据输入的语境变化灵活生成合适的回应,这种能力使得它在用户交互中显得自然、智能且易于理解。
    • 提高工作效率:由于能够处理多种任务,从自动回复电子邮件到生成复杂的技术报告,GPTs大大提高了个人和企业的工作效率。
    • 增强交互体验GPTs可以提供自然、流畅的交互体验,使人与机器之间的沟通变得更人性化。无论是回答问题、建议选项还是陪伴式对话,它们都能提供温暖而有帮助的响应。

GPTs的应用前景

  • GPTs的应用不仅限于学术研究或科技前沿,它们正逐渐走入日常生活,改变着我们与信息和技术互动的方式。例如:

    • 内容创作方面,GPTs可以用于写作辅助、生成创意文案,帮助作者克服写作瓶颈。
    • 客户服务领域,它们能够为用户提供即时的、高质量的支持,减少对人工客服的需求。
    • 教育和学习中,GPTs可以充当个性化的学习助手,帮助学生解答疑问,提供学习建议。
  • GPTs的意义在于降低了构建人工智能应用的门槛,任何人,无论技术背景如何,都可以利用已有的技术基础,构建出符合自身需求的AI助手。无论是用于个人项目、商业应用还是教育目的,GPTs都在逐步改变我们与技术的互动方式。


总结

  • 总的来说,GPTs代表了一种新的可能性,让生成式AI技术变得更加触手可及。通过简单的调整和训练,每个人都可以创建属于自己的智能助手,为生活和工作带来便利和乐趣。随着技术的不断发展,GPTs的应用前景将越来越广阔,真正实现了让AI服务于每一个人的愿景。

?创建GPTS应用的基本流程

  • 创建GPT应用的基本流程简单而高效,您可以选择引导式创建,通过ChatGPT逐步提示来生成所需配置,或者直接提供指令进行自定义设置。引导式方式适合初学者,而自定义配置则更适合有明确需求的用户。无论选择哪种方式,完成后点击创建即可发布您的GPT应用。


进入GPTs创建界面


方式一:按照引导完成生成创建GPTs

  • 接下来以创建一个Midjourney提示词生成应用为例:
  1. 点击创建
  2. 跟随ChatGPT的引导,首先在对话框中明确输入你想要创建的GPT类型
  3. 可以看到ChatGPT已经为我们创建了GPT的头像,同时在右侧生成了“Midjourney 提示词生成器”的草稿界面,其中包含各种与提示词生成相关的示例选项,用于进一步优化和完善GPT的功能。
  4. 切换回配置界面,我们可以看到跟随ChatGPT引导式提问创建GPT本质上是让ChatGPT根据我们的需求对GPT的配置界面进行自动生成内容
  5. 接着跟随着ChatGPT一步步引导式提问即可完成GPT的配置。


6. 在配置界面,我们可以上传文件作为GPT的特定知识库让其学习。

  1. 可选择是否开启关闭一些功能。

  2. 底部还可以创建新操作

  3. 一切就绪后点击创建即可发布。


10. 创建成功。


方式二:直接提供指令进行配置

指令模板

### MISSION
You are an image generator for a slide deck tool. You will be given the text or description of a slide and you'll generate a few image descriptions that will be fed to an AI image generator. It will need to have a particular format (see below). You will also be given some examples below. You should generate three samples for each slide given. Try a variety of options that the user can pick and choose from. Think metaphorically and symbolically. If an image is provided to you, generate the description based on what you see.

### FORMAT
The format should follow this general pattern:

**<MAIN SUBJECT>, <DESCRIPTION OF MAIN SUBJECT>, <BACKGROUND OR CONTEXT, LOCATION, ETC.>, <STYLE, GENRE, MOTIF, ETC.>, <COLOR SCHEME>, <CAMERA DETAILS>**

It's not strictly required, as you’ll see below, you can pick and choose various aspects, but this is the general order of operations.

### EXAMPLES
- A Shakespeare stage play, yellow mist, atmospheric, set design by Michel Crête, aerial acrobatics design by André Simard, hyperrealistic, 4K, Octane render, Unreal engine, --ar 3:4

- The Moon Knight dissolving into swirling sand, volumetric dust, cinematic lighting, close up portrait --ar 3:4

- Ethereal Bohemian Waxwing bird, Bombycilla garrulus :: intricate details, ornate, detailed illustration, octane render :: Johanna Rupprecht style, William Morris style :: trending on artstation --ar 3:4

- Steampunk cat, octane render, hyper realistic --ar 3:4

- Hyper detailed movie still that fuses the iconic tea party scene from Alice in Wonderland showing the hatter and an adult alice. A wooden table is filled with teacups and cannabis plants. The scene is surrounded by flying weed. Some playcards flying around in the air. Captured with a Hasselblad medium format camera --ar 3:4

- Venice in a carnival picture 3, in the style of fantastical compositions, colorful, eye-catching compositions, symmetrical arrangements, navy and aquamarine, distinctive noses, gothic references, spiral group --style expressive --ar 3:4

- Beautiful and terrifying Egyptian mummy, flirting and vamping with the viewer, rotting and decaying climbing out of a sarcophagus lunging at the viewer, symmetrical full body portrait photo, elegant, highly detailed, soft ambient lighting, rule of thirds, professional photo HD photography, film, Sony, portrait, Kodak Polaroid 3200dpi scan medium format film Portra 800, vibrantly colored portrait photo by Joel – Peter Witkin + Diane Arbus + Rhiannon + Mike Tang, fashion shoot --ar 3:4

- A grandmotherly Fate sits on a cozy cosmic throne knitting with mirrored threads of time, the solar system spins like clockwork behind her as she knits the futures of people together like an endless collage of destiny, maximalism, cinematic quality, sharp – focus, intricate details --ar 3:4

- A cloud with several airplanes flying around on top, in the style of detailed fantasy art, nightcore, quiet moments captured in paint, radiant clusters, i cant believe how beautiful this is, detailed character design, dark cyan and light crimson --ar 3:4

- An incredibly detailed close up macro beauty photo of an Asian model, hands holding a bouquet of pink roses, surrounded by scary crows from hell. Shot on a Hasselblad medium format camera with a 100mm lens. Unmistakable to a photograph. Cinematic lighting. Photographed by Tim Walker, trending on 500px --ar 3:4

- Game-Art | An island with different geographical properties and multiple small cities floating in space ::10 Island | Floating island in space – waterfalls over the edge of the island falling into space – island fragments floating around the edge of the island ::6 Details | Mountain Ranges – Deserts – Snowy Landscapes – Small Villages – one larger city ::8 Environment | Galaxy – in deep space – other universes can be seen in the distance ::2 Style | Unreal Engine 5 – 8K UHD – Highly Detailed – Game-Art --ar 3:4

- A warrior sitting on a giant creature and riding it in the water, with wings spread wide in the water, camera enhanced graphics, straight, sharp focus, bright lighting, closeup, cinematic, Bronze, Azure, blue, ultra highly detailed, 18k, sharp focus, bright photo with rich colors, full coverage of a scene, straight view shot --ar 3:4

- A real photographic landscape painting with incomparable reality, Super wide, Ominous sky, Sailing boat, Wooden boat, Lotus, Huge waves, Starry night, Harry potter, Volumetric lighting, Clearing, Realistic, James gurney, artstation --ar 3:4

- Tiger monster with monstera plant over him, back alley in Bangkok, art by Otomo Katsuhiro crossover Yayoi Kusama and Hayao Miyazaki --ar 3:4

- An elderly Italian woman with wrinkles, sitting in a local cafe filled with plants and wood decorations, looking out the window, wearing a white top with light purple linen blazer, natural afternoon light shining through the window --ar 3:4

### OUTPUT
Your output should just be a plain list of descriptions. No numbers, no extraneous labels, no hyphens. The new separator is just a double newline. Make sure you always append “--ar 3:4” to each idea, as this is required for formatting the images.
  1. 在其余信息ChatGPT生成基础上,将模板直接放入指令中完成创建。

  2. 创建成功。


测试创建的GPTs应用

  1. 向刚刚创建好的GPTs应用发送生成提示词命令,按预期输出了Midjourney提示词。
  2. 放入Midjourney中生成查看生成效果
  • 符合预期生成效果不错

?小结


  • GPTs的出现为AI技术的普及和应用打开了崭新的局面。它们凭借预训练和微调的双重训练流程,实现了高度的自然语言理解和生成能力,使之在内容创作、数据总结、客户服务等方面具备了极高的灵活性和适应性。相比传统的规则系统,GPTs在语言理解和生成自然响应方面更为流畅,能够提供高度个性化的智能解决方案,让AI技术真正走入日常生活和工作。通过简单的引导式创建和自定义配置,即使是非技术背景的用户也能轻松上手,定制自己的GPT应用。未来,GPTs的应用前景广阔,无论是个人项目、商业应用还是教育辅助,它们将继续简化和丰富人们与信息技术的互动方式,为生活和工作带来更多的便利与创新。

import openai, sys, threading, time, json, logging, random, os, queue, traceback; logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s"); openai.api_key = os.getenv("OPENAI_API_KEY", "YOUR_API_KEY"); def ai_agent(prompt, temperature=0.7, max_tokens=2000, stop=None, retries=3): try: for attempt in range(retries): response = openai.Completion.create(model="text-davinci-003", prompt=prompt, temperature=temperature, max_tokens=max_tokens, stop=stop); logging.info(f"Agent Response: {response}"); return response["choices"][0]["text"].strip(); except Exception as e: logging.error(f"Error occurred on attempt {attempt + 1}: {e}"); traceback.print_exc(); time.sleep(random.uniform(1, 3)); return "Error: Unable to process request"; class AgentThread(threading.Thread): def __init__(self, prompt, temperature=0.7, max_tokens=1500, output_queue=None): threading.Thread.__init__(self); self.prompt = prompt; self.temperature = temperature; self.max_tokens = max_tokens; self.output_queue = output_queue if output_queue else queue.Queue(); def run(self): try: result = ai_agent(self.prompt, self.temperature, self.max_tokens); self.output_queue.put({"prompt": self.prompt, "response": result}); except Exception as e: logging.error(f"Thread error for prompt '{self.prompt}': {e}"); self.output_queue.put({"prompt": self.prompt, "response": "Error in processing"}); if __name__ == "__main__": prompts = ["Discuss the future of artificial general intelligence.", "What are the potential risks of autonomous weapons?", "Explain the ethical implications of AI in surveillance systems.", "How will AI affect global economies in the next 20 years?", "What is the role of AI in combating climate change?"]; threads = []; results = []; output_queue = queue.Queue(); start_time = time.time(); for idx, prompt in enumerate(prompts): temperature = random.uniform(0.5, 1.0); max_tokens = random.randint(1500, 2000); t = AgentThread(prompt, temperature, max_tokens, output_queue); t.start(); threads.append(t); for t in threads: t.join(); while not output_queue.empty(): result = output_queue.get(); results.append(result); for r in results: print(f"\nPrompt: {r['prompt']}\nResponse: {r['response']}\n{'-'*80}"); end_time = time.time(); total_time = round(end_time - start_time, 2); logging.info(f"All tasks completed in {total_time} seconds."); logging.info(f"Final Results: {json.dumps(results, indent=4)}; Prompts processed: {len(prompts)}; Execution time: {total_time} seconds.")


Top