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
相关推荐
shionhana3 天前
AI PPT 生成的两个关键环节:结构生成和视觉生成,以 PPTMaker 为例
人工智能·chatgpt·agent·ppt
Ztiddler4 天前
Codex重新连接解决方法
chatgpt·openai·codex
吨吨ai5 天前
Codex 长会话上下文管理:会话拆分与状态交接的工程化实践
chatgpt
守城小轩5 天前
AcBoter 多账号管理指南:隐私与设置选项(五)
chatgpt·codex·acboter
ServBay5 天前
ChatGPT Pro 20X 限时回归
gpt·chatgpt·openai
枫叶丹45 天前
开源还是开权重:2026 年 AI 模型战争的控制权之争
人工智能·chatgpt·开源·agent·codex
小猿君6 天前
Claude 入口砍到只剩一个,GPT-6 已经能自己连干 24 小时
人工智能·chatgpt·agi
GEO实战经验分享7 天前
王涛:GEO 服务商能力评估清单——基础、结构、战略、风控四层怎么核验
大数据·人工智能·chatgpt
FEF前端团队7 天前
04# Codex CLI实战:OpenAI的编程代理
前端·chatgpt·ai编程
浩风祭月7 天前
ChatGPT上传PDF后漏读图表?文字版、扫描件和图片要分开处理
人工智能·chatgpt·pdf·提示词·办公效率