diff --git a/tutorial123/tutorial122.pptx b/tutorial123/tutorial123.pptx similarity index 100% rename from tutorial123/tutorial122.pptx rename to tutorial123/tutorial123.pptx diff --git a/tutorial124/.env b/tutorial124/.env new file mode 100644 index 0000000..e165680 --- /dev/null +++ b/tutorial124/.env @@ -0,0 +1,4 @@ +NEO4J_URI=bolt://xxx +NEO4J_USERNAME=neo4j +NEO4J_PASSWORD=xxx +NEO4J_DATABASE=neo4j diff --git a/tutorial124/main.py b/tutorial124/main.py new file mode 100644 index 0000000..0b69928 --- /dev/null +++ b/tutorial124/main.py @@ -0,0 +1,33 @@ +from langchain_openai import ChatOpenAI +from langchain_community.graphs import Neo4jGraph +from langchain.prompts import PromptTemplate +from dotenv import load_dotenv +import json +load_dotenv() +graph=Neo4jGraph() +schema=graph.get_schema +llm=ChatOpenAI(model="gpt-4o") +template=""" +Task: Generate Cypher statement to query a graph database. +Instructions: +Use only the provided nodes, relationship and properties from the schema provided below: +{schema} +Do not use any other relationship types or properties that are not provided. +sample question and queries given below: +question:display the os name which is used maximum time +query:MATCH (:Machine)-[:RUNS]->(os:OS) RETURN os.name AS osName ,count(os) as os order by os DESC limit 1 +The question is: +{question} +your response will be only json with below key nothing else +'query': +""" +prompt=PromptTemplate.from_template(template) +chain=prompt | llm +response=chain.invoke({"schema":schema,"question":"display all racks name and count of machine it is holding"}) +response=response.content +response=response.replace("json","") +response=response.replace("`","") +query=json.loads(response)["query"] +print(query) +result=graph.query(query=query) +print(result) \ No newline at end of file diff --git a/tutorial124/prompt.txt b/tutorial124/prompt.txt new file mode 100644 index 0000000..c7e0521 --- /dev/null +++ b/tutorial124/prompt.txt @@ -0,0 +1,9 @@ +Task: Generate Cypher statement to query a graph database. +Instructions: +Use only the provided nodes, relationship and properties from the schema provided below: +{schema} +Do not use any other relationship types or properties that are not provided. +The question is: +{question} +your response will be only json with below key nothing else +'query': \ No newline at end of file diff --git a/tutorial124/qsn.txt b/tutorial124/qsn.txt new file mode 100644 index 0000000..662d06f --- /dev/null +++ b/tutorial124/qsn.txt @@ -0,0 +1,3 @@ +display all distinctint os count +display all distinctint machine count based on os +display all racks name and count of machine it is holding \ No newline at end of file diff --git a/tutorial124/tutorial124.pptx b/tutorial124/tutorial124.pptx new file mode 100644 index 0000000..c830af3 Binary files /dev/null and b/tutorial124/tutorial124.pptx differ diff --git a/tutorial2/single_url.py b/tutorial2/single_url.py index a9d6295..f263c56 100644 --- a/tutorial2/single_url.py +++ b/tutorial2/single_url.py @@ -2,7 +2,7 @@ from langchain_community.document_loaders import YoutubeLoader import io -loader=YoutubeLoader.from_youtube_url("https://youtu.be/autGxyHszc4") +loader=YoutubeLoader.from_youtube_url("https://youtu.be/RwxgHJQwdRk") docs=loader.load() print(docs) with io.open("transcript.txt","w",encoding="utf-8")as f1: diff --git a/tutorial2/transcript.txt b/tutorial2/transcript.txt index ac2029a..f1021b2 100644 --- a/tutorial2/transcript.txt +++ b/tutorial2/transcript.txt @@ -1 +1 @@ -what's up guys this is Ronnie welcome back to our Channel Total technology Zone this is tutorial 122 and today's topic will be how to convert web search results into NE for Knowledge Graph using langen Okay suppose you have a topic which you want to search from the internet and you want to create a knowledge C directly from those uh like U from those written content from the web search or internet search right let's say suppose you want to search about an article or maybe some news and everything you want to do it automatically like you will just write a query I mean the question it will search in the internet and it will generate the knowledge graph into NE for okay so let's start working that thing okay first thing what we'll do we'll be going to write here new 4J sandbox first we'll write this thing here so this is the sandbox for NE 4J okay sandbox. NE 4j.com it came here right now first we'll create a sandb box let it complete okay so here I'll just go down and I'll create a blank stand box and my credentials are downloaded okay yeah so what I'll do I'll just open it and what I'll do I'll just going to copy this thing okay copy and I will just put it into this EnV file okay and next thing for search I'll be going to use this one this website this is T search and you have to go here to sign up and after that you will get an API key you have to copy that API key and you have to put it in this file and don't worry guys after the tutorial I delete everything so don't worry that I'm just going to continue with this thing okay for envirment is set up right now what we will do I will go here and I will it's a blank sand boox I can open it okay I show you guys that there is nothing okay okay okay so let's use user ID password like this and I'll go here and I will copy the password from here okay okay is getting downloaded okay so if you see it's a blank blank s box right so nothing to worry so I'll be going to start working on the code so first thing first what we'll do uh we'll be just going to first uh load this haran variable so fromb load. right and then from Lang community. tools okay import heav search results okay then load. ENB done okay then tool equals to right such results right like this then I will write Max result results okay Max results I'll just going to put it one okay then I'll be just going to write search depth will be Advanced okay Advanced okay then what else um I think include answer include raw content and include images okay so include answer then equals to true then include raw content okay that is also going to be through okay and I just want to make include images okay and I don't think anything else is required once this is done so we just going to write response equals to Tool invoke okay and there I'll going to write a query right so it should be query so what I'll just write uh USA election 20 24 okay so this is a latest news uh let it run and then we just going to write print response okay so it will be a list of dictionary I think let's see it will come okay if you list in the list you have this Ur and the content so basically is coming from BC and this is the content what I do I can easily write list of zero and content okay hopefully this will work okay right now once I get this information okay I want to actually uh make this thing uh kind of uh summarize okay so this is the raw content okay raw content which is coming from here I want to summarize this thing right to summarize this thing what you need uh we need uh something to summarize like in the last tutorial we have seen how to uh summarize document right so let's see so first thing first from l. core. prompt right you can just write import set from template right so here I just going to write template equals to template equals to chat chat from template do from template okay and there we'll be just going to write this thing okay I easily right uh summarize this content uh with minimum sentences with uh with focusing on all important information okay so now uh this done now what will happen we'll be going to create a but for creating the first I need write from L open import that open then I just going to write llm equals to open like this and then model equals to GPT hen 4 okay everything is done here so now what we'll do we'll be going to create a this is done the result is done now is going to write chain and how how to create the chain right so to creating the chain I need to actually import another necessary like module so that is going to be from uh from Lang um that will be Lang chain. chains. combine document chains andore um M documents import create stop documents in right so it should be create stop document CH so it will be going to contain two things right llm and uh this prompt okay okay prompt is ready now what we will do uh summary to ch then right um dot invoke okay so context equals to Raw content now here I forget um summarize this content here what do just to context okay right and then we just going to print the summary and let's see what is coming let's see first it will uh get information from the internet uh what it is saying that object has no attribute page content this hold on uh something is strange here okay okay I'm just thinking uh why this is not working okay so basically uh it is failing let me check where actually it is getting failed H failing here because it's just a text document it is expecting a doc right what I'll do uh we'll be going to create uh another new thing here okay so let's see so from L because I need to uh I need to actually uh convert that into a document so form length chain do store okay do document equals to import document right so what I do I will be just going to write here SD summary document is this right and then SD do append okay okay what what we just going to happen there so it should be just hold on um it should be document right of page content page content will be this raw content okay raw content and it has two things if you go here in the Raw content what is the raw content it has URL and content so I can easily write Source equals to something as well okay so maybe I easily write here so metadata equals to something like this then Source okay equals to URL okay and here it will be URL okay so my summarized document is ready and here I can easily SD okay and now let's see what is happening okay the information whatever I'm getting from the web search I'm converting that into a lang document okay okay you see I'm getting the response here okay okay so here I want this is a print summary and I want to actually write the actual message so print raw content okay so I just want to some difference whether my prompt is correct not that okay so let's do it it will print the summary and then the raw content okay let's see okay okay I'm just checking everything is working fine or not y I think this reports are actually not updated so maybe that is why but yeah this is good that something is coming so maybe I want to do something uh uh something else uhle new flagship Apple new research let's see if I find something from the Internet or not and then we'll be just going to again create another document okay fine okay so raw content is there so I just don't need the raw content I just need the summary so once the summary is ready so we'll be going to use this thing for graph document right right so for that couple of things are required so from length dot I think graphs inut for graph and here I'll just going to create NE graph equals to NE graph right so one more thing we require that llm Transformer right to convert that thing using llm Transformer using uh NLP right so it will be part of length experimental graph Transformer okay from L experimental okay uh do graph like experimental do graph Transformer import llm Transformer right so here I'll just going to write lmore Transformer equals to what so this llm Transformer will be uh going to be created with the help of llm gr Transformer and in the llm I'll just going to use llm right done so the summary is ready with the summary I can create a graph document just create blank first and then what we'll do. append okay the same thing here just going to copy this entire thing okay because I just have only one url url will always same and I will be just going to ptain this part it should be summarized okay everything is ready right so if you want to print let's print the G first let's see okay ready what is happened like this let's see the GD so it will be a length document okay okay lengen lengthen _ community. drops okay okay done uh let's do it here and check okay so there is some problem sumary s equal to response Z URL okay okay what is saying list appex no keyword argument right so it should be I forget this should be document like this and like this I forgot okay let's see okay done so this is done now what we'll do we'll be just going to convert that into graph document so graphcore docs equals to llm Transformer right and inside that I'll be just going to GD right and then what we do I'll be just going to print this gra do okay uh let's clear this thing and let's execute okay h what it is saying LM Transformer object okay sorry it will be to gra document sorry guys it is my mistake I forgot to call the function okay now what we'll do um graph do add graph documents and inside that I'll be just going to write grab dos okay fine and now here I'm going to uh check still blank okay let's execute this thing okay okay let it execute okay this is ready let's go here and check basically if you see activity concept organization service study and so many different things are there so what I'll do I'll be just going to write uh call oke dot meta graph so we'll be able to see what is happening mhm okay that's it so this is just for a simple graph like okay but suppose uh you want to actually create uh graphs from uh multiple content okay multiple content means you want to uh uh want to actually continuously build a knowledge graph on the same topic from the internet search right so that time you can easily do it by uh doing this okay so this is just a p or you can call it as a prototype okay that uh web search result can be converted as a Knowledge Graph as well okay so uh I'm just going to give you guys the nearest use case whatever I can think uh suppose uh suppose your company is uh doing some sort of marketing U marketing campaign okay or maybe suppose um you are working for a trading uh high frequency Trading Company like Tower research Goldman Sachs or maybe Quai similar sort of company right so where uh they generally uh uh get some Mar Market influencing uh some some influencing or Mark uh some indicator which can influence the market like some news or some uh some cases illegal cases fraud cases some new product release press release Etc and based on that they can trigger an uh graph algorithm because you have the raw data from the web search after that you have this knowledge graph here right and once you have the knowledge gra you can apply graph algorithm to get some prediction so this is the very hypothetical thinking right so mainly nowadays uh most of the trading organization like um uh I mean trading organization means not like very small or midsize some Advanced companies like if you see you will find that AI driven tring strategies so how they like developing those strategies because to develop the strategy or automated strategy or AI driven strategy definitely need some data so that you can learn or train your machine learning model right or orse at least you can predict something so to get the data you have to do definitely some sort of research and after you get the research data you have to like parts that result into uh some sort of uh relational uh like relationship driven like manner like graph is why graph is popular because here every entity is combined with each other or connected with each other using some sort of like relation right and once you have the relationships are built then you can easily apply the vs algorithm right so I'm just giving you the example you can come across a different use case as well but this is the ultimate thing if you don't know how to actually integrate with the webar result and convert that into NE 4J graph you won't be able to actually grow right so that is why I'm just doing uh this sort of things and probably I'll do couple of more use cases and after that I'll be just going to start working on the fully fledged CFT rag okay so enough of talking guys that's it now what I'll do I'll be just going to conclude the video over here and before I conclude if you are watching my Channel or this video for the first time thank you very much now please subscribe to my channel hit the like button uh hit the bell bell notification icon so that you should not miss any video from the future update and also if you like my videos and like my work and if you want me to like thanks or appreciate I I'm looking for some sort of support and that support is just put a comment and all also try to um try to subscribe and share my videos because guys I need your help to grow because without your help I won't grow and the moment you guys are start subscribing and engaging with my channel my channel visibility and reach will increase and that will help me to uh reach the large number of audience okay so enough of talking that's it I'll I I'll be going to meet you in the next video till then take care goodbye have a nice day and happy learning \ No newline at end of file +what's up guys this is Rony welcome back to our Channel Total technology Zone this is tutorial 6 and today's topic will be how to draw rectangles using open cv5 okay so in the last tutorial we have seen how to draw Circle and before that I believe we have seen how to create or how to draw lines and in this tutorial we'll understand how to draw rectangles right so basically as discussed uh in open CB or with open CB we can create multiple shap multiple multiple uh actually multiple geometrical shapes using open CV drawing function so we are discussing this thing once this things are done we'll be going to discuss something uh like more uh Advanced okay so slowly slowly will uh increase the complexity of the tutorial okay so just stay tuned and try to watch the entire video and once you watch the entire video try to do some practice or else you will forget and uh the good thing about this playlist I I I generally share all the source code with you uh so once you complete um once you complete the video you can actually refer to the uh GitHub source code to practice Okay so enough of talking let's start working on the handson on the coding part okay so let me minimize this thing okay and okay so first thing put nump as NP and then import CV2 okay first thing we'll create a numpy ARR for our image structure so it will np. Z okay so what do I just going to write it will be 500 5003 right and it will be MP do U okay right now let's draw CB2 dot uh rectangle okay rectangle has IMG .1.2 color thickness okay okay so I still have the fever so the point one is actually uh top left B right point one is top left so top left is actually uh it will be I believe top left is here actually so maybe I want to create a rectangle let's see it is 500 into 500 so I can write top left top left may be here okay it will be let's say let's say 100 100 100 Z okay top left and it will be bottom right so bottom right is actually maybe bottom right top left bottom right bottom right is actually here bottom maybe I can say bottom maybe be here and right so maybe I can say uh bottom right okay so this this so maybe it will be let's say 400 by 400 let's see 400 400 me actually this maybe bottom is actually here here right and is top left is actually here right I believe this is okay then color is let's say color maybe I'll just going to give some red BG reddish color I just want to put some reddish color so maybe 45 BG 78 r r is actually going to be 231 okay and let's set equals to let's say 5 okay now what we'll do2 do IM show okay so I just write rect angle okay and there I just write IMG okay and then what will happen while true okay then CV2 do W key 1 and 0 x FF FF equals equals to D Q okay if Q then to destroy okay all done let's and yeah if you see this is a rectangle okay right hope you guys understood as I'm saying this is going to be uh going to be a red color image okay okay okay so I want to actually make it from here a little bit downwards right so maybe it will be 5 100 and then I want to make it uh let's say 100 so this is actually 100 Zer so I want to make it uh let's say 2050 okay I do press CU and try to do it yeah yeah okay so now what we'll do I want to draw another like thing inside that okay so what I'll do I'll just make it 2 okay = to 2 okay let's copy this thing here so next thing will be 70 and this is going to be uh 350 and this is also going to be 350 okay and here the color will be little bit 245 and this one okay let's execute uh so these two things are actually imposed with each other because there this line is same so I want to make it a little bit inside okay so maybe from here so it will be uh 120 okay let's do it from 120 yeah that's it but that 120 is actually not equally distributed right so maybe uh this ENT thing is actually 100 and basically I'm starting it from 100 and it is actually here it is uh kind of 400 so and is 500 so maybe let's make it 170 maybe little bit realistic yeah it is more on that side okay you can do it uh by calculating everything right so similarly um let's make it 150 and 100 okay okay right now I want to actually draw another Square inside okay some pattern I'm just creting some pattern guys nothing else okay 15 then probably it will be 200 and maybe it will be maybe 300 and maybe it will be uh 250 250 and this is also maybe 250 let's see how it is going to react here yeah this is a small thing here okay I have to understand so it start from 200 and 200 250 here and then I say 250 so 250 here and then 250 so okay so 200 250 here then 250 250 so I think I have to go little bit down here I actually go a lot of down from here so it start from 150 I think it should be 180 is actually more than enough here 180 is more than enough and if I do 180 and down let me do it yeah so 180 actually I want to make it a little bit bigger here because I'm starting it from here 180 so it should be 350 it will be 350 and at the top it is 250 so let me try what happened yeah so actually this is 350 here and this is it's actually combined with this one 350 250 250 is actually somewhere here so I don't want 2 350 I just want here 30 is fine I believe so yeah it is fine but I just want to keep it a little bit downwards so to make it little bit downwards I want to make it let's say 200 okay let's do it 200 yeah 200 is here here but here it has to be uh little bit down is uh much downwards here so what I want to do I want to just make it here top left and 500 so I want to make it let's make it 100 30 okay hopefully this will work now yeah right so now this is 330 250 330 here 250 here so this is actually 130 here right so I can 130 here and from 130 it will go to 330 here and 330 here and 250 350 here and 250 here right so here I can make it 300 let's make it 300 okay so bottom left yeah right now uh let's uh increase uh this one okay so let's make it 390 okay okay 390 is actually not useful then make it let's make it 360 okay yeah 360 now let's put some color okay so to make it color make it color it will be always minus one right I'm just trying to create some uh coordinate system and the colors and if you want to make it color F you have to use this and after that if you see okay fine so this is a nice looking uh rectangle right so now here if you see this two rectangles are same so what I'll do I just want to make a different color here okay so maybe I want to make it 187 15 okay and let's execute okay so there are total three colors are there so that is how you can create some geometrical shapes geometrical shapes using open CB uh drawing function so in this tutorial we'll learn how to create rectangle how to create some pattern within that rectangle how to create multiple rectangle how to create rectangle within rectangle so many different things using this tutorial okay so I believe that is the end of this tutorial but before I conclude uh I just want to request couple of things so first thing uh once you watch this video after watching the video try to do the coding by your own because see until and unless you are not doing the coding by your own you will not remember anything because Hands-On coding is important okay so please practice and um that will help you to uh create some other use cases out of it see whenever we are going to do some interview or in the company if you're going to work you won't get this sort of smaller or simple use case right these things are just for developing the intuition right so after watching this video you have to think through it and try to visualize and create some uh extensive uh like use cases and try to solve them if you're not able to solve them please let me know we'll try to include this thing in our upcoming tutorial and if if those tutorials are like hope those use cases are very simple I'll try to give you the solution and answer then and there okay then second thing if you're watching this channel for the first time thank you very much for watching this video so please watch the video till end and after that please try to subscribe to my channel hit the like button share my videos with your family and friend and try to hit the Bell notification icon as so that you should not miss any notification for the future videos okay and last but not least guys I want to share something that this channel is uh completely maintained by me I'm the only contri for this channel so I'm doing a lot of effort to uh find out the content creating the content I have to also do some studies and create the use cases right so I need some support from all of you guys and the support I just I don't need any monetary support just help me uh by sharing my videos and try to subscribe to my channel because the moment you guys are start subscribing my subscriber account will grow and YouTube algorithm will also push my video to the large number of audience and that is my that is my ultimate goal to reach large number of audience so help me guys I would like to grow and I need your support and help to grow please help me okay so enough of talking I'm just going to conclude the video over here in the next video till then take care goodbye have a nice day and happy learning \ No newline at end of file