llm2json icon indicating copy to clipboard operation
llm2json copied to clipboard

源码有误,运行不起来

Open imempty opened this issue 9 months ago • 0 comments

从第一行导入包就开始报错,“from llm2json.output.parser import JSONParser”

报错日志如下:

TypeError Traceback (most recent call last) Cell In[16], line 1 ----> 1 from llm2json.output.parser import JSONParser 3 from llm2json.prompts.schema import BaseModel, Field 5 class sell_point(BaseModel):

File /usr/local/python38/lib/python3.8/site-packages/llm2json/output/init.py:1 ----> 1 from .parser import JSONParser

File /usr/local/python38/lib/python3.8/site-packages/llm2json/output/parser.py:2 1 from json import JSONDecodeError, dumps ----> 2 from .utils import parse_json_markdown 4 class JSONParser(object): 5 """ 6 This function is a method of a class that takes a string as its input argument and aims to return a dictionary or JSON object. 7 It initially attempts to parse the input string into JSON format. If the parsing is successful, it returns the parsed dictionary. 8 However, if the parsing fails, it raises a ValueError exception, providing the reason for the JSON decoding error as part of the exception message. 9 """

File /usr/local/python38/lib/python3.8/site-packages/llm2json/output/utils.py:5 2 import json 3 from typing import Callable, Any ----> 5 def _replace_new_line(match: re.Match[str]) -> str: 6 value = match.group(2) 7 value = re.sub(r"\n", r"\n", value)

TypeError: 'type' object is not subscriptable

目测是源码存在问题,希望作者能解决下

imempty avatar May 27 '24 12:05 imempty