lark-parser / lark

Lark is a parsing toolkit for Python, built with a focus on ergonomics, performance and modularity.
MIT License
4.76k stars 402 forks source link

Error in parsing datetime strings #1442

Closed MohammedShokr closed 3 weeks ago

MohammedShokr commented 1 month ago

I am using Langchain's StructuredQueryOutputParser which uses lark parser under the hood, when the comparison value is datetime string like this '2024-08-06T10:30:00Z' it throws an exception like this


langchain_core.exceptions.OutputParserException: Parsing text
`json
{
    "query": "What were the meetings of myounis myounis on August 6, 2024, at 07:30 UTC?",
    "filter": "and(eq('start_date_time', '2024-08-06T07:30:00Z'), in('attendees', 'myounis myounis'))"
}
`
 raised following error:
Unexpected token Token('CNAME', 'T07') at line 1, column 38.
Expected one of: 
        * COMMA
        * RPAR
Previous tokens: [Token('DATE', "'2024-08-06")```
How can I resolve this?
erezsh commented 1 month ago

Shouldn't you open this issue in Langchain? I don't think it's a bug in Lark.