Skip to content

Add YAML code comments to PDL examples in READMEs, tutorial, and examples #241

Open
@esnible

Description

Is your feature request related to a problem? Please describe.
Some of the PDL features are novel and deserve comments to help the reader understand what is happening.

In a few cases the a comment would also help warn the user if they are doing something incorrect. For example, the user shouldn't run pdl repair_prompt.pdl, but instead run a Python program that illustrates how to invoke PDL from Python. To deal with a user who isn't paying attention, repair_prompt.pdl line 24 should have a note indicating that it isn't expected to work except via the Python program.

Describe the solution you'd like
Add # comments, especially to early tutorial steps and examples. Especially for language features that are unusual.

For example, the second tutorial example has the line:

- "Hello\n"

There should be a comment such as # set "Hello\n" as the default LLM context for the next line. I found strings confusing because they have a meaning in Python (doc comments) and are tolerated in K&R C, but in PDL they have a special meaning and it should be explicitly documented the first few times.

Another block that confused me was:

- lang: python
  def: parsed_output
  spec: {thought: str, code_line: str}
  code: |
    import repair_main
    result = repair_main.parse_output(raw_output)

It wasn't obvious to me that this was a CodeBlock. The spec: confused me and it wasn't obvious that this was inherited from Block. Also, the def: confuses me -- I see that Block has a defs but I don't see that the spec allows def:.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions