Knowledge Graphs

Notes on knowledge graphs, RAG, and integrating them with LLMs for conversational applications.

Published May 8, 2024 ET

Basics

Names to know in AI

  • Stephen Wolfram - Founder of Wolfram Alpha, genius and AI/linguistic programming aficionado
  • Andrew Ng - Co-founder of Coursera
  • Daphne Koller - Co-founder of Coursera

Companies to know

Ed tech:

Knowledge Graphs for RAG (retrieval-augmented generation)

https://learn.deeplearning.ai/courses/knowledge-graphs-rag/lesson/1/introduction

Integrating Knowledge Graphs into LLM-based conversational applications

Neo4j

https://neo4j.com/developer-blog/context-aware-knowledge-graph-chatbot-with-gpt-4-and-neo4j/

General flow of application:

  1. User prompts
  2. Prompt is sent to GPT 4
  3. GPT-4 Generates a Cypher statement
  4. The Cypher statement is used to query the Knowledge Graph
  5. Use the results from the Knowledge Graph to query GPT 3 turbo
  6. GPT-3 Turbo generates natural language answer
  7. User receives answer

Interacting with a knowledge graph (KG)

A KG is effectively two tables:

  1. nodes (type, name, properties)
  2. edges (type, node A, node B, properties)

What is LangChain?

LangChain is meant to allow you to use multiple LLMs in your application. It's an open-source orchestration framework available in JavaScript and Python.

Main components:

  1. LLMs - single class with single interface for any LLM
  2. Prompts
  3. Chains - chaining prompts to LLMs
  4. Indexes - data sources (dropbox, airtable, filesystem, databases, vector databases)
  5. Memory - retain conversation history or summary
  6. Agents - use language model as reasoning engine

What is LangGraph

https://langchain-ai.github.io/langgraphjs/

Incorporating Embeddings

Learning Roadmaps

https://roadmap.sh/get-started