Skip to content
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

simpler markdown table generation #627

Merged
merged 9 commits into from
Aug 19, 2024
Merged

simpler markdown table generation #627

merged 9 commits into from
Aug 19, 2024

Conversation

pelikhan
Copy link
Member

@pelikhan pelikhan commented Aug 19, 2024

Fix for #618

  • 😀 The automating-scripts.mdx and pull-request-reviewer.mdx documents were slightly modified to change the git exclusion pattern for yarn.lock files. These changes only affect the files that these scripts consider.

  • 🚀 Trace-related changes were also made, notably, in docker.ts, a command trace is now fenced instead of being a simple item.

  • 🤖 A package called "markdown-table" was removed from package.json. This suggests that Markdown table handling is now done differently. The function CSVToMarkdown in csv.ts was re-written and no longer uses markdown-table.

  • ⚰️ The csv.test.ts file was wholly removed. This implies the CSV functionalities have been adequately covered elsewhere in the tests or it is no longer necessary.

  • 🧹 In expander.ts, values relating to temperature, top_p, max tokens, and seed were removed from tracing. This cuts down on unnecessary logged information.

  • 🔧 Several .js scripts under genaisrc were also tweaked, largely changing the git exclusion pattern for yarn.lock and THIRD_PARTY_LICENSES.md files.

  • 🚩 In pr-describe.genai.js, an additional argument . was added to the git diff command, this means the diff now considers the current directory more explicitly. Plus, the exclusion pattern for json config files was changed.

Please note that none of these changes affects the public API as defined in "packages/core/src/prompt_template.d.ts" and "packages/core/src/prompt_type.ts", therefore, these updates are not user-facing.

generated by pr-describe

// improves LLM performance
const mdcompact = md.replace(/[\t ]+/g, " ")
return mdcompact
return res.join("\n")

Choose a reason for hiding this comment

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

The new implementation of the CSVToMarkdown function does not properly escape the cell content. This can lead to incorrect markdown formatting if the cell content contains markdown special characters.

generated by pr-review-commit missing_escape

// improves LLM performance
const mdcompact = md.replace(/[\t ]+/g, " ")
return mdcompact
return res.join("\n")

Choose a reason for hiding this comment

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

The new implementation of the CSVToMarkdown function does not add a newline at the end of the generated markdown. This can cause issues when appending the generated markdown to other text.

generated by pr-review-commit missing_newline

@@ -41,21 +40,22 @@ export function CSVToMarkdown(csv: object[], options?: { headers?: string[] }) {
if (!csv?.length) return ""

Choose a reason for hiding this comment

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

The new implementation of the CSVToMarkdown function does not check if the csv parameter is null before accessing its length property. This can cause a runtime error if the function is called with a null argument.

generated by pr-review-commit missing_null_check

@pelikhan
Copy link
Member Author

/genai-describe

.replace(/>/g, "gt;")
.replace(/\r?\n/g, "<br>")
})
.join("|")}|`

Choose a reason for hiding this comment

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

The CSV parsing logic has been significantly changed. This includes changes to how headers are handled and how each row is processed. This could potentially introduce bugs or change the output format. Please ensure that these changes are thoroughly tested and that the new output format is as expected. 🧐

generated by pr-review-commit csv_parsing_change

@pelikhan
Copy link
Member Author

/genai-review

Copy link

The pull request seems to include several notable changes:

  1. 🛠️ Refactoring the CSVToMarkdown function in csv.ts. The function is now simplified and it no longer uses "markdown-table" library, instead creating the markdown table manually. This change should improve performance.

  2. ✨ Changing the trace item formatting in docker.ts seems to be a minor refactoring for better readability.

  3. 🔧 Removal of some trace items in expander.ts, which seems to be unnecessary or for cleaning up.

  4. 🔧 Modification in promptdom.ts to prevent CSVToMarkdown being called unnecessarily when the file content doesn't match a specific pattern. This should improve performance.

Overall, these changes look good from a functional standpoint. However, for the csv.ts change, it would be important to ensure that the new manual markdown table creation works as expected and handles edge cases correctly.

So, LGTM 🚀.

generated by pr-review

@pelikhan pelikhan merged commit 5a8b60d into main Aug 19, 2024
10 checks passed
@pelikhan pelikhan deleted the markdowntable branch August 19, 2024 18:44
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.

1 participant