rahulnyk / knowledge_graph

Convert any text to a graph of knowledge. This can be used for Graph Augmented Generation or Knowledge Graph based QnA
1.43k stars 280 forks source link

Json response load error #14

Open pradeepiisc opened 10 months ago

pradeepiisc commented 10 months ago

Hello, Thanks for the initiative to make this repo open source. I forked and tried with both zephyr and mistral model with my data. I keep getting the json load error

during the first call to

df_helpers.df2Graph(df, model)

ERROR ### Here is the buggy response:

I sense someone else also might have faced the issue. What is the issue ? how can I resolve this ?

rahulnyk commented 10 months ago

Hey Pradeep. Can you also post the buggy response here? Thanks

pradeepiisc commented 9 months ago

[ { "node_1": "XRS8547645", "node_2": "Razer", "edge": "Case was opened with a short description of Razer to learn // XRS8547645 C. This suggests that XRS8547645 and Razer are related, possibly as a product being transported by NBI Logistics for Toyota." }, { "node_1": "Vera Smith", "node_2": "Transport Coordinator", "edge": "Vera Smith is listed as the Transport Coordinator for NBI Logistics North America. This implies a relationship between Vera Smith and Transport Coordinator, likely indicating that she holds this position." }, { "node_1": "NorthBrook, IL", "node_2": "547 Stevens Creek Road", "edge": "Vera Smith's contact information includes an address at 547 Stevens Creek Road in NorthBrook, IL. This indicates a location-based relationship between these places." }, { "node_1": "Toyota", "node_2": "Purchasing", "edge": "The email from Laura Mcgrath at Toyota references Purchasing, implying a business or departmental relationship between Toyota and Purchasing." }, { "node_1": "Laura Mcgrath", "node_2": "Murray Howard", "edge": "Both Laura Mcgrath from Toyota and Murray Howard from LEAR are mentioned in the email, suggesting a possible relationship between these individuals." }, { "node_1": "Aristo.com", "node_2": "kgriffith@aristo.com", "edge": "Email addresses for Kenneth Griffith and csimon@aristo.com are included in the email, indicating a potential organizational relationship between Toyota, LEAR, and Aristo." }, { "node_1": "XRSTA5678", "node_2": "Supplier Name", "edge": "The email mentions XRSTA5678 as a Supplier No for Razer, highlighting a business relationship between Razer and this supplier." }, { "node_1": "Irvine", "node_2": "Supplier Address", "edge": "The email provides the address of the Razer supplier in Irvine, suggesting a geographic connection between these places." }, { "node_1": "US", "node_2": "Supplier Country", "edge": "Razer's supplier is located in the US, indicating a nationality-based relationship between Razer and this location." }, { "node_1": "Laura Mcgrath", "node_2": "Phone", "edge": "Laura Mcgrath's contact information includes a phone number, indicating a communication-based connection between herself and those attempting to reach her." ]

ERROR ### Here is the buggy response: [ { "node_1": "XRS8547645", "node_2": "Razer", "edge": "Case was opened with a short description of Razer to learn // XRS8547645 C. This suggests that XRS8547645 and Razer are related, possibly as a product being transported by NBI Logistics for Toyota." }, { "node_1": "Vera Smith", "node_2": "Transport Coordinator", "edge": "Vera Smith is listed as the Transport Coordinator for NBI Logistics North America. This implies a relationship between Vera Smith and Transport Coordinator, likely indicating that she holds this position." }, { "node_1": "NorthBrook, IL", "node_2": "547 Stevens Creek Road", "edge": "Vera Smith's contact information includes an address at 547 Stevens Creek Road in NorthBrook, IL. This indicates a location-based relationship between these places." }, { "node_1": "Toyota", "node_2": "Purchasing", "edge": "The email from Laura Mcgrath at Toyota references Purchasing, implying a business or departmental relationship between Toyota and Purchasing." }, { "node_1": "Laura Mcgrath", "node_2": "Murray Howard", "edge": "Both Laura Mcgrath from Toyota and Murray Howard from LEAR are mentioned in the email, suggesting a possible relationship between these individuals." }, { "node_1": "Aristo.com", "node_2": "kgriffith@aristo.com", "edge": "Email addresses for Kenneth Griffith and csimon@aristo.com are included in the email, indicating a potential organizational relationship between Toyota, LEAR, and Aristo." }, { "node_1": "XRSTA5678", "node_2": "Supplier Name", "edge": "The email mentions XRSTA5678 as a Supplier No for Razer, highlighting a business relationship between Razer and this supplier." }, { "node_1": "Irvine", "node_2": "Supplier Address", "edge": "The email provides the address of the Razer supplier in Irvine, suggesting a geographic connection between these places." }, { "node_1": "US", "node_2": "Supplier Country", "edge": "Razer's supplier is located in the US, indicating a nationality-based relationship between Razer and this location." }, { "node_1": "Laura Mcgrath", "node_2": "Phone", "edge": "Laura Mcgrath's contact information includes a phone number, indicating a communication-based connection between herself and those attempting to reach her." ]

pradeepiisc commented 9 months ago

I see the last object with node_1 as Laura Mcgrath and node_2 as Phone didn't close with a curly brace

{ "node_1": "Laura Mcgrath", "node_2": "Phone", "edge": "Laura Mcgrath's contact information includes a phone number, indicating a communication-based connection between herself and those attempting to reach her." **}** ]

If this is the reason, is the LLM generating a big response like this and forgetting to complete the syntax of json object ? Should we change anything in the system or user prompt ?

rahulnyk commented 9 months ago

Hi Pradeep. Would be better if we debug this on a zoom Sreemant share. Please dm on LinkedIn https://www.linkedin.com/in/rahulnyk

pradeepiisc commented 9 months ago

Rahul, I have sent you a request on Linkedin