Convert Any Text into a Knowledge Graph

Поділитися
Вставка
  • Опубліковано 22 січ 2025

КОМЕНТАРІ • 67

  • @SridharKumarKannam
    @SridharKumarKannam  5 місяців тому +1

    If you found this content useful, pleases consider sharing it with others who might benefit. Your support is greatly appreciated :)

  • @lordshifu
    @lordshifu 17 днів тому +2

    this is useful but Sir, too many library functions being used can you create a tutorial to do all this from scratch?! using only numpy pandas and document loaders and reader. D2Gf and all those just obscures the maths and science behind how the knowledge graph is made

  • @pavanpraneeth4659
    @pavanpraneeth4659 10 місяців тому

    can u share here the previous video link where we have explicit relation and built a knowledge graph

  • @kundeyrajesh9506
    @kundeyrajesh9506 10 місяців тому +1

    Can we also create Knowledge graph for Time series data?

    • @SridharKumarKannam
      @SridharKumarKannam  10 місяців тому

      Thanks for the suggestion, using KGs we represent entities and the relationships between them. For a time series data we don't have such a thing. Pls see - stackoverflow.com/questions/71780910/knowledge-graph-for-time-series-data

  • @premmanu6557
    @premmanu6557 3 місяці тому

    Can we create knowledge graph for tabular data. Data stored in database

    • @SridharKumarKannam
      @SridharKumarKannam  3 місяці тому

      Yes you can, provided there are some relationships in the data, for example, employee data which can relations like "reports to", "managed by", "employee of" etc.

  • @Sriyaa-p8o
    @Sriyaa-p8o 6 місяців тому +1

    sir, i tried running the code in the way shown by you, but in google colab it's saying ollama.client is not being able to be imported error, i tried to use chatgpt but it is unable to rectify it. how can i modify this code using my own dataset and is it going to work in google colab

    • @SridharKumarKannam
      @SridharKumarKannam  6 місяців тому

      whats the error? Can you pls share your colab notebook?

    • @Sriyaa-p8o
      @Sriyaa-p8o 6 місяців тому

      @@SridharKumarKannam sure sir, could you send your gmail, ill forward it to you

    • @Sriyaa-p8o
      @Sriyaa-p8o 6 місяців тому

      @@SridharKumarKannam sure sir, can you please send your email, ill forward it to you

  • @ZochSong
    @ZochSong 8 місяців тому +1

    sir, when running the "res = extractConcepts(prompt = pages[0].page_content)",
    an error occurred that "Max retries exceeded with url: /api/generate".
    Can you help me pls

    • @SridharKumarKannam
      @SridharKumarKannam  7 місяців тому

      Pls check/increase your openAI rate limits or use open source llms using ollama.

  • @BlueDattebayo
    @BlueDattebayo 6 місяців тому

    Hi there! I'm having some troubles at the part before calculating contextual proximity:
    "ConnectError: [WinError 10061] No connection could be made because the target machine actively refused it"
    Do I have to open ollama client (on my local machine) before running the code?
    Also there were quite a number of tweaks I had to make to the code before it could run, is that typical from your experiences?
    Some examples of these changes are:
    helpers.df_helpers -> df_helpers
    .prompts -> prompts
    model_name -> model (mistral-openocra)
    etc.
    I'd imagine this might be due to my file management within Jupyter itself? But when I create a folder within the folder, it seems to not be able to find or extract the file. So I've positioned it into the same main folder.
    Looking forward to hearing from you! Thank you so much in advance for your time and informative video.

    • @SridharKumarKannam
      @SridharKumarKannam  6 місяців тому

      >> Do I have to open ollama client (on my local machine) before running the code?
      Yes
      >> Also there were quite a number of tweaks I had to make to the code before it could run, is that typical from your experiences?
      Yes, thats my experience too, these libraries are new and being developed actively by many. The APIs have been keep changing.
      It hard to say whats going on without running the code myself. I'm sure you will be able to fix all the issues one by one, it takes some time, but same with me too. All the best

  • @andydataguy
    @andydataguy 9 місяців тому +2

    Great video! Thank you for patiently explaining this so deeply

  • @writtenkannadalyrics
    @writtenkannadalyrics 5 місяців тому

    Hey! What's the python package to use helpers library.

    • @SridharKumarKannam
      @SridharKumarKannam  5 місяців тому

      Those helper functions are in the same codebase - github.com/rahulnyk/knowledge_graph/tree/main/helpers
      If you found this content helpful, please consider sharing it with others who might benefit. Your support is greatly appreciated :)

  • @forumpost8118
    @forumpost8118 9 місяців тому +1

    Hi, thanks so much for putting this video. It is great. I see you three videos for same thing - text to Graph.. one is this, second one using langchain and third one using libraries similar to this. what are high level differences between the three videos and which approach would you recommend if the scale is more?

    • @SridharKumarKannam
      @SridharKumarKannam  9 місяців тому

      the main difference is control over what entities and relationships you want in your model. You can start with open ended or unbounded schema, but eventually want to refine it to have only the desirable entities and relationships

  • @deathdefier45
    @deathdefier45 10 місяців тому +1

    Thank you so much for this ❤

    • @SridharKumarKannam
      @SridharKumarKannam  10 місяців тому +1

      Thanks for your support. Pls share with your friends :)

  • @Ankitist
    @Ankitist 10 місяців тому +1

    Can you also cover how we can add this to neo4j and run query on that data.

    • @SridharKumarKannam
      @SridharKumarKannam  10 місяців тому

      I've a couple of videos on adding such nodes/relationships to neo4j. Pls check - ua-cam.com/video/sK61Y22wvr8/v-deo.html

  • @JavierHernandez-xo5nb
    @JavierHernandez-xo5nb 4 місяці тому

    Great video mate. You save me a lot of time......🚀🚀🚀🚀🚀🚀🚀

    • @SridharKumarKannam
      @SridharKumarKannam  4 місяці тому

      If you found this content helpful, please consider sharing it with others who might benefit. Your support is greatly appreciated :)

  • @yazeedmohammed7715
    @yazeedmohammed7715 8 місяців тому +2

    first, thank you for the video, second, i tried to use the code but it seems i have problem with ollama, i installed it but i get no model named ollama.client, is there any way to fix it?

    • @SridharKumarKannam
      @SridharKumarKannam  7 місяців тому

      Are you able to fix the issue, otherwise, pls let me know, I'll help...

    • @sofiakindstrom
      @sofiakindstrom 4 місяці тому

      @@SridharKumarKannam I have the same problem. Is there a way to fix it? Im working on a Mac. Btw, super useful video!:D

    • @sofiakindstrom
      @sofiakindstrom 4 місяці тому +1

      @@SridharKumarKannam Nvm, Im stupid! Have a nice day:D

  • @pavankalyanc6677
    @pavankalyanc6677 3 місяці тому

    I have xml file and i want to generate data lineage graph.. is it possible. If yes suggest me some tips

    • @SridharKumarKannam
      @SridharKumarKannam  3 місяці тому

      no this is not creating lineage graphs. You can use something like this...
      lineage.xml
      ----------






      ------------------
      Python code:
      import xml.etree.ElementTree as ET
      import networkx as nx
      import matplotlib.pyplot as plt
      # Step 1: Parse the XML File
      def parse_xml(file):
      tree = ET.parse(file)
      root = tree.getroot()
      return root
      # Step 2: Extract nodes and edges from the XML
      def extract_nodes_edges(root):
      nodes = []
      edges = []
      for node in root.find('nodes').findall('node'):
      node_id = node.get('id')
      node_name = node.get('name')
      nodes.append((node_id, node_name))
      for edge in root.find('edges').findall('edge'):
      source = edge.get('source')
      target = edge.get('target')
      edges.append((source, target))
      return nodes, edges
      # Step 3: Create and visualize the lineage graph
      def create_lineage_graph(nodes, edges):
      G = nx.DiGraph() # Create a directed graph
      # Add nodes to the graph
      for node_id, node_name in nodes:
      G.add_node(node_id, label=node_name)
      # Add edges to the graph
      for source, target in edges:
      G.add_edge(source, target)
      # Step 4: Customize graph layout and labels
      pos = nx.spring_layout(G)
      labels = nx.get_node_attributes(G, 'label')
      # Draw the graph with labels
      nx.draw(G, pos, labels=labels, with_labels=True, node_color='lightblue', font_size=10, font_weight='bold')
      # Step 5: Show the graph
      plt.show()
      # Main function to execute the script
      if __name__ == "__main__":
      # Load and parse the XML file
      root = parse_xml('/Users/sridharkannam/Downloads/lineage.xml')
      # Extract nodes and edges
      nodes, edges = extract_nodes_edges(root)
      # Create and visualize the lineage graph
      create_lineage_graph(nodes, edges)

    • @pavankalyanc6677
      @pavankalyanc6677 3 місяці тому +1

      @@SridharKumarKannam Thanks

  • @killerdrama5521
    @killerdrama5521 10 місяців тому

    How can we do this for Wikipedia content. Where we need each every possible mode and relationship type between nodes.

    • @SridharKumarKannam
      @SridharKumarKannam  10 місяців тому +1

      As I mentioned, broadly we have 2 methods, one is open ended where by default LLM extract all nodes and relationship, if it misses any, you can guide the LLM using the prompt. In the 2nd method, you can explicitly define all types of nodes and relationships you want to extract.

    • @killerdrama5521
      @killerdrama5521 10 місяців тому

      @@SridharKumarKannam when can we have next part of the vedio. Actually we are trying to identify nodes relationships and then ontology or knowledge graph based on that. What approach can help us better here. Is there any other generative models which can identify entities and relationships and their properties

  • @ronass-sm9sv
    @ronass-sm9sv 10 місяців тому

    I would like to build a taxonomy of skills and an ontology of skills, can I use the same process you used ?

    • @SridharKumarKannam
      @SridharKumarKannam  9 місяців тому

      Pls check this video - ua-cam.com/video/sK61Y22wvr8/v-deo.html I've a few other videos on defining the entities and relationships, taxonomy, pls check...

  • @chandrasekharsubramanyam9386
    @chandrasekharsubramanyam9386 4 місяці тому

    Great Video on Text to Knowledge Graph. Can you please tell me how to add context extracted from Knowledge Graph to Retrieval Augmented Generation to get a better response fromLLM

    • @SridharKumarKannam
      @SridharKumarKannam  4 місяці тому

      Pls look at GraphRAG or combining Graphs with RAG. I've a number of video on this topic.
      If you found this content helpful, please consider sharing it with others who might benefit. Your support is greatly appreciated :)

  • @chrisogonas
    @chrisogonas 9 місяців тому

    Thanks for putting this together. 👍🏾

  • @pavanpraneeth4659
    @pavanpraneeth4659 10 місяців тому

    awesome video

  • @adawiaananda7353
    @adawiaananda7353 3 місяці тому

    hello sir, is this completely free to use or is there any API key or anything else that I need to purchase? thanks for the video!

    • @SridharKumarKannam
      @SridharKumarKannam  3 місяці тому

      you need a language model (LLM) for this. You can get free API from OpenAI, Groq, HuggingFace etc or run the LLM locally using Ollama, vLLM, etc.

  • @AnjanaVMurthy
    @AnjanaVMurthy 3 місяці тому

    Thanks for the video! Can you share the exact source code you have used in the video, I'm not able to find the exact source code in the github link you have provided.

    • @SridharKumarKannam
      @SridharKumarKannam  3 місяці тому

      Check this - github.com/rahulnyk/knowledge_graph/blob/main/extract_graph.ipynb

  • @bitcoinboss5856
    @bitcoinboss5856 3 місяці тому

    great video brother thanks a lot, can you do a video chat with graphdb just like others doing chat with sql

  • @user-he1nx1rn4m
    @user-he1nx1rn4m 10 місяців тому

    Are you using neo4j for the graph? If so how can i access it from neo4j Database

    • @SridharKumarKannam
      @SridharKumarKannam  10 місяців тому

      In this video, I've used networkx not neo4j. Once you have the nodes and relationships exacted, you can load them any graph DB of your choice...

  • @saurabhmukherjee9757
    @saurabhmukherjee9757 4 місяці тому

    Nice sir, ❤

    • @SridharKumarKannam
      @SridharKumarKannam  4 місяці тому

      Thank you.
      If you found this content helpful, please consider sharing it with others who might benefit. Your support is greatly appreciated :)

  • @suryaankam7856
    @suryaankam7856 10 місяців тому

    Thank you🙏

  • @iham1313
    @iham1313 6 місяців тому +1

    most common format for text: pdf. txt and md are already “easy” to build a graph…

  • @ScottzPlaylists
    @ScottzPlaylists 8 місяців тому +1

    4 points: ❗❗❗❗
    1 = The wording of the edge descriptions seems to be different than the short edge descriptions I've seen in the past. 👎
    2 = The edge descriptions also seems to repeat the words used in node1 or node2. 👎
    3 = I wish the examples used some text that could be broken down in to factual statements and relations like a description of a Github project, or Documentation, or textbook style text. 👎
    4 = I hate sports and the example edge descriptions just seem stupid and useless. 👎

    • @SridharKumarKannam
      @SridharKumarKannam  7 місяців тому

      these are meant for quickly getting started and learning. Thanks for your support

  • @sunilsamson6220
    @sunilsamson6220 10 місяців тому

    How can I use this .html as LLamaIndex KnowledgeGraphIndex?

    • @SridharKumarKannam
      @SridharKumarKannam  10 місяців тому

      Simple Directory Reader should read all docs including html in the folder - docs.llamaindex.ai/en/stable/examples/data_connectors/simple_directory_reader.html