-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve CODE_BLOCK_PATTERN for a more robust code match #571
Conversation
@microsoft-github-policy-service agree |
Sorry about my late reply. I've added a |
Thanks. I will look into this ASAP. Ideally we should be more flexible, and should adopt the code block definition specified in markdown here: https://spec.commonmark.org/0.30/#fenced-code-blocks I'll look into this degree of compatibility tomorrow |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #571 +/- ##
===========================================
+ Coverage 29.81% 47.50% +17.69%
===========================================
Files 27 27
Lines 3448 3448
Branches 780 822 +42
===========================================
+ Hits 1028 1638 +610
+ Misses 2346 1649 -697
- Partials 74 161 +87
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
…pec). Added test cases for both.
@victordibia @sonichi Please have a look at this PR. It has been sitting for a while, and I think it's good to go. |
* improve CODE_BLOCK_PATTERN for more robust match * improve and add tests * Add support for \r\n * Updated the regex to support indented code blocks (per the Markdown spec). Added test cases for both. * Update formatting --------- Co-authored-by: Adam Fourney <[email protected]> Co-authored-by: Chi Wang <[email protected]>
Why are these changes needed?
In the output of
agent_human_feedback.ipynb
, I notice that agent's code was not extracted correctly at line 69.exitcode: 1 (execution failed) Code output: File "", line 2 Step 2: Define the equations ^ SyntaxError: invalid syntax
That's because there is a space character before
python
.Which means
``` python
cannot be parsed.What's more, redundant spaces after language name also cannot be parsed,
```python
for example.Related issue number
Checks