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
相关推荐
dunge202643 分钟前
ChatGPT 技术深度解析:从原理到应用实践
chatgpt
死磕音视频17 小时前
ChatGPT 自定义指令与记忆入门:一次设置,少重复自我介绍
chatgpt·memory·提示词·自定义指令
龙孚信息20 小时前
搜索算法的保质期,正在被AI刷新
人工智能·chatgpt
外贸GEO优化1 天前
ChatGPT、Gemini、Perplexity、Copilot 怎么引中国供应商:广州外贸工厂按平台动作清单
人工智能·chatgpt·copilot
梦想出海-Phoebe1 天前
ChatGPT 支持人民币付款了吗?详解 OpenAI 多币种计费与支付限制
人工智能·chatgpt
死磕音视频1 天前
ChatGPT Deep Research 入门:把复杂问题做成带出处的调研报告
人工智能·chatgpt·信息检索·deep research·调研方法
Yolanda_20221 天前
Claudecode报错402 insufficient balance(1008)
人工智能·神经网络·chatgpt
顿哥GPT1 天前
ChatGPT 技术深度解析:从原理到应用实践
chatgpt
Yolanda_20221 天前
cc-switch配置opanai使用报错401 Unauthorized处理
深度学习·chatgpt
强哥聊算力1 天前
《算力江湖·英伟达传奇》第七集:ChatGPT出现前夜,英伟达发生了什么?
服务器·人工智能·算法·ai·chatgpt·gpu算力