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

Validating Cypher queries

When the LLMs generate the Cypher query, they have the graph schema available for reference; however, this doesn't mean there's absolute certainty that the query will reflect the schema perfectly. To improve reliability, you can validate and fix the generated query against the schema, which is particularly well-suited to fixing incorrect relationship directions.

Bu egzersiz

Retrieval Augmented Generation (RAG) with LangChain

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

Egzersiz talimatları

  • Create a graph QA chain that queries the graph database, including an additional check to validate the generated Cypher query; an llm has been defined for you and you should set verbose=True.
  • Invoke the graph_qa_chain with the input provided.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Create the graph QA chain, validating the generated Cypher query
graph_qa_chain = ____

# Invoke the chain with the input provided
result = ____({"query": "Who won the Nobel Prize In Physics?"})
print(f"Final answer: {result['result']}")
Kodu Düzenle ve Çalıştır