Тёмный
No video :(

Langchain & Neo4j: Create Knowledge Graphs from Text 

Hands-on AI
Подписаться 3,9 тыс.
Просмотров 10 тыс.
50% 1

-
python.langchain.com/docs/use...
#datascience #machinelearning #deeplearning #datanalytics #predictiveanalytics #artificialintelligence #generativeai #largelanguagemodels #computervision #naturallanguageprocessing #agents #transformers #embedding #graphml #graphdatascience #datavisualization #businessintelligence #optimization #montecarlosimulation #simulation #LLMs #python #aws #azure #gcp

Опубликовано:

 

30 мар 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 68   
@SridharKumarKannam
@SridharKumarKannam 2 дня назад
If you found this content useful, pleases consider sharing it with others who might benefit. Your support is greatly appreciated :)
@johnhelewa
@johnhelewa 2 месяца назад
You did a great job of explaining llm graph transformer clearly.
@SridharKumarKannam
@SridharKumarKannam 2 месяца назад
Thanks for your support :)
@williammariasoosai1153
@williammariasoosai1153 3 месяца назад
Sridhar, Great job! Thanks
@SridharKumarKannam
@SridharKumarKannam 3 месяца назад
thank you :)
@varuntirupati2566
@varuntirupati2566 3 месяца назад
The main challenge I see with Knowledge graphs is in Retriever side. Until unless if we or LLM generate the cypher query with the exactly same nodes and relationships that are present in graph database from the question we asked we are not going to get the proper response.
@SridharKumarKannam
@SridharKumarKannam 2 месяца назад
yes, these tools and technologies are still improving everyday. Sometime not too far in the future, we will get minimum acceptable accuracy required..
@Shivam-bi5uo
@Shivam-bi5uo Месяц назад
great! apprecitate this!
@SridharKumarKannam
@SridharKumarKannam Месяц назад
thank you very much for your support :)
@dipanjansaha6824
@dipanjansaha6824 4 часа назад
Instead of text, can we do it from 2 tables instead? Maybe two columns in two tables?
@timjrgebn
@timjrgebn Месяц назад
Very impressive output on this content volume. I do have a question, though. While this is great for building knowledge graphs, I'm curious how complicated these relationships can get in these knowledge graphs. I have more experience with formal logic, and more sophisticated logical frameworks like temporal logic, fuzzy logic, etc., try to explain relationships with more accuracy. It would be great if these more complicated relationships could be represented in these knowledge graphs. It would help so much in discovery and improving logical accuracy/soundness in written text.
@SridharKumarKannam
@SridharKumarKannam Месяц назад
its better to define the schema explicitly for production usecases and some post processing of LLMs output for sanity checks. I've several videos on these concepts. I'll add more content on this topic...
@mystic2212
@mystic2212 Месяц назад
Bro youre the best, you have saved my Thesis. Only question is how to retrieve
@SridharKumarKannam
@SridharKumarKannam Месяц назад
thanks for your support :)
@matheusaltomarecruz4598
@matheusaltomarecruz4598 2 месяца назад
Congratulations for the video. I'm facing some issues that looks like a package version problem. Could you provide the requirements for this experiment, please?
@SridharKumarKannam
@SridharKumarKannam 2 месяца назад
Langchain library is being updated very frequently. Pls check the latest docs/APIs. Did you resolve the issue ? Whats the error pls...
@leed2002isa
@leed2002isa 3 месяца назад
hello, thank you for this video it was very helpful, how do i link the project to the neo4j desktop client ?
@SridharKumarKannam
@SridharKumarKannam 3 месяца назад
This should do ---- import os from langchain_community.graphs import Neo4jGraph os.environ["NEO4J_URI"] = "bolt://localhost:7687" os.environ["NEO4J_USERNAME"] = "neo4j" os.environ["NEO4J_PASSWORD"] = "password" graph = Neo4jGraph()
@debarghyadasgupta1931
@debarghyadasgupta1931 20 дней назад
With structured data in your previous pgsql examples, can we still apply graphdb concepts on structure data for optimal rag retrieval?
@SridharKumarKannam
@SridharKumarKannam 20 дней назад
Structured data (sql db) is usually easy to query, if we can have a good text2LLM model, then we don't need any additional algorithmic techniques. Querying unstructured data is complex and hence we have RAG, knowledge graphs, and combination of them...
@debarghyadasgupta1931
@debarghyadasgupta1931 20 дней назад
@@SridharKumarKannam what would be your recommendation for writing optimal few-shot query examples to further optimise the sql LLM agent and also to reduce the LLM tokens overlaid and context size with bloated info?
@user-zb9kn9pn9d
@user-zb9kn9pn9d 4 месяца назад
Hi... Do you provide any courses on machine learning or ai?
@SridharKumarKannam
@SridharKumarKannam 4 месяца назад
I don't have any structured course year on ML but I'm planning to do one.
@anshumangiramkar2589
@anshumangiramkar2589 3 месяца назад
Sir, can you please explain the basics too? I mean how to install Neo4j correctly on your PC, because I tried with setting up the system env for Neo4j in Mac OS Big Sur and I struggled a lot with connecting it to my Jupyter Notebook in Python=3.11... and I see no improvement on my side. If you could enlighten me with how to establish a similar environment to run the app on my Mac/Win system, I would be grateful to you... I am watching all of your vids on Knowledge Graphs and LLMs and I have learnt a lot.
@SridharKumarKannam
@SridharKumarKannam 3 месяца назад
It is resolved? What error are you getting? After installing neo4j desktop, you need to install a couple of plugins also from neo4j desktop.
@anshumangiramkar2589
@anshumangiramkar2589 3 месяца назад
@@SridharKumarKannam The error is no bolt://localhost:7687 URL not found or running, I want to connect my Neo4J desktop to my Python Script/Notebook and try connecting both. So that, I could make use of knowledge graphs to visualize information from certain given text.
@shehzadahmed1782
@shehzadahmed1782 4 месяца назад
how to i use multiple Neoj4 database's at the same time.. is this possible
@SridharKumarKannam
@SridharKumarKannam 3 месяца назад
you can use only one db in the free version.
@animation-1023
@animation-1023 3 дня назад
I am writing this query to get output "response=chain.invoke({"query":"what was the name of SPOUSE of Marie Curie?"}) response" but in output it is giving "'result': "I don't know the answer. "}" although in neo4j it is showing relationship
@SridharKumarKannam
@SridharKumarKannam День назад
Did you run the query multiple times and got the same output? All LLMs are stochastic (random) in nature, some times strange results are expected.
@malikanaser8251
@malikanaser8251 3 месяца назад
Hi, what happen if I run this code again for a second text? does it add it to the same kg database? if not, what should I do to add a new text to the same database?
@SridharKumarKannam
@SridharKumarKannam 3 месяца назад
It will overwrite the DB. I'm sure Neo4J has capability to add new information, but I'm not sure if thats implemented yet in the langchain wrapper. If your database is not too large, you can re-create it, by adding the new information to raw data before extracting nodes/relationships...
@nullvoid12
@nullvoid12 3 месяца назад
You can view your graphs with Neo4j bloom also
@SridharKumarKannam
@SridharKumarKannam 2 месяца назад
thats right, Thanks for your support :)
@jingluhan3289
@jingluhan3289 19 дней назад
Only me met the error at step 6? my pthon told me that there is an error at in LLMGraphTransformer.process_response(self, document) 593 nodes_set = set() 594 relationships = [] --> 595 parsed_json = self.json_repair.loads(raw_schema.content) AttributeError: 'str' object has no attribute 'content'
@SridharKumarKannam
@SridharKumarKannam 17 дней назад
The output format from LLM models is important for these things. stackoverflow.com/questions/78521181/llmgraphtransformer-convert-to-graph-documentsdocuments-attributeerror-str
@awakenwithoutcoffee
@awakenwithoutcoffee Месяц назад
when do you expect GraphRag to be production ready ?
@SridharKumarKannam
@SridharKumarKannam Месяц назад
I would think in the next few months, definitely within 6 months. There is a lot of work going on in converting free text to graphs.
@awakenwithoutcoffee
@awakenwithoutcoffee Месяц назад
@@SridharKumarKannam nice thank you for sharing your knowledge. One of the challenges with graphRAG seems that it requires allot more tokens / time (from testing it took about 40-60 seconds for 1 answer compared to 1-4 seconds for regular RAG, but the answer was 40% better) Do you think these challenges can be solved with the rise of LPU's/inference speed increasement ?
@datatalkswithchandranshu2028
@datatalkswithchandranshu2028 27 дней назад
Using same code..my llm_transformer.convert_to_graph part not working ..gives error that index of list should be integer and not str Using hugging face llm
@SridharKumarKannam
@SridharKumarKannam 26 дней назад
The ouput format of the llms can be the issue. Pls test using openai with a small text, if its working, then the issue is HF llm op format, choose a different model.
@shadyhamrouny8755
@shadyhamrouny8755 3 месяца назад
Ollama based llms don't work with the LLMGraphTransformer do you know why?
@SridharKumarKannam
@SridharKumarKannam 3 месяца назад
I've not tested that, what error are you getting?
@shadyhamrouny8755
@shadyhamrouny8755 3 месяца назад
@@SridharKumarKannam Thanks for your response! ----> 9 llm_transformer = LLMGraphTransformer(llm=llm) 215 schema = create_simple_model(allowed_nodes, allowed_relationships) --> 216 structured_llm = llm.with_structured_output(schema) 217 self.chain = prompt | structured_llm 108 warned = True 109 emit_warning() --> 110 return wrapped(*args, **kwargs) 199 @beta() 200 def with_structured_output( 201 self, schema: Union[Dict, Type[BaseModel]], **kwargs: Any 202 ) -> Runnable[LanguageModelInput, Union[Dict, BaseModel]]: 203 """Implement this if there is a way of steering the model to generate responses that match a given schema.""" # noqa: E501 --> 204 raise NotImplementedError() Apparenttly Ollama doesn't output a structured output compatible with LLMGraphTransformer. I couldn't find a way around it.
@somashekharb1846
@somashekharb1846 2 месяца назад
@@SridharKumarKannam AttributeError on calling LLMGraphTransformer.convert_to_graph_documents
@somashekharb1846
@somashekharb1846 2 месяца назад
AttributeError on calling LLMGraphTransformer.convert_to_graph_documents having this error it runs ollama server but ends with this error
@JelckedeBoer
@JelckedeBoer 2 месяца назад
@@SridharKumarKannam Traceback (most recent call last): File "/home/jelcke/dev/test/txt2graph/openai-graph.py", line 38, in llm_transformer_filtered = LLMGraphTransformer( File "/home/jelcke/dev/test/txt2graph/venv/lib/python3.10/site-packages/langchain_experimental/graph_transformers/llm.py", line 216, in __init__ structured_llm = llm.with_structured_output(schema) File "/home/jelcke/dev/test/txt2graph/venv/lib/python3.10/site-packages/langchain_core/language_models/base.py", line 208, in with_structured_output raise NotImplementedError() NotImplementedError
@luisramos1977
@luisramos1977 2 месяца назад
after the code: llm = ChatOpenAI(temperature=0, model_name="gpt-4-0125-preview") I receive the error: ValidationError: 1 validation error for ChatOpenAI __root__ Did not find openai_api_key, please add an environment variable `OPENAI_API_KEY` which contains it, or pass `openai_api_key` as a named parameter. (type=value_error) But, I do not find where you add such variables.
@codingx6654
@codingx6654 2 месяца назад
you can create a .env file and paste your openapi key , OPENAI_API_KEY=your_api_key
@SridharKumarKannam
@SridharKumarKannam 2 месяца назад
You can add key either directly in the code using this command os.environ["OPENAI_API_KEY"] = "YOUR_KEY"
@SridharKumarKannam
@SridharKumarKannam 2 месяца назад
I've setup the key in my environmental variables in the bashrc file
@usmanjalil6711
@usmanjalil6711 Месяц назад
How can we process large documents. It takes so much time.
@usmanjalil6711
@usmanjalil6711 Месяц назад
And how can we use aconvert_to_graph_documents function
@SridharKumarKannam
@SridharKumarKannam Месяц назад
whats is document size? It is expected to take long time for large documents, for example, if its a pdf book, then all the pages needs to converted to text, a typical book can have 1000s of chunks and for each chunk embedding needs to be create and then stored in the index. Anyway, its mostly a one-off task, for check the end-to-end workflow with short text and then load the entire docs for usage.
@weebprogrammer2979
@weebprogrammer2979 2 месяца назад
You explained it well but the results are always inconsistent.
@SridharKumarKannam
@SridharKumarKannam Месяц назад
with LLMs the results are not always the same, they are stochastic. Set the temperature to very low value. You can add some post-processing to the output of LLMs.
@weebprogrammer2979
@weebprogrammer2979 Месяц назад
@@SridharKumarKannam I did but still not consistent results 😢
@jeffhaskin895
@jeffhaskin895 3 месяца назад
What software is he using?
@hazardscarn
@hazardscarn 2 месяца назад
Neo4j
@SridharKumarKannam
@SridharKumarKannam 2 месяца назад
Thanks for your support :)
@SridharKumarKannam
@SridharKumarKannam 2 месяца назад
Yes it is.
@RishuKumarMishra-pt9pf
@RishuKumarMishra-pt9pf 3 месяца назад
What api key you are using and From where do you get it?
@SridharKumarKannam
@SridharKumarKannam 3 месяца назад
many frameworks use openai by default if we don't specify a model explicitly. The key in my config files.
@rabbit1259
@rabbit1259 2 месяца назад
Can you provide for the code
@SridharKumarKannam
@SridharKumarKannam Месяц назад
the link is in the description...
Далее
Graph RAG: Improving RAG with Knowledge Graphs
15:58
Просмотров 41 тыс.
Brawl Stars Animation: PAINT BRAWL STARTS NOW!
00:52
LangGraph 101: it's better than LangChain
32:26
Просмотров 61 тыс.
Convert Any Text into a Knowledge Graph
30:52
Просмотров 9 тыс.
Reliable Graph RAG with Neo4j and Diffbot
8:02
Просмотров 14 тыс.
GraphRAG: LLM-Derived Knowledge Graphs for RAG
15:40
Просмотров 98 тыс.
What is a Knowledge Graph?
5:36
Просмотров 94 тыс.
Chat With Knowledge Graph Data | Improved RAG
13:00
Просмотров 4,3 тыс.
Knowledge Graphs - Computerphile
12:05
Просмотров 102 тыс.