Fixed exports for NeptuneOpenCypherQAChain (#8439)

## Description
The imports for `NeptuneOpenCypherQAChain` are failing. This PR adds the
chain class to the `__init__.py` file to fix this issue.

## Maintainers
@dev2049 
@krlawrence
This commit is contained in:
Piyush Jain 2023-07-30 20:36:22 -07:00 committed by GitHub
parent e98e2b2b81
commit b2f8a5bae9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 6 deletions

View File

@ -10,11 +10,11 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 1,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"from langchain.graphs.neptune_graph import NeptuneGraph\n", "from langchain.graphs import NeptuneGraph\n",
"\n", "\n",
"\n", "\n",
"host = \"<neptune-host>\"\n", "host = \"<neptune-host>\"\n",
@ -26,12 +26,23 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 3,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"data": {
"text/plain": [
"'The Austin airport has 98 outgoing routes.'"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [ "source": [
"from langchain.chat_models import ChatOpenAI\n", "from langchain.chat_models import ChatOpenAI\n",
"from langchain.chains.graph_qa.neptune_cypher import NeptuneOpenCypherQAChain\n", "from langchain.chains import NeptuneOpenCypherQAChain\n",
"\n", "\n",
"llm = ChatOpenAI(temperature=0, model=\"gpt-4\")\n", "llm = ChatOpenAI(temperature=0, model=\"gpt-4\")\n",
"\n", "\n",
@ -42,8 +53,22 @@
} }
], ],
"metadata": { "metadata": {
"kernelspec": {
"display_name": ".venv",
"language": "python",
"name": "python3"
},
"language_info": { "language_info": {
"name": "python" "codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
}, },
"orig_nbformat": 4 "orig_nbformat": 4
}, },

View File

@ -34,6 +34,7 @@ from langchain.chains.graph_qa.cypher import GraphCypherQAChain
from langchain.chains.graph_qa.hugegraph import HugeGraphQAChain from langchain.chains.graph_qa.hugegraph import HugeGraphQAChain
from langchain.chains.graph_qa.kuzu import KuzuQAChain from langchain.chains.graph_qa.kuzu import KuzuQAChain
from langchain.chains.graph_qa.nebulagraph import NebulaGraphQAChain from langchain.chains.graph_qa.nebulagraph import NebulaGraphQAChain
from langchain.chains.graph_qa.neptune_cypher import NeptuneOpenCypherQAChain
from langchain.chains.graph_qa.sparql import GraphSparqlQAChain from langchain.chains.graph_qa.sparql import GraphSparqlQAChain
from langchain.chains.hyde.base import HypotheticalDocumentEmbedder from langchain.chains.hyde.base import HypotheticalDocumentEmbedder
from langchain.chains.llm import LLMChain from langchain.chains.llm import LLMChain
@ -101,6 +102,7 @@ __all__ = [
"MultiRouteChain", "MultiRouteChain",
"NatBotChain", "NatBotChain",
"NebulaGraphQAChain", "NebulaGraphQAChain",
"NeptuneOpenCypherQAChain",
"OpenAIModerationChain", "OpenAIModerationChain",
"OpenAPIEndpointChain", "OpenAPIEndpointChain",
"QAGenerationChain", "QAGenerationChain",

View File

@ -0,0 +1,2 @@
def test_import() -> None:
from langchain.chains import NeptuneOpenCypherQAChain # noqa: F401

View File

@ -0,0 +1,2 @@
def test_import() -> None:
from langchain.graphs import NeptuneGraph # noqa: F401