1. Learn
  2. /
  3. Courses
  4. /
  5. Graph RAG with LangChain and Neo4j

Connected

Exercise

Extracting facts from conversation histories

Now to level-up your conversation history! You'll define pydantic classes for extracting facts from conversation histories in a structured way.

This will lay the brickwork for the next and final exercise of the course, where you'll actually perform the extraction.

The necessary pydantic classes have already been imported, and an llm has already been defined.

Instructions

100 XP
  • Define a pydantic ConversationFact class for extracting facts from a conversation; include object, subject, relationship, and session_id fields that match the descriptions provided.
  • Define a pydantic ConversationFacts class for creating lists of ConversationFact objects.
  • Bind the structured output format to the llm provided.