{})g.addEdge(    "ActedIn", "1:Al Pacino", "2:The Godfather Coda The Death of Michael Corleone", {})g.addEdge("ActedIn", "1:Robert De Niro", "2:The Godfather Part II", {})    1:Robert De Niro--ActedIn-->2:The Godfather Part IICreating HugeGraphQAChain‚ÄãWe can now create the HugeGraph and HugeGraphQAChain. To create the HugeGraph we simply need to pass the database object to the HugeGraph constructor.from langchain.chat_models import ChatOpenAIfrom langchain.chains import HugeGraphQAChainfrom langchain.graphs import HugeGraphgraph = HugeGraph(    username="admin",    password="admin",    address="localhost",    port=8080,    graph="hugegraph",)Refresh graph schema information‚ÄãIf the schema of database changes, you can refresh the schema information needed to generate Gremlin statements.# graph.refresh_schema()print(graph.get_schema)    Node properties: [name: Person, primary_keys: ['name'], properties: ['name', 'birthDate'], name: Movie, primary_keys: ['name'], properties: ['name']]    Edge properties: [name: ActedIn, properties: []]    Relationships: ['Person--ActedIn-->Movie']    Querying the graph‚ÄãWe can now use the graph Gremlin QA chain to ask question of the graphchain = HugeGraphQAChain.from_llm(ChatOpenAI(temperature=0), graph=graph, verbose=True)chain.run("Who played in The Godfather?")            > Entering new  chain...    Generated gremlin:    g.V().has('Movie', 'name', 'The Godfather').in('ActedIn').valueMap(true)    Full Context:    [{'id': '1:Al Pacino', 'label': 'Person', 'name': ['Al Pacino'], 'birthDate': ['1940-04-25']}]        > Finished chain.    'Al Pacino played in The Godfather.'PreviousFalkorDBQAChainNextKuzuQAChainCreating HugeGraphQAChainRefresh graph schema informationQuerying the graphCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
This notebook shows how to use LLMs to provide a natural language interface to HugeGraph database.
This notebook shows how to use LLMs to provide a natural language interface to HugeGraph database. ->: {})g.addEdge(    "ActedIn", "1:Al Pacino", "2:The Godfather Coda The Death of Michael Corleone", {})g.addEdge("ActedIn", "1:Robert De Niro", "2:The Godfather Part II", {})    1:Robert De Niro--ActedIn-->2:The Godfather Part IICreating HugeGraphQAChain‚ÄãWe can now create the HugeGraph and HugeGraphQAChain. To create the HugeGraph we simply need to pass the database object to the HugeGraph constructor.from langchain.chat_models import ChatOpenAIfrom langchain.chains import HugeGraphQAChainfrom langchain.graphs import HugeGraphgraph = HugeGraph(    username="admin",    password="admin",    address="localhost",    port=8080,    graph="hugegraph",)Refresh graph schema information‚ÄãIf the schema of database changes, you can refresh the schema information needed to generate Gremlin statements.# graph.refresh_schema()print(graph.get_schema)    Node properties: [name: Person, primary_keys: ['name'], properties: ['name', 'birthDate'], name: Movie, primary_keys: ['name'], properties: ['name']]    Edge properties: [name: ActedIn, properties: []]    Relationships: ['Person--ActedIn-->Movie']    Querying the graph‚ÄãWe can now use the graph Gremlin QA chain to ask question of the graphchain = HugeGraphQAChain.from_llm(ChatOpenAI(temperature=0), graph=graph, verbose=True)chain.run("Who played in The Godfather?")            > Entering new  chain...    Generated gremlin:    g.V().has('Movie', 'name', 'The Godfather').in('ActedIn').valueMap(true)    Full Context:    [{'id': '1:Al Pacino', 'label': 'Person', 'name': ['Al Pacino'], 'birthDate': ['1940-04-25']}]        > Finished chain.    'Al Pacino played in The Godfather.'PreviousFalkorDBQAChainNextKuzuQAChainCreating HugeGraphQAChainRefresh graph schema informationQuerying the graphCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.