xoo-creative / flash-agent

AWS Lambda for Teaching LLM Agent for flash.
0 stars 0 forks source link

Fix markdown parsing of results #3

Open tommysteryy opened 8 months ago

tommysteryy commented 8 months ago

Description

A few common problems arise when generating content to show the user.

Since we generate a page with taipy.gui.Markdown, it needs to pass their strict parsing rules. So far, I have run into problems like:

Received from GPT

<more code> ...
if __name__ == __main__:
    csv_path = os.path.join(os.getcwd(), data.csv)
    execute_pipeline(my_pipeline, {solids: {read_csv: {inputs: {csv_path: csv_path}}}})

This results in a parsing error called: An Error occurred: SyntaxError: Unexpected token}. Did you mean}or{"}"}? (4:156)

Instead, what it's complaining about is that it can't have two } back to back, for some reason.

So it wants this:

<more code> ...
if __name__ == __main__:
    csv_path = os.path.join(os.getcwd(), data.csv)
    execute_pipeline(my_pipeline, {
        solids: {
            read_csv: {
                inputs: {
                    csv_path: csv_path,
                }
            }
        }
    })

This is preventing the service from being fully reliable since sometimes the markdown is valid, sometimes not.

Acceptance Criteria

Remove the problem of inconsistent markdown pages, and every time we generate, it always works.

Tasks

tommysteryy commented 7 months ago

Since this hasn't been observed a few tries in a row now, de-prioritizing this to be medium.