wey-gu / demo-kg-build

demo app for Knowledge Graph Build with LLM LlamaIndex and NebulaGraph
Apache License 2.0
48 stars 39 forks source link

Keywords Extraction #1

Open Gyamfi2 opened 8 months ago

Gyamfi2 commented 8 months ago

How do I extract the keywords from the query and chat engine from the knowledge graph index so that I use it to query my nebula graph on the streamlit app. For the query, I realized you used it did the assignment related_entities = list(list(response.metadata.values())[0]["kg_rel_map"].keys()) but the output format does not make the nebula graph query "f"MATCH p=(n)-[*1..2]-() \n WHERE id(n) IN {related_entities} \nRETURN p"" produce the intended results for the graph. It gives empty graph because related_entities format isn't recognized entity. Example, i mostly obtain the entity format like ['NLP{name: NLP}'] instead of ['NLP'] and like this ['NLP{name: NLP}', 'Language{name: Language}'] instead of ['NLP', 'Language']. Is there way you can assist me resolve this? Again, is there any way to get the extracted keywords for the chat engine too? I understand that when verbose=True, the intermediate results like extraced keywords are obtained. I'm curious, is there any way to extract the key words directly?

bhaskatripathi commented 6 days ago

can I run it if I do not have Azure Open AI engpoint? What to do in case of pure Open AI calls? Does it requires a lot of change?