mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-24 15:43:54 +00:00
Docs: Change to async llm graph transformer (#31126)
This commit is contained in:
parent
703fce7972
commit
6b6750967a
@ -167,7 +167,7 @@
|
|||||||
"She was, in 1906, the first woman to become a professor at the University of Paris.\n",
|
"She was, in 1906, the first woman to become a professor at the University of Paris.\n",
|
||||||
"\"\"\"\n",
|
"\"\"\"\n",
|
||||||
"documents = [Document(page_content=text)]\n",
|
"documents = [Document(page_content=text)]\n",
|
||||||
"graph_documents = llm_transformer.convert_to_graph_documents(documents)\n",
|
"graph_documents = await llm_transformer.aconvert_to_graph_documents(documents)\n",
|
||||||
"print(f\"Nodes:{graph_documents[0].nodes}\")\n",
|
"print(f\"Nodes:{graph_documents[0].nodes}\")\n",
|
||||||
"print(f\"Relationships:{graph_documents[0].relationships}\")"
|
"print(f\"Relationships:{graph_documents[0].relationships}\")"
|
||||||
]
|
]
|
||||||
@ -205,7 +205,7 @@
|
|||||||
" allowed_nodes=[\"Person\", \"Country\", \"Organization\"],\n",
|
" allowed_nodes=[\"Person\", \"Country\", \"Organization\"],\n",
|
||||||
" allowed_relationships=[\"NATIONALITY\", \"LOCATED_IN\", \"WORKED_AT\", \"SPOUSE\"],\n",
|
" allowed_relationships=[\"NATIONALITY\", \"LOCATED_IN\", \"WORKED_AT\", \"SPOUSE\"],\n",
|
||||||
")\n",
|
")\n",
|
||||||
"graph_documents_filtered = llm_transformer_filtered.convert_to_graph_documents(\n",
|
"graph_documents_filtered = await llm_transformer_filtered.aconvert_to_graph_documents(\n",
|
||||||
" documents\n",
|
" documents\n",
|
||||||
")\n",
|
")\n",
|
||||||
"print(f\"Nodes:{graph_documents_filtered[0].nodes}\")\n",
|
"print(f\"Nodes:{graph_documents_filtered[0].nodes}\")\n",
|
||||||
@ -245,7 +245,9 @@
|
|||||||
" allowed_nodes=[\"Person\", \"Country\", \"Organization\"],\n",
|
" allowed_nodes=[\"Person\", \"Country\", \"Organization\"],\n",
|
||||||
" allowed_relationships=allowed_relationships,\n",
|
" allowed_relationships=allowed_relationships,\n",
|
||||||
")\n",
|
")\n",
|
||||||
"graph_documents_filtered = llm_transformer_tuple.convert_to_graph_documents(documents)\n",
|
"graph_documents_filtered = await llm_transformer_tuple.aconvert_to_graph_documents(\n",
|
||||||
|
" documents\n",
|
||||||
|
")\n",
|
||||||
"print(f\"Nodes:{graph_documents_filtered[0].nodes}\")\n",
|
"print(f\"Nodes:{graph_documents_filtered[0].nodes}\")\n",
|
||||||
"print(f\"Relationships:{graph_documents_filtered[0].relationships}\")"
|
"print(f\"Relationships:{graph_documents_filtered[0].relationships}\")"
|
||||||
]
|
]
|
||||||
@ -289,7 +291,9 @@
|
|||||||
" allowed_relationships=[\"NATIONALITY\", \"LOCATED_IN\", \"WORKED_AT\", \"SPOUSE\"],\n",
|
" allowed_relationships=[\"NATIONALITY\", \"LOCATED_IN\", \"WORKED_AT\", \"SPOUSE\"],\n",
|
||||||
" node_properties=[\"born_year\"],\n",
|
" node_properties=[\"born_year\"],\n",
|
||||||
")\n",
|
")\n",
|
||||||
"graph_documents_props = llm_transformer_props.convert_to_graph_documents(documents)\n",
|
"graph_documents_props = await llm_transformer_props.aconvert_to_graph_documents(\n",
|
||||||
|
" documents\n",
|
||||||
|
")\n",
|
||||||
"print(f\"Nodes:{graph_documents_props[0].nodes}\")\n",
|
"print(f\"Nodes:{graph_documents_props[0].nodes}\")\n",
|
||||||
"print(f\"Relationships:{graph_documents_props[0].relationships}\")"
|
"print(f\"Relationships:{graph_documents_props[0].relationships}\")"
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user