Open sundaraa-deshaw opened 10 months ago
This happens with %ai cell magic command output as well
I guess the Python comments "#" are treated as markdown headers and rendered. Is there a way to fix this by configuring the model provider? I am using the BaseChatModel here.
@sundaraa-deshaw Sorry for the delay in responding to this! Typically, we expect language models to respond with code enclosed in triple backticks (``) on lines by themselves, perhaps with a language indicator on the first line (for example,
python` after the triple backtick).
Is your custom model providing code blocks surrounded with triple backticks? If not, Jupyter AI won't be able to differentiate between Python code, where # foo
indicates a comment, and Markdown, where # foo
indicates a heading.
Description
I am using the jupyter ai extension with a custom model provider as per steps in https://jupyter-ai.readthedocs.io/en/latest/users/index.html#custom-model-providers
I have not modified the output format in the custom model provider, the provider looks like this:
Reproduce
Actual response:
Once I clear the bot history, change model and revert the model back to the custom model, the formatting looks correct (which should be the ideal expected output). Now:
Expected behavior
Output format to look like:
Context
Generated prompt for the correct rendering
Generated prompt for the incorrect rendering
As we can see, "```" is missing around the code snippet in the response rendered in the second prompt.
Is this expected?