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

I hope the official can release a software package for Markdown parsing #880

Closed
1 task done
makeryangcom opened this issue Jun 5, 2024 · 4 comments
Closed
1 task done

Comments

@makeryangcom
Copy link

Confirm this is a feature request for the Node library and not the underlying OpenAI API.

  • This is a feature request for the Node library

Describe the feature or improvement you're requesting

With the updates and iterations of ChatGPT, the Markdown information returned via API has become increasingly rich. Previous parsing libraries such as markdown-it and markdown-it-kbd are not able to parse all the information content effectively, which makes the user experience very poor. I hope that the official can upgrade openai-nodeto include support for Markdown parsing. This would be a very meaningful improvement.

Additional context

No response

@meorphis
Copy link
Contributor

meorphis commented Jun 7, 2024

Thanks for reporting @makeryangcom. I'll route this one to the relevant team to track as a feature request.

@rattrayalex
Copy link
Collaborator

This is not something we plan to do.

@rattrayalex rattrayalex closed this as not planned Won't fix, can't repro, duplicate, stale Jul 8, 2024
@rattrayalex
Copy link
Collaborator

If there is markdown content returned from OpenAI which is not successfully parsed by markdown-it, you are welcome to share that in the OpenAI community forum.

@makeryangcom
Copy link
Author

makeryangcom commented Jul 9, 2024

If there is markdown content returned from OpenAI which is not successfully parsed by markdown-it, you are welcome to share that in the OpenAI community forum.

@rattrayalex

Thank you for your response, but I'm afraid that currently, using only markdown-it cannot adequately visualize special information such as mathematics. Even with all the extensions of markdown-it, the mathematical formulas returned by the ChatGPT API are not in a standard format.

The following program was running fine earlier this year.

import MarkdownIt from "markdown-it";
import mdKatex from "@vscode/markdown-it-katex";
import mdKbd from "markdown-it-kbd";
import mdHighlight from "markdown-it-highlightjs";
function onMarkdown(content: any){
          const markdown = MarkdownIt();
          markdown.use(mdKatex);
          markdown.use(mdKbd);
          markdown.use(mdHighlight);
          markdown.use(codePlugin);
          markdown.use(imagePlugin);
          return markdown.render(content, {});
}

I must include the following prompt in all conversations for the ChatGPT API to return markdown-it parseable format correctly.

When dealing with mathematical formulas, please use $...$ to enclose the formula, not [...].

Here's an incorrect example of a conversation.

123_20240709083630

Sure! Here's a step-by-step guide using LaTeX to construct a matrix and solve for eigenvalues and eigenvectors:

1. Construct the matrix:
Let's create a 2x2 matrix as an example:
\[ A = \begin{pmatrix} 2 & 1 \\ 1 & 3 \end{pmatrix} \]

2. Find the characteristic equation:
The characteristic equation is given by:
\[ \text{det}(A - \lambda I) = 0 \]
Substitute A into the equation:
\[ \text{det}\left( \begin{pmatrix} 2 & 1 \\ 1 & 3 \end{pmatrix} - \lambda \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} \right) = 0 \]

3. Solve for eigenvalues:
Expand the determinant and solve for λ:
\[ \text{det}\left( \begin{pmatrix} 2-\lambda & 1 \\ 1 & 3-\lambda \end{pmatrix} \right) = 0 \]
\[ (2-\lambda)(3-\lambda) - 1 = 0 \]
\[ \lambda^2 - 5\lambda + 5 = 0 \]
\[ \lambda = \frac{5 \pm \sqrt{5}}{2} \]

4. Solve for eigenvectors:
Substitute the eigenvalues back into (A - λI)x = 0 and solve for x. For each eigenvalue, you will get a corresponding eigenvector.

I hope this helps you in constructing a matrix and solving for eigenvalues and eigenvectors using LaTeX! Let me know if you need further assistance.

The above markdown content cannot be correctly parsed in standard markdown-it. I raised this issue in the community a while ago, and they suggested I ask here. Many adults in the community have raised this issue, and currently, most solutions used are rather rough and temporary.

If you don't think it's necessary to optimize this area, at the very least, ensure that the format of API responses is correct and standard. It should at least be compatible with mainstream open-source components because these are commonly used by developers. After all, the API is paid for, and developers are investing money. As official maintainers of the OpenAI repository, you should strive to better maintain this repository for the benefit of developers.

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

No branches or pull requests

3 participants