Copilot commented on code in PR #313:
URL:
https://github.com/apache/incubator-hugegraph-ai/pull/313#discussion_r2562737888
##########
hugegraph-llm/src/hugegraph_llm/flows/prompt_generate.py:
##########
@@ -17,18 +17,15 @@
from hugegraph_llm.flows.common import BaseFlow
from hugegraph_llm.nodes.llm_node.prompt_generate import PromptGenerateNode
-from hugegraph_llm.state.ai_state import WkFlowInput
-from hugegraph_llm.state.ai_state import WkFlowState
+from hugegraph_llm.state.ai_state import WkFlowInput, WkFlowState
# pylint: disable=arguments-differ,keyword-arg-before-vararg
class PromptGenerateFlow(BaseFlow):
def __init__(self):
pass
- def prepare(
- self, prepared_input: WkFlowInput, source_text, scenario,
example_name, **kwargs
- ):
+ def prepare(self, prepared_input: WkFlowInput, source_text, scenario,
example_name, **kwargs):
Review Comment:
This method requires 5 positional arguments, whereas overridden
[BaseFlow.prepare](1) requires 2.
##########
hugegraph-llm/src/hugegraph_llm/flows/graph_extract.py:
##########
@@ -46,15 +48,11 @@ def prepare(
prepared_input.schema = schema
prepared_input.extract_type = extract_type
- def build_flow(
- self, schema, texts, example_prompt, extract_type, language="zh",
**kwargs
- ):
+ def build_flow(self, schema, texts, example_prompt, extract_type,
language="zh", **kwargs):
Review Comment:
This method requires at least 5 positional arguments, whereas overridden
[BaseFlow.build_flow](1) requires 1.
```suggestion
def build_flow(self, input_data, **kwargs):
# Expect input_data to be a dict or object with required fields
schema = getattr(input_data, "schema", None) if hasattr(input_data,
"schema") else input_data.get("schema")
texts = getattr(input_data, "texts", None) if hasattr(input_data,
"texts") else input_data.get("texts")
example_prompt = getattr(input_data, "example_prompt", None) if
hasattr(input_data, "example_prompt") else input_data.get("example_prompt")
extract_type = getattr(input_data, "extract_type", None) if
hasattr(input_data, "extract_type") else input_data.get("extract_type")
language = getattr(input_data, "language", "zh") if
hasattr(input_data, "language") else input_data.get("language", "zh")
```
--
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]