Building Systems with the ChatGPT API - Process Inputs: Chaining Prompts

https://github.com/Ryota-Kawamura/Building-Systems-with-the-ChatGPT-API/tree/81d7d10bb6c0a4c3aeb18785b5c31d6ddc7b3a7b

How to split complex tasks into a series of simpler subtasks by chaining multiple prompts together

  • Using one long, complicated instruction where you have to manage multiple xxx and timing simultaneously, it can be challenging to keep track of everything and ensure that each component is perfect
  • Chaining prompts, on the other hand, is done in stages where you focus on one component at a time, ensuring that each part is correct before moving on to the next.

Chaing Prompts

  • More Focused
    • Breaks down a complex task
    • Making it easier to manage and reducing the likelihood of errors
  • Each subtask contains only the instructions required for a single state of the task, which makes the system easier to manage, makes sure the model has all the information it needs to carry out a task, and reduces the likelihood of errors
  • Reduce the number of tokens used in a prompt
  • Skip some chains of the workflow when not needed for the task
  • Easier to test
    • Include human-in-the-loop
  • For complex tasks, keep track of state
    • External to the LLM(in your own code)
  • Use external tools(web search, databases)
复制代码
  import os
  import openai
  import utils
  from dotenv import load_dotenv, find_dotenv
  _ = load_dotenv(find_dotenv()) # read local .env file

  openai.api_key  = os.environ['OPENAI_API_KEY']
  • Context Limitations
    • Max tokens for input prompt and output response
  • Reduce Costs
    • pay per token
相关推荐
马丁路的King5 小时前
Apple 设计被蒸馏成可落地 Skill
chatgpt
孤狼GPT5 小时前
ChatGPT、Codex与Pro:AI开发正在从“单工具竞争”走向“系统协同”
chatgpt·ai编程·codex·chatgpt pro·系统协同
funkygroove9 小时前
ChatGPT Business 包含 Pro 吗?两者区别一次说清
人工智能·chatgpt
AI大模型-小华10 小时前
Codex 长任务频繁中断怎么办?从上下文管理到 ChatGPT Pro 选择
chatgpt·ai编程·软件开发·codex·代码重构·开发效率·chatgpt pro
Summer-Bright11 小时前
深度 | HBM4 标准急转弯:JEDEC 为什么在关键时刻「松绑」?
人工智能·语言模型·chatgpt·芯片·hbm
AI导出鸭11 小时前
如何让deepseek生成word文档 ?「AI 导出鸭」苹果版:从API流式解析到Pages级渲染,硬核攻克公式裂变与表格回流的终极方案。
人工智能·chatgpt·word·cocoa·ai导出鸭
孤狼GPT12 小时前
ChatGPT、Codex与Pro:AI写代码越快,为什么需求工程反而越重要?
chatgpt·ai编程·codex·chatgpt pro·需求工程
AI大模型-小华12 小时前
Codex 为什么越用越慢?大型项目中的上下文管理与方案选择
人工智能·chatgpt·软件开发·codex·开发效率·chatgpt plus·chatgpt pro
AI大模型-小雄15 小时前
ChatGPT Plus 够不够用?从5种开发场景判断是否需要 Pro
chatgpt·ai编程·开发工具·codex·chatgpt plus·chatgpt pro
没有梦想的咸鱼185-1037-16631 天前
AI-Python机器学习与深度学习技术:CNN/Transformer/扩散模型、SHAP可解释及Hermes智能体自动化
人工智能·python·深度学习·机器学习·chatgpt·cnn·transformer