Skip to content

Commit

Permalink
Merge branch 'master' into cc/docs_tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
ccurme committed Nov 26, 2024
2 parents 091bde4 + aa2c17b commit 195d64c
Show file tree
Hide file tree
Showing 29 changed files with 1,451 additions and 560 deletions.
4 changes: 2 additions & 2 deletions docs/docs/how_to/graph_constructing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
}
],
"source": [
"%pip install --upgrade --quiet langchain langchain-community langchain-openai langchain-experimental neo4j"
"%pip install --upgrade --quiet langchain langchain-neo4j langchain-openai langchain-experimental neo4j"
]
},
{
Expand Down Expand Up @@ -102,7 +102,7 @@
"source": [
"import os\n",
"\n",
"from langchain_community.graphs import Neo4jGraph\n",
"from langchain_neo4j import Neo4jGraph\n",
"\n",
"os.environ[\"NEO4J_URI\"] = \"bolt://localhost:7687\"\n",
"os.environ[\"NEO4J_USERNAME\"] = \"neo4j\"\n",
Expand Down
7 changes: 4 additions & 3 deletions docs/docs/how_to/graph_mapping.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install --upgrade --quiet langchain langchain-community langchain-openai neo4j"
"%pip install --upgrade --quiet langchain langchain-neo4j langchain-openai neo4j"
]
},
{
Expand Down Expand Up @@ -116,7 +116,7 @@
}
],
"source": [
"from langchain_community.graphs import Neo4jGraph\n",
"from langchain_neo4j import Neo4jGraph\n",
"\n",
"graph = Neo4jGraph()\n",
"\n",
Expand Down Expand Up @@ -364,11 +364,12 @@
"metadata": {},
"outputs": [],
"source": [
"from langchain_community.chains.graph_qa.cypher_utils import (\n",
"from langchain_neo4j.chains.graph_qa.cypher_utils import (\n",
" CypherQueryCorrector,\n",
" Schema,\n",
")\n",
"\n",
"graph.refresh_schema()\n",
"# Cypher validation tool for relationship directions\n",
"corrector_schema = [\n",
" Schema(el[\"start\"], el[\"type\"], el[\"end\"])\n",
Expand Down
20 changes: 14 additions & 6 deletions docs/docs/how_to/graph_prompting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
}
],
"source": [
"%pip install --upgrade --quiet langchain langchain-community langchain-openai neo4j"
"%pip install --upgrade --quiet langchain langchain-neo4j langchain-openai neo4j"
]
},
{
Expand Down Expand Up @@ -113,7 +113,7 @@
}
],
"source": [
"from langchain_community.graphs import Neo4jGraph\n",
"from langchain_neo4j import Neo4jGraph\n",
"\n",
"graph = Neo4jGraph()\n",
"\n",
Expand Down Expand Up @@ -188,12 +188,16 @@
"metadata": {},
"outputs": [],
"source": [
"from langchain.chains import GraphCypherQAChain\n",
"from langchain_neo4j import GraphCypherQAChain\n",
"from langchain_openai import ChatOpenAI\n",
"\n",
"llm = ChatOpenAI(model=\"gpt-3.5-turbo\", temperature=0)\n",
"chain = GraphCypherQAChain.from_llm(\n",
" graph=graph, llm=llm, exclude_types=[\"Genre\"], verbose=True\n",
" graph=graph,\n",
" llm=llm,\n",
" exclude_types=[\"Genre\"],\n",
" verbose=True,\n",
" allow_dangerous_requests=True,\n",
")"
]
},
Expand Down Expand Up @@ -356,8 +360,8 @@
"metadata": {},
"outputs": [],
"source": [
"from langchain_community.vectorstores import Neo4jVector\n",
"from langchain_core.example_selectors import SemanticSimilarityExampleSelector\n",
"from langchain_neo4j import Neo4jVector\n",
"from langchain_openai import OpenAIEmbeddings\n",
"\n",
"example_selector = SemanticSimilarityExampleSelector.from_examples(\n",
Expand Down Expand Up @@ -468,7 +472,11 @@
"source": [
"llm = ChatOpenAI(model=\"gpt-3.5-turbo\", temperature=0)\n",
"chain = GraphCypherQAChain.from_llm(\n",
" graph=graph, llm=llm, cypher_prompt=prompt, verbose=True\n",
" graph=graph,\n",
" llm=llm,\n",
" cypher_prompt=prompt,\n",
" verbose=True,\n",
" allow_dangerous_requests=True,\n",
")"
]
},
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/how_to/graph_semantic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
}
],
"source": [
"%pip install --upgrade --quiet langchain langchain-community langchain-openai neo4j"
"%pip install --upgrade --quiet langchain langchain-neo4j langchain-openai neo4j"
]
},
{
Expand Down Expand Up @@ -127,7 +127,7 @@
}
],
"source": [
"from langchain_community.graphs import Neo4jGraph\n",
"from langchain_neo4j import Neo4jGraph\n",
"\n",
"graph = Neo4jGraph()\n",
"\n",
Expand Down Expand Up @@ -242,8 +242,8 @@
"\n",
"\n",
"class InformationTool(BaseTool):\n",
" name = \"Information\"\n",
" description = (\n",
" name: str = \"Information\"\n",
" description: str = (\n",
" \"useful for when you need to answer questions about various actors or movies\"\n",
" )\n",
" args_schema: Type[BaseModel] = InformationInput\n",
Expand Down
Loading

0 comments on commit 195d64c

Please sign in to comment.