BaşlayınÜcretsiz Başlayın

Generate a graph diagram

Now that you've demonstrated that the chatbot works to the school administration, you suggest generating a diagram explaining how the chatbot answers questions. You agree to create a LangGraph diagram that shows how the chatbot has been set up.

Image and display from IPython.display have been loaded for you. We've created a display_fallback() function to display a cached image in the event that the Mermaid API (the service used by LangGraph to create the plot) returns an error.

Bu egzersiz

Designing Agentic Systems with LangChain

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Within a try block, call the .get_graph() method on graph, followed by .draw_mermaid_png() to display the diagram.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Try generating and displaying the diagram of the graph
try:
    display(Image(graph.____().____()))

# Return an exception if the generation fails
except Exception:
    print("Plot generation failed... falling back to cached asset.")
    display_fallback()
Kodu Düzenle ve Çalıştır