Declarative Prompt-Programming Framework: Difference between revisions

No edit summary
m (Text replacement - "Category:Quality Gold" to "Category:Quality Silver")
 
(2 intermediate revisions by 2 users not shown)
Line 99: Line 99:
** [[Hardcoded Prompt System]]s that embed [[prompt string]]s directly in [[application code]], preventing [[separation of concern]]s and [[prompt versioning]].
** [[Hardcoded Prompt System]]s that embed [[prompt string]]s directly in [[application code]], preventing [[separation of concern]]s and [[prompt versioning]].
* <B>See:</B> [[Prompt Engineering]], [[LLM Orchestration Framework]], [[Declarative Programming]], [[YAML Configuration]], [[JSON Schema]], [[Domain-Specific Language]], [[Model-Driven Engineering]], [[Structured Output Generation]], [[Retrieval-Augmented Generation]], [[Chain-of-Thought Prompting]], [[LLMOps]], [[Prompt Template]], [[Prompt Management]], [[AI Function]], [[Workflow Orchestration]].
* <B>See:</B> [[Prompt Engineering]], [[LLM Orchestration Framework]], [[Declarative Programming]], [[YAML Configuration]], [[JSON Schema]], [[Domain-Specific Language]], [[Model-Driven Engineering]], [[Structured Output Generation]], [[Retrieval-Augmented Generation]], [[Chain-of-Thought Prompting]], [[LLMOps]], [[Prompt Template]], [[Prompt Management]], [[AI Function]], [[Workflow Orchestration]].
----
----
== References ==
=== 2025-05-01 ===
* Perplexity.ai https://chatgpt.com/share/6813e182-f24c-8012-bb23-c79925fa2b72
** [[Question]]: Identify and compare existing [[Declarative Prompt Programming Framework|declarative prompt-programming frameworks]] that align with these characteristics—such as using [[Declarative Programming Syntax|declarative syntax]] (YAML, JSON, DSLs), supporting [[Framework Modularity|modularity]], [[Framework Templating|templating]], [[Schema Validation Capability|schema validation]], [[Model Agnostic Abstraction|model-agnostic abstractions]], and [[Collaborative Framework Versioning|collaborative versioning]].
** [[Answer]]: [[Declarative Prompt Programming Framework|Declarative prompt-programming frameworks]] let [[Framework Developer|developers]] **define [[Prompt Logic|prompt logic]] as [[Configuration Data|data/configuration]]** rather than writing [[Imperative Code|imperative code]]. These [[Framework System|systems]] use formats like [[YAML Format|YAML]], [[JSON Format|JSON]], or [[Domain Specific Language|domain-specific languages]] (DSLs) to specify how an [[Large Language Model|LLM]] should behave, including [[Input Schema|input]]/[[Output Schema|output schemas]], [[Prompt Control Flow|control flow]], and [[Multi Step Interaction|multi-step interactions]].
*** [[Framework Comparison|Framework Comparisons]]:
**** [[IBM Prompt Declaration Language|IBM PDL (Prompt Declaration Language)]]:
***** Uses [[YAML DSL Format|YAML DSL]] (`.pdl` [[YAML File|YAML files]]) for [[Comprehensive Prompt Workflow|comprehensive prompt workflows]].
***** Features [[Universal Framework Usage|universal usage]] across domains with [[Framework Modularity|modularity]], [[Templating Capability|templating]], [[Control Flow Structure|loops]], [[Conditional Structure|conditionals]], [[Framework Function|functions]], and [[Type Checked IO|type-checked I/O]].
***** Provides [[Model Agnostic Support|model-agnostic]] support for any [[LLM Connection|LLM via connectors]].
**** [[Stanford DSPy Framework|Stanford DSPy]]:
***** Implements a [[Python DSL|Python DSL]] with [[Declarative Module|declarative modules]] in code.
***** Emphasizes [[Self Optimizing Pipeline|self-optimizing pipelines]] and [[Prompt Improvement|improving prompts]] over time.
***** Offers [[Module Composition|modular composition]], [[Automated Optimization|automated optimization]] (teleprompters), and [[Chain Of Thought Module|chain-of-thought modules]].
***** Works with [[Open Source Model|open-source models]] and [[Commercial API|commercial APIs]] like [[OpenAI Integration|OpenAI]].
**** [[Microsoft Guidance Framework|Microsoft Guidance]]:
***** Features a [[Templating DSL|templating DSL]] embedded in [[Python Library|Python]] (guidance library).
***** Focuses on [[Single Call Control|single-call orientation]] for controlling one [[Prompt Response Flow|prompt-response flow]].
***** Provides [[Inline Generation Control|inline control of generation]] with [[If Statement|if]]/[[For Loop|for loops]], [[Choice Selection|choice selection]], and [[Output Formatting|output formatting]] (regex guides).
***** Supports various [[Model Provider|model providers]] through [[Model Abstraction|abstraction]].
**** [[LMQL Framework|LMQL (Language Model Query Language)]]:
***** Uses a [[Python Embedded DSL|Python-embedded DSL]] with [[Query Clause|query language]] and [[Where Clause|where clauses]].
***** Specializes in [[Constrained Generation|constrained generation]] for enforcing [[Output Schema|output schemas]]/[[Pattern Enforcement|patterns]].
***** Enables [[Schema Validation|schema validation]] through [[Where Statement|where statements]] and [[Template System|templates]] with [[Output Constraint|constraint expressions]].
***** Works with [[Local Model|local HuggingFace models]] with [[Limited API Support|limited support for external APIs]].
**** [[BAML Framework|BAML (Basically a Made-up Language)]]:
***** Implements a [[Custom Schema DSL|custom schema-driven DSL]] with [[Function Definition Structure|function definitions]] in multiple languages.
***** Designed for [[Reliable AI Agent|reliable AI agents]] & [[AI Workflow|workflows]] with [[Schema Driven Prompt|schema-driven prompts]].
***** Treats [[Typed Function|prompts as typed functions]] with [[Parameter Type|parameters]] and [[Return Type|return types]].
***** Includes [[Jinja2 Templating|Jinja2 templating]], [[Type Safety Feature|full type-safety]], [[Retry Mechanism|retries]], and [[Streaming Capability|streaming]].
***** Provides [[Cross Language Integration|cross-language integration]] ([[Python Integration|Python]], [[JavaScript Integration|JS]], [[Ruby Integration|Ruby]], [[Go Integration|Go]]).
**** [[Guardrails Framework|Guardrails (RAIL by Guardrails AI)]]:
***** Uses [[RAIL Markup|RAIL markup]] ([[XML YAML Hybrid|XML/YAML hybrid]] specification).
***** Focuses on [[Output Validation|output validation]] and [[Output Safety|safety]] for any prompt.
***** Defines [[Output Schema Requirement|output schema and format requirements]] in [[RAIL Specification|RAIL spec]].
***** Automates [[LLM Reask|re-asking the LLM]] until output meets schema.
***** Offers [[Model Agnostic Guard|model-agnostic guards]] for [[Consistent Output|consistent outputs]] across models.
**** [[NVIDIA NeMo Guardrails|NVIDIA NeMo Guardrails]]:
***** Combines [[YAML Configuration|YAML config]] with [[Colang DSL|Colang DSL]] ([[Policy File|policy files]]).
***** Specializes in [[Conversational AI Safety|conversational AI safety]] and [[Flow Control|flow control]].
***** Uses [[Rail Rule|rails (rules)]] for [[Input Filtering|input filtering]], [[Response Validation|response validation]], and [[Dialogue Flow Management|dialogue flow management]].
***** Supports [[Conditional Flow|conditional flows]], [[Multi Turn Dialogue|multi-turn dialogues]], and [[Custom Action Integration|integration of custom actions]].
***** Integrates with various [[Model API|model APIs]] through [[Connector System|connectors]].
**** [[Azure Prompt Flow|Azure Prompt Flow]]:
***** Employs [[YAML Flow Definition|YAML]] (flow [[DAG Definition|DAG definition]]).
***** Targets [[LLMOps|LLMOps]] and [[Production Pipeline|production pipelines]].
***** Defines [[Flow DAG|flows as DAGs]] of [[Flow Step|steps]] ([[LLM Call|LLM calls]], [[Python Function|Python functions]], [[Tool Integration|tools]]) in YAML.
***** Facilitates [[Variable Passing|variables]], [[Step Data Passing|data passing between steps]], and [[CICD Integration|CI/CD integration]].
***** Works with [[Azure OpenAI|Azure OpenAI]], other [[Provider Connection|providers via "connections"]], and [[Custom Tool|custom tools]].
**** [[Marvin AI Function|Marvin (AI Functions)]]:
***** Implements [[Python Decorator|Python decorators]] using [[Type Hint|type hints]] & [[Function Docstring|docstrings]].
***** Takes a [[Function Oriented|function-oriented]] approach to [[Prompt Design|prompt design]].
***** Uses [[Python Type Annotation|Python type annotations]] and [[Docstring Description|docstring]] to declare what the [[LLM Task|LLM should do]].
***** Derives [[Schema Type|schema from types]] to ensure [[Output Validity|output validity]].
***** Works with various [[Model API|model APIs]] through [[Type Independence|type independence]].
** Citations:
[1] https://www.infoq.com/news/2023/06/guidance-microsoft-language/
[2] https://www.latent.space/p/guaranteed-quality-and-structure
[3] https://www.restack.io/p/promptflow-answer-yaml-flow-sequence-cat-ai
[4] https://www.datacamp.com/blog/dspy-introduction
[5] https://www.twosigma.com/articles/a-guide-to-large-language-model-abstractions/


----
----
Line 105: Line 171:
[[Category:AI Technology]]
[[Category:AI Technology]]
[[Category:Prompt Engineering]]
[[Category:Prompt Engineering]]
[[Category:Quality Gold]]
[[Category:Quality Silver]]

Latest revision as of 12:29, 4 June 2025

A Declarative Prompt-Programming Framework is a prompt-programming framework that uses a declarative syntax to express the structure, inputs, outputs, and constraints of LLM interactions while hiding implementation details.



References

2025-05-01

[1] https://www.infoq.com/news/2023/06/guidance-microsoft-language/
[2] https://www.latent.space/p/guaranteed-quality-and-structure
[3] https://www.restack.io/p/promptflow-answer-yaml-flow-sequence-cat-ai
[4] https://www.datacamp.com/blog/dspy-introduction
[5] https://www.twosigma.com/articles/a-guide-to-large-language-model-abstractions/