Skip to content

Conversation

esnible
Copy link
Member

@esnible esnible commented Jan 13, 2025

For #241

First step at adding more comments to document examples.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@esnible I believe you still need -f ./multi-prompts.json?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try it yourself? I did pdl multi_round_chat.pdl and from the home directory pdl examples/granite/multi_round_chat.pdl. Both worked.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, we have an include so -f is not needed. Leftover from old ways of doing things.

@starpit
Copy link
Member

starpit commented Jan 13, 2025

btw, as far as i can tell, source comments do not propagate to the trace json. whereas inline text elements to. could we leverage those more, instead of source comments?

@esnible
Copy link
Member Author

esnible commented Jan 14, 2025

@starpit I agree that I would like to see comments when debugging.

  • PDL uses PyYAML, which doesn't see them. An alternative is to switch to https://pypi.org/project/ruamel.yaml/ . Not sure of the difficulty. That parser preserves ordering and comments.
  • Somehow PDL knows the line number of statements. An alternative is to include the PDL source in the trace, then use the line number to navigate to the original representation.
  • It might be possible to add a comment field to PDL's basic block. However, that looks ugly and couldn't handle blocks such as - "\nDid you say ${ GEN }?\n" # Did the user say $GEN?

@vazirim
Copy link
Member

vazirim commented Jan 14, 2025

PDL has a description field in every block which is basically a comment.

For a string by itself you can write:

- text: "\nDid you say ${ GEN }?\n" 
  description: "Did the user say $GEN?"

@starpit
Copy link
Member

starpit commented Jan 14, 2025

fib.pdl uses plain text elements that show up nicely (well, it could be nicer, work in progress) as notebook-style interstitial commentary.

Screenshot 2025-01-14 at 9 41 49 AM

@esnible esnible merged commit ceb2f52 into IBM:main Jan 15, 2025
5 checks passed
@esnible esnible deleted the example-comments branch January 15, 2025 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants