javeme commented on code in PR #7: URL: https://github.com/apache/incubator-hugegraph-ai/pull/7#discussion_r1365750093
########## hugegraph-llm/examples/build_kg_test.py: ########## @@ -0,0 +1,72 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +import os +from src.operators.build_kg_operator import BuildKgOperator +from src.operators.llm.openai_llm import OpenAIChat + +if __name__ == "__main__": + # If you need a proxy to access OpenAI's API, please set your HTTP proxy here + os.environ["http_proxy"] = "" + os.environ["https_proxy"] = "" + api_key = "" + + default_llm = OpenAIChat( + api_key=api_key, model_name="gpt-3.5-turbo-16k", max_tokens=4000 + ) + text = ( + "Meet Sarah, a 30-year-old attorney, and her roommate, James, whom she's shared a home with since 2010. James, " + "in his professional life, works as a journalist. Additionally, Sarah is the proud owner of the website " + "www.sarahsplace.com, while James manages his own webpage, though the specific URL is not mentioned here. " + "These two individuals, Sarah and James, have not only forged a strong personal bond as roommates but have " + "also carved out their distinctive digital presence through their respective webpages, showcasing their " + "varied interests and experiences." + ) + ops = BuildKgOperator(name="1") Review Comment: can we rename to KgBuilder and update to `builder = KgBuilder()` ########## hugegraph-llm/README.md: ########## @@ -0,0 +1,17 @@ +# hugegraph-llm + +The `hugegraph-llm` will house the implementation and research related to large language models. It will include runnable demos and can also be used as a third-party library, reducing the cost of using graph systems and the complexity of building knowledge graphs. Graph systems can help large models address challenges like timeliness and hallucination, while large models can assist graph systems with cost-related issues. Therefore, this module will explore more applications and integration solutions for graph systems and large language models. + +1. knowledge graph construction by llm +2. Use natural language to operate graph databases (gremlin) +3. Knowledge graph supplements answer context (RAG) Review Comment: `(` => `(` ########## hugegraph-llm/README.md: ########## @@ -0,0 +1,17 @@ +# hugegraph-llm + +The `hugegraph-llm` will house the implementation and research related to large language models. It will include runnable demos and can also be used as a third-party library, reducing the cost of using graph systems and the complexity of building knowledge graphs. Graph systems can help large models address challenges like timeliness and hallucination, while large models can assist graph systems with cost-related issues. Therefore, this module will explore more applications and integration solutions for graph systems and large language models. + +1. knowledge graph construction by llm Review Comment: Construct knowledge graph by LLM + HugeGraph ########## hugegraph-llm/README.md: ########## @@ -0,0 +1,17 @@ +# hugegraph-llm + +The `hugegraph-llm` will house the implementation and research related to large language models. It will include runnable demos and can also be used as a third-party library, reducing the cost of using graph systems and the complexity of building knowledge graphs. Graph systems can help large models address challenges like timeliness and hallucination, while large models can assist graph systems with cost-related issues. Therefore, this module will explore more applications and integration solutions for graph systems and large language models. + Review Comment: add a title or summary here? ########## hugegraph-llm/README.md: ########## @@ -0,0 +1,17 @@ +# hugegraph-llm + +The `hugegraph-llm` will house the implementation and research related to large language models. It will include runnable demos and can also be used as a third-party library, reducing the cost of using graph systems and the complexity of building knowledge graphs. Graph systems can help large models address challenges like timeliness and hallucination, while large models can assist graph systems with cost-related issues. Therefore, this module will explore more applications and integration solutions for graph systems and large language models. + +1. knowledge graph construction by llm +2. Use natural language to operate graph databases (gremlin) +3. Knowledge graph supplements answer context (RAG) + +# Examples + +## Examples(knowledge graph construction by llm) + +1. Start the HugeGraph database, and it is recommended to do so using Docker. Refer to this [link](https://hub.docker.com/r/hugegraph/hugegraph) for guidance +2. Run hugegraph-llm/examples/build_kg_test.py + +Note: If you need a proxy to access OpenAI's API, please set your HTTP proxy in `build_kg_test.py` and Review Comment: and ...? ########## hugegraph-llm/README.md: ########## @@ -0,0 +1,17 @@ +# hugegraph-llm + +The `hugegraph-llm` will house the implementation and research related to large language models. It will include runnable demos and can also be used as a third-party library, reducing the cost of using graph systems and the complexity of building knowledge graphs. Graph systems can help large models address challenges like timeliness and hallucination, while large models can assist graph systems with cost-related issues. Therefore, this module will explore more applications and integration solutions for graph systems and large language models. + +1. knowledge graph construction by llm +2. Use natural language to operate graph databases (gremlin) Review Comment: `(` => `(` ########## hugegraph-llm/examples/build_kg_test.py: ########## @@ -0,0 +1,72 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +import os +from src.operators.build_kg_operator import BuildKgOperator +from src.operators.llm.openai_llm import OpenAIChat + +if __name__ == "__main__": + # If you need a proxy to access OpenAI's API, please set your HTTP proxy here + os.environ["http_proxy"] = "" + os.environ["https_proxy"] = "" + api_key = "" + + default_llm = OpenAIChat( + api_key=api_key, model_name="gpt-3.5-turbo-16k", max_tokens=4000 + ) + text = ( + "Meet Sarah, a 30-year-old attorney, and her roommate, James, whom she's shared a home with since 2010. James, " + "in his professional life, works as a journalist. Additionally, Sarah is the proud owner of the website " + "www.sarahsplace.com, while James manages his own webpage, though the specific URL is not mentioned here. " + "These two individuals, Sarah and James, have not only forged a strong personal bond as roommates but have " + "also carved out their distinctive digital presence through their respective webpages, showcasing their " + "varied interests and experiences." + ) + ops = BuildKgOperator(name="1") + # build kg with only text + ops.parse_text_to_data(default_llm).disambiguate_data( + default_llm Review Comment: prefer to wrap line before disambiguate_data ########## hugegraph-llm/README.md: ########## @@ -0,0 +1,17 @@ +# hugegraph-llm + +The `hugegraph-llm` will house the implementation and research related to large language models. It will include runnable demos and can also be used as a third-party library, reducing the cost of using graph systems and the complexity of building knowledge graphs. Graph systems can help large models address challenges like timeliness and hallucination, while large models can assist graph systems with cost-related issues. Therefore, this module will explore more applications and integration solutions for graph systems and large language models. + +1. knowledge graph construction by llm +2. Use natural language to operate graph databases (gremlin) +3. Knowledge graph supplements answer context (RAG) + +# Examples + +## Examples(knowledge graph construction by llm) + +1. Start the HugeGraph database, and it is recommended to do so using Docker. Refer to this [link](https://hub.docker.com/r/hugegraph/hugegraph) for guidance Review Comment: you can do it via Docker ########## hugegraph-llm/README.md: ########## @@ -0,0 +1,17 @@ +# hugegraph-llm + +The `hugegraph-llm` will house the implementation and research related to large language models. It will include runnable demos and can also be used as a third-party library, reducing the cost of using graph systems and the complexity of building knowledge graphs. Graph systems can help large models address challenges like timeliness and hallucination, while large models can assist graph systems with cost-related issues. Therefore, this module will explore more applications and integration solutions for graph systems and large language models. + +1. knowledge graph construction by llm +2. Use natural language to operate graph databases (gremlin) +3. Knowledge graph supplements answer context (RAG) + +# Examples + +## Examples(knowledge graph construction by llm) + +1. Start the HugeGraph database, and it is recommended to do so using Docker. Refer to this [link](https://hub.docker.com/r/hugegraph/hugegraph) for guidance +2. Run hugegraph-llm/examples/build_kg_test.py Review Comment: Run example like `python hugegraph-llm/examples/build_kg_test.py` ########## hugegraph-llm/README.md: ########## @@ -0,0 +1,17 @@ +# hugegraph-llm + +The `hugegraph-llm` will house the implementation and research related to large language models. It will include runnable demos and can also be used as a third-party library, reducing the cost of using graph systems and the complexity of building knowledge graphs. Graph systems can help large models address challenges like timeliness and hallucination, while large models can assist graph systems with cost-related issues. Therefore, this module will explore more applications and integration solutions for graph systems and large language models. Review Comment: some updates: The `hugegraph-llm` is a tool for the implementation and research related to large language models. This project includes runnable demos, it can also be used as a third-party library. As we know, graph systems can help large models address challenges like timeliness and hallucination, while large models can assist graph systems with cost-related issues. With this project, we aim to reduce the cost of using graph systems, and decrease the complexity of building knowledge graphs. This project will offers more applications and integration solutions for graph systems and large language models. ########## hugegraph-llm/README.md: ########## @@ -0,0 +1,17 @@ +# hugegraph-llm + +The `hugegraph-llm` will house the implementation and research related to large language models. It will include runnable demos and can also be used as a third-party library, reducing the cost of using graph systems and the complexity of building knowledge graphs. Graph systems can help large models address challenges like timeliness and hallucination, while large models can assist graph systems with cost-related issues. Therefore, this module will explore more applications and integration solutions for graph systems and large language models. + +1. knowledge graph construction by llm +2. Use natural language to operate graph databases (gremlin) +3. Knowledge graph supplements answer context (RAG) Review Comment: `(` => `(` ########## hugegraph-llm/README.md: ########## @@ -0,0 +1,17 @@ +# hugegraph-llm + +The `hugegraph-llm` will house the implementation and research related to large language models. It will include runnable demos and can also be used as a third-party library, reducing the cost of using graph systems and the complexity of building knowledge graphs. Graph systems can help large models address challenges like timeliness and hallucination, while large models can assist graph systems with cost-related issues. Therefore, this module will explore more applications and integration solutions for graph systems and large language models. + +1. knowledge graph construction by llm +2. Use natural language to operate graph databases (gremlin) Review Comment: `(` => `(` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
