Skip to content

Commit

Permalink
tutorial120
Browse files Browse the repository at this point in the history
  • Loading branch information
ronidas39 committed Nov 4, 2024
1 parent a70245f commit 15d39e4
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 2 deletions.
3 changes: 3 additions & 0 deletions tutorial120/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
NEO4J_URI=bolt://3xxx
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=xxxx
Binary file added tutorial120/__pycache__/genScript.cpython-310.pyc
Binary file not shown.
15 changes: 15 additions & 0 deletions tutorial120/genGraph.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import os
from langchain_experimental.graph_transformers import LLMGraphTransformer
from langchain_openai import ChatOpenAI
from langchain_community.graphs import Neo4jGraph
from genScript import genText
from dotenv import load_dotenv
load_dotenv()
llm=ChatOpenAI(model="gpt-4o")
llm_transformer=LLMGraphTransformer(llm=llm)
graph=Neo4jGraph()
documents=genText("https://www.youtube.com/watch?v=HxTNuGnYZWM")
graph_documents=llm_transformer.convert_to_graph_documents(documents)
# print(f"Nodes:{graph_documents[0].nodes}")
# print(f"Nodes:{graph_documents[0].relationships}")
graph.add_graph_documents(graph_documents)
8 changes: 8 additions & 0 deletions tutorial120/genScript.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from langchain_community.document_loaders import YoutubeLoader

def genText(url):
loader=YoutubeLoader.from_youtube_url(url)
docs=loader.load()
return docs


Binary file added tutorial120/tutorial120.pptx
Binary file not shown.
2 changes: 1 addition & 1 deletion tutorial2/single_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from langchain_community.document_loaders import YoutubeLoader
import io

loader=YoutubeLoader.from_youtube_url("https://youtu.be/I1EmpekXKu0")
loader=YoutubeLoader.from_youtube_url("https://www.youtube.com/watch?v=HxTNuGnYZWM")
docs=loader.load()
print(docs)
with io.open("transcript.txt","w",encoding="utf-8")as f1:
Expand Down
123 changes: 122 additions & 1 deletion tutorial2/transcript.txt

Large diffs are not rendered by default.

0 comments on commit 15d39e4

Please sign in to comment.