arXiv:2410.19135cs.AIcs.PL2024-10被引 15

用声明式语言让提示词编程更简单可靠

PDL: A Declarative Prompt Programming Language

  • 基于YAML的声明式语言,把提示词作为核心设计元素
  • 支持聊天机器人、RAG、智能体等常见场景
  • 兼顾易用性与控制权,适合开发者快速上手

大语言模型(LLMs)通过高度灵活的文本提示实现多种应用,但其非结构化的输入输出使系统容易出错。现有提示框架或学习成本高,或剥夺开发者对提示的精确控制。本文提出提示声明语言(PDL),一种基于YAML的简洁声明式数据语言,将提示置于核心位置。PDL兼容多种LLM平台和模型,支持调用LLMs与工具,可轻松构建聊天机器人、检索增强生成(RAG)及智能体等交互式应用。我们希望PDL能让提示编程更简单、更稳定、更愉悦。

原文摘要 · Abstract (English)

Large language models (LLMs) have taken the world by storm by making many previously difficult uses of AI feasible. LLMs are controlled via highly expressive textual prompts and return textual answers. Unfortunately, this unstructured text as input and output makes LLM-based applications brittle. This motivates the rise of prompting frameworks, which mediate between LLMs and the external world. However, existing prompting frameworks either have a high learning curve or take away control over the exact prompts from the developer. To overcome this dilemma, this paper introduces the Prompt Declaration Language (PDL). PDL is a simple declarative data-oriented language that puts prompts at the forefront, based on YAML. PDL works well with many LLM platforms and LLMs. It supports writing interactive applications that call LLMs and tools, and makes it easy to implement common use-cases such as chatbots, RAG, or agents. We hope PDL will make prompt programming simpler, less brittle, and more enjoyable.

提示工程声明式语言LLM应用

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。