'PlayStation 5'}, {'p.name': 'Mac OS'}, {'p.name': 'Windows'}, {'p.name': 'Xbox Series X/S'}]> Finished chain.Baldur's Gate 3 is available on PlayStation 5, Mac OS, Windows, and Xbox Series X/S.response = chain.run("Is Baldur's Gate 3 available on Windows?")print(response)> Entering new GraphCypherQAChain chain...Generated Cypher:MATCH (:Game {name: 'Baldur\'s Gate 3'})-[:AVAILABLE_ON]->(:Platform {name: 'Windows'})RETURN trueFull Context:[{'true': True}]> Finished chain.Yes, Baldur's Gate 3 is available on Windows.Chain modifiers‚ÄãTo modify the behavior of your chain and obtain more context or additional information, you can modify the chain's parameters.Return direct query results‚ÄãThe return_direct modifier specifies whether to return the direct results of the executed Cypher query or the processed natural language response.# Return the result of querying the graph directlychain = GraphCypherQAChain.from_llm(    ChatOpenAI(temperature=0), graph=graph, verbose=True, return_direct=True)response = chain.run("Which studio published Baldur's Gate 3?")print(response)> Entering new GraphCypherQAChain chain...Generated Cypher:MATCH (:Game {name: 'Baldur\'s Gate 3'})-[:PUBLISHED_BY]->(p:Publisher)RETURN p.name> Finished chain.[{'p.name': 'Larian Studios'}]Return query intermediate steps‚ÄãThe return_intermediate_steps chain modifier enhances the returned response by including the intermediate steps of the query in addition to the initial query result.# Return all the intermediate steps of query executionchain = GraphCypherQAChain.from_llm(    ChatOpenAI(temperature=0), graph=graph, verbose=True, return_intermediate_steps=True)response = chain("Is Baldur's Gate 3 an Adventure game?")print(f"Intermediate steps: {response['intermediate_steps']}")print(f"Final response: {response['result']}")> Entering new GraphCypherQAChain chain...Generated Cypher:MATCH (g:Game {name: 'Baldur\'s Gate 3'})-[:HAS_GENRE]->(genre:Genre {name: 'Adventure'})RETURN g, genreFull Context:[{'g':
This notebook shows how to use LLMs to provide a natural language interface to a Memgraph database. To complete this tutorial, you will need Docker and Python 3.x installed.
This notebook shows how to use LLMs to provide a natural language interface to a Memgraph database. To complete this tutorial, you will need Docker and Python 3.x installed. ->: 'PlayStation 5'}, {'p.name': 'Mac OS'}, {'p.name': 'Windows'}, {'p.name': 'Xbox Series X/S'}]> Finished chain.Baldur's Gate 3 is available on PlayStation 5, Mac OS, Windows, and Xbox Series X/S.response = chain.run("Is Baldur's Gate 3 available on Windows?")print(response)> Entering new GraphCypherQAChain chain...Generated Cypher:MATCH (:Game {name: 'Baldur\'s Gate 3'})-[:AVAILABLE_ON]->(:Platform {name: 'Windows'})RETURN trueFull Context:[{'true': True}]> Finished chain.Yes, Baldur's Gate 3 is available on Windows.Chain modifiers‚ÄãTo modify the behavior of your chain and obtain more context or additional information, you can modify the chain's parameters.Return direct query results‚ÄãThe return_direct modifier specifies whether to return the direct results of the executed Cypher query or the processed natural language response.# Return the result of querying the graph directlychain = GraphCypherQAChain.from_llm(    ChatOpenAI(temperature=0), graph=graph, verbose=True, return_direct=True)response = chain.run("Which studio published Baldur's Gate 3?")print(response)> Entering new GraphCypherQAChain chain...Generated Cypher:MATCH (:Game {name: 'Baldur\'s Gate 3'})-[:PUBLISHED_BY]->(p:Publisher)RETURN p.name> Finished chain.[{'p.name': 'Larian Studios'}]Return query intermediate steps‚ÄãThe return_intermediate_steps chain modifier enhances the returned response by including the intermediate steps of the query in addition to the initial query result.# Return all the intermediate steps of query executionchain = GraphCypherQAChain.from_llm(    ChatOpenAI(temperature=0), graph=graph, verbose=True, return_intermediate_steps=True)response = chain("Is Baldur's Gate 3 an Adventure game?")print(f"Intermediate steps: {response['intermediate_steps']}")print(f"Final response: {response['result']}")> Entering new GraphCypherQAChain chain...Generated Cypher:MATCH (g:Game {name: 'Baldur\'s Gate 3'})-[:HAS_GENRE]->(genre:Genre {name: 'Adventure'})RETURN g, genreFull Context:[{'g':