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

JSONDecodeError using no_openai_key_at_all.py #75

Open
ericskh2 opened this issue Oct 11, 2024 · 1 comment
Open

JSONDecodeError using no_openai_key_at_all.py #75

ericskh2 opened this issue Oct 11, 2024 · 1 comment

Comments

@ericskh2
Copy link

Issue

Hello, I have a similar error with #57 using no_openai_key_at_all.py. I already used qwen2:ctx32k to replace qwen2. How could I fix this problem? Thanks.

Error

⠹ Processed 42 chunks, 276 entities(duplicated), 178 relations(duplicated)
INFO:nano-graphrag:Inserting 180 vectors to entities
Batches: 100%|███████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:03<00:00,  3.05s/it]
Batches: 100%|███████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:02<00:00,  2.90s/it]
Batches: 100%|███████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00,  1.36it/s]
Batches: 100%|███████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:01<00:00,  1.24s/it]
Batches: 100%|███████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00,  2.45it/s]
Batches: 100%|███████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00,  1.62it/s]
INFO:nano-graphrag:[Community Report]...
INFO:nano-graphrag:Each level has communities: {0: 9, 1: 9}
INFO:nano-graphrag:Generating by levels: [1, 0]
ERROR:nano-graphrag:Failed to parse JSON: {
    "title": "Fezziwig's Christmas Community",
    "summary": "The Fezziwig community comprises elements centered around Fezziwig as a successful business owner, Dick Wilkins as Scrooge's former apprentice, and events like Christmas Eve and Merry Christmas celebrating festive spirit. Fezziwig contrasts with Scrooge in generosity versus selfishness.",
    "rating": 5.0,
    "rating_explanation": "The community is moderately impactful due to its positive cultural contributions during the festive season, yet it also carries potential risks of highlighting contrasting values that may lead to societal discussions and internal conflicts.",
    "findings": [
        {
            "summary": "Fezziwig's Role in Community",
            "explanation": "Fezziwig acts as the central figure in this community, known for his generosity, hosting a lively Christmas party, running a bustling business, and actively participating in community events. This role fosters a festive atmosphere but also brings attention to Scrooge’s contrasting character.",
        },
        {
            "summary": "Dick Wilkins's Connection with Fezziwig",
            "explanation": "Dick Wilkins is linked to Fezziwig through their past relationship as Scrooge’s apprentice, suggesting both professional and personal connections within the community. This connection highlights Fezziwig's influence on others' lives.",
        },
        {
            "summary": "Merry Christmas Concept",
            "explanation": "The concept of Merry Christmas symbolizes festive spirit in this community. Its presence encourages joyous celebrations and goodwill, potentially influencing community dynamics positively but may also lead to discussions about contrasting values with Scrooge's character.",
        },
        {
            "summary": "Christmas Eve Celebrations",
            "explanation": "Christmas Eve is a significant event that brings together various aspects of the Fezziwig community. This celebration reflects unity and joy, contributing to the festive atmosphere but also may highlight differences in values when compared to Scrooge’s character.",
        },
        {
            "summary": "Scrooge's Impact on Community Perception",
            "explanation": "Fezziwig's contrast with Scrooge implies the potential for community discussions about differing cultural norms and personal values. This dynamic could influence perceptions of societal ideals versus individual behaviors, impacting community cohesion.",
        }
    ]
}
INFO:nano-graphrag:Writing graph with 219 nodes, 155 edges
Traceback (most recent call last):
  File "/research/d2/msc/khsew24/nano-graphrag/examples/no_openai_key_at_all.py", line 115, in <module>
    insert()
  File "/research/d2/msc/khsew24/nano-graphrag/examples/no_openai_key_at_all.py", line 108, in insert
    rag.insert(FAKE_TEXT)
  File "/research/d2/msc/khsew24/nano-graphrag/nano_graphrag/graphrag.py", line 207, in insert
    return loop.run_until_complete(self.ainsert(string_or_strings))
  File "/research/d2/msc/khsew24/conda_envs/nano-graphrag/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/research/d2/msc/khsew24/nano-graphrag/nano_graphrag/graphrag.py", line 311, in ainsert
    await generate_community_report(
  File "/research/d2/msc/khsew24/nano-graphrag/nano_graphrag/_op.py", line 650, in generate_community_report
    this_level_communities_reports = await asyncio.gather(
  File "/research/d2/msc/khsew24/nano-graphrag/nano_graphrag/_op.py", line 627, in _form_single_community_report
    data = use_string_json_convert_func(response)
  File "/research/d2/msc/khsew24/nano-graphrag/nano_graphrag/_utils.py", line 49, in convert_response_to_json
    raise e from None
  File "/research/d2/msc/khsew24/nano-graphrag/nano_graphrag/_utils.py", line 45, in convert_response_to_json
    data = json.loads(json_str)
  File "/research/d2/msc/khsew24/conda_envs/nano-graphrag/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/research/d2/msc/khsew24/conda_envs/nano-graphrag/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/research/d2/msc/khsew24/conda_envs/nano-graphrag/lib/python3.10/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 10 column 9 (char 1058)

@gusye1234
Copy link
Owner

It's caused by the LLM. Some models have troubles to stably output JSON。

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