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

json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 18 column 9 (char 1830) #95

Open
wuhongsheng opened this issue Nov 8, 2024 · 1 comment

Comments

@wuhongsheng
Copy link

INFO:httpx:HTTP Request: POST http://127.0.0.1:11434/api/chat "HTTP/1.1 200 OK"
ERROR:nano-graphrag:Failed to parse JSON: {
"title": "Project Gutenberg and Literary Foundation",
"summary": "The community revolves around Project Gutenberg, an initiative focused on free distribution of electronic works. The literary foundation supports this initiative by providing necessary resources, explaining its purpose, status as a non-profit organization, tax exempt status, and location in Salt Lake City, Utah.",
"rating": 5.0,
"rating_explanation": "The impact severity rating is moderate due to the potential for influence on intellectual property rights and public access to knowledge.",
"findings": [
{
"summary": "Project Gutenberg's role as a central entity",
"explanation": "Project Gutenberg acts as the central entity within this community, focusing on providing free distribution of electronic works. Its core mission involves contributing to literature and making content accessible across various platforms. The Foundation supports Project Gutenberg by ensuring its resources are available for development."
},
{
"summary": "Foundation's explanation of its mission",
"explanation": "The Foundation's section explains the purpose, status as a non-profit organization, tax exempt status, and location in Salt Lake City, Utah. This detailed information helps clarify how the Foundation operates within the community and ensures that it complies with legal regulations."
},
{
"summary": "Section 2 providing mission information",
"explanation": "Section 2 of Project Gutenberg provides a comprehensive overview of its mission to contribute to literature through electronic works. This section serves as an essential resource for understanding Project Gutenberg's goals and contributions within the community.",
},
{
"summary": "Foundation supporting Section 3 Information",
"explanation": "The Foundation supports Section 3 by ensuring it accurately explains the status of being a non-profit organization, tax exempt status, and location in Salt Lake City. This support underscores the importance of accurate information dissemination for legal compliance and public trust."
},
{
"summary": "Interconnectedness between entities",
"explanation": "The interconnectedness between Project Gutenberg (e.g., its mission) and the Foundation is crucial as it illustrates how resources provided by the latter are utilized to support the former's objectives. This interconnection highlights a symbiotic relationship where both play pivotal roles in the success of the community."
}
]
}
INFO:nano-graphrag:Writing graph with 227 nodes, 204 edges
Traceback (most recent call last):
File "/Users/whs/PycharmProjects/nano-graphrag/examples/using_ollama_as_llm_and_embedding.py", line 124, in
insert()
File "/Users/whs/PycharmProjects/nano-graphrag/examples/using_ollama_as_llm_and_embedding.py", line 103, in insert
rag.insert(FAKE_TEXT)
File "/Users/whs/venv-metal/lib/python3.11/site-packages/nano_graphrag/graphrag.py", line 207, in insert
return loop.run_until_complete(self.ainsert(string_or_strings))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.10/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/whs/venv-metal/lib/python3.11/site-packages/nano_graphrag/graphrag.py", line 311, in ainsert
await generate_community_report(
File "/Users/whs/venv-metal/lib/python3.11/site-packages/nano_graphrag/_op.py", line 650, in generate_community_report
this_level_communities_reports = await asyncio.gather(
^^^^^^^^^^^^^^^^^^^^^
File "/Users/whs/venv-metal/lib/python3.11/site-packages/nano_graphrag/_op.py", line 627, in _form_single_community_report
data = use_string_json_convert_func(response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/whs/venv-metal/lib/python3.11/site-packages/nano_graphrag/_utils.py", line 49, in convert_response_to_json
raise e from None
File "/Users/whs/venv-metal/lib/python3.11/site-packages/nano_graphrag/_utils.py", line 45, in convert_response_to_json
data = json.loads(json_str)
^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.10/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/init.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.10/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.10/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 18 column 9 (char 1830)

@rangehow
Copy link
Collaborator

Not sure which version you are using, but I tested the json you provided here without any problem. From your trace back, it seems that you are using the deprecated json parsing method. TRY UPDATE REPO

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

2 participants