simon824 commented on code in PR #84:
URL:
https://github.com/apache/incubator-hugegraph-ai/pull/84#discussion_r1793385859
##########
hugegraph-llm/src/hugegraph_llm/operators/kg_construction_task.py:
##########
@@ -60,16 +59,17 @@ def fetch_graph_data(self):
return self
def chunk_split(
- self,
- text: Union[str, List[str]], # text to be split
- split_type: Literal["paragraph", "sentence"] = "paragraph",
- language: Literal["zh", "en"] = "zh"
+ self,
+ text: Union[str, List[str]], # text to be split
+ split_type: Literal["document", "paragraph", "sentence"] = "document",
Review Comment:
Why is the default value changed to `document`, does it have a better effect?
##########
hugegraph-llm/src/hugegraph_llm/operators/hugegraph_op/commit_to_hugegraph.py:
##########
@@ -112,17 +142,21 @@ def load_into_graph(self, vertices, edges, schema):
except CreateError as e:
log.error("Error on creating edge: %s, %s", edge, e)
- def init_schema_if_need(self, schema: object):
+ def init_schema_if_need(self, schema: dict):
+ properties = schema["propertykeys"]
vertices = schema["vertexlabels"]
edges = schema["edgelabels"]
+ for prop in properties:
+ self._create_property(prop)
+
for vertex in vertices:
vertex_label = vertex["name"]
properties = vertex["properties"]
nullable_keys = vertex["nullable_keys"]
primary_keys = vertex["primary_keys"]
- for prop in properties:
- self.schema.propertyKey(prop).asText().ifNotExist().create()
+ # for prop in properties:
+ # self.schema.propertyKey(prop).asText().ifNotExist().create()
Review Comment:
remove directly?
##########
hugegraph-llm/src/hugegraph_llm/models/llms/openai.py:
##########
@@ -141,7 +140,7 @@ def num_tokens_from_string(self, string: str) -> int:
def max_allowed_token_length(self) -> int:
"""Get max-allowed token length"""
# TODO: list all models and their max tokens from api
- return 2049
+ return 8192
Review Comment:
why increase to 8192?
##########
hugegraph-llm/src/hugegraph_llm/utils/graph_index_utils.py:
##########
@@ -113,8 +110,9 @@ def import_graph_data(data: str, schema: str) -> Union[str,
Dict[str, Any]]:
context = builder.commit_to_hugegraph().run(data_json)
gr.Info("Import graph data successfully!")
+ print(context)
return json.dumps(context, ensure_ascii=False, indent=2)
- except Exception as e: # pylint: disable=W0718
+ except Exception as e: # pylint: disable=W0718
Review Comment:
Is this configuration universal? Does it need to be added to `pylint.conf`?
##########
hugegraph-llm/src/hugegraph_llm/demo/rag_demo/configs_block.py:
##########
@@ -63,7 +63,8 @@ def test_api_connection(url, method="GET", headers=None,
params=None, body=None,
def config_qianfan_model(arg1, arg2, arg3=None, origin_call=None) -> int:
settings.qianfan_api_key = arg1
settings.qianfan_secret_key = arg2
- settings.qianfan_language_model = arg3
+ if arg3 is not None:
Review Comment:
```python
if arg3:
```
##########
hugegraph-llm/src/hugegraph_llm/operators/hugegraph_op/commit_to_hugegraph.py:
##########
@@ -132,8 +166,8 @@ def init_schema_if_need(self, schema: object):
source_vertex_label = edge["source_label"]
target_vertex_label = edge["target_label"]
properties = edge["properties"]
- for prop in properties:
- self.schema.propertyKey(prop).asText().ifNotExist().create()
+ # for prop in properties:
+ # self.schema.propertyKey(prop).asText().ifNotExist().create()
Review Comment:
ditto
--
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]