- Issue created by @NicholasS
- Merge request !2Append format requirements to custom prompt, add translitaiton of string,... → (Closed) created by NicholasS
- Status changed to Needs review
about 1 year ago 5:01pm 4 December 2023 - 🇫🇮Finland j-vee Turku, Finland
Thanks @NicholasS, good idea that appending the request for HTML to the prompt. I patched in the code from your MR and changed the place where that request is appended to analyzeUrl-function instead, that way it'll always be appended no matter how the service is used.
- Status changed to Fixed
about 1 year ago 8:13am 5 December 2023 - 🇺🇸United States NicholasS
@j-vee So I was occasionally getting some varying HTML formats returned to me even with this request for HTML added on to the end of custom prompts. Most common was
```html
I assume a markdown wrapper indicating html.I wonder if a better approach is to not fight the default markdown format, and just use an existing module or something to render the markdown for the reports? https://www.drupal.org/project/markdown →
- Status changed to Needs work
about 1 year ago 6:35am 7 December 2023 - 🇫🇮Finland j-vee Turku, Finland
I faced that issue previously but hadn't had it happen for a long time so I thought the prompt updates had fixed it.
Might be better that we do change the module to do just that. Ask for markdown and then convert it to HTML in the back end using a composer plugin like the one drupal/markdown is using: https://github.com/thephpleague/commonmark
It might save a few tokens as well I imagine.
So let's re-open this one for now, thanks!
- Status changed to Fixed
about 1 year ago 7:06am 12 December 2023 - 🇫🇮Finland j-vee Turku, Finland
I've pushed out a new release to dev that should fix this. So now we specify in the prompt that we want the results in markdown (which the API would provide anyway) and we then use thephpleague/commonmark library to convert that markdown into HTML.
And it works pretty darn well! This way also does save on some tokens so it's a win win solution. Thanks!
Automatically closed - issue fixed for 2 weeks with no activity.