{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Neptune Open Cypher QA Chain\n",
    "This QA chain queries Neptune graph database using openCypher and returns human readable response\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langchain.graphs.neptune_graph import NeptuneGraph\n",
    "\n",
    "\n",
    "host = \"<neptune-host>\"\n",
    "port = 80\n",
    "use_https = False\n",
    "\n",
    "graph = NeptuneGraph(host=host, port=port, use_https=use_https)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langchain.chat_models import ChatOpenAI\n",
    "from langchain.chains.graph_qa.neptune_cypher import NeptuneOpenCypherQAChain\n",
    "\n",
    "llm = ChatOpenAI(temperature=0, model=\"gpt-4\")\n",
    "\n",
    "chain = NeptuneOpenCypherQAChain.from_llm(llm=llm, graph=graph)\n",
    "\n",
    "chain.run(\"how many outgoing routes does the Austin airport have?\")"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
