vichayturen commented on code in PR #73:
URL: 
https://github.com/apache/incubator-hugegraph-ai/pull/73#discussion_r1729854356


##########
hugegraph-llm/src/hugegraph_llm/operators/common_op/merge_dedup_rerank.py:
##########
@@ -16,59 +16,67 @@
 # under the License.
 
 
-from typing import Dict, Any, List, Literal
+from typing import Literal, Dict, Any, List, Optional
 
 import jieba
 from hugegraph_llm.models.embeddings.base import BaseEmbedding
+from hugegraph_llm.models.rerankers.init_reranker import Rerankers
 from nltk.translate.bleu_score import sentence_bleu
 
 
-def get_score(query: str, content: str) -> float:
+def get_blue_score(query: str, content: str) -> float:

Review Comment:
   spelling error: bleu



##########
hugegraph-llm/src/hugegraph_llm/models/rerankers/siliconflow.py:
##########
@@ -0,0 +1,61 @@
+# 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 requests
+from typing import Optional

Review Comment:
   `from typing import` should be above `import requests`



##########
hugegraph-llm/src/hugegraph_llm/models/rerankers/cohere.py:
##########
@@ -0,0 +1,64 @@
+# 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 requests
+from typing import Optional
+from hugegraph_llm.config import settings
+
+
+class CohereReranker:
+    def __init__(
+        self,
+        api_key: str = settings.reranker_api_key,
+        base_url: str = settings.cohere_base_url,
+        model: str = settings.reranker_model,

Review Comment:
   default value may should be None hear and settings should be used in 
init_reranker.py



##########
hugegraph-llm/src/hugegraph_llm/operators/graph_rag_task.py:
##########
@@ -73,26 +75,26 @@ def extract_keyword(
         return self
 
     def match_keyword_to_id(
-            self,
-            by: Literal["query", "keywords"] = "keywords",
-            topk_per_keyword: int = 1,
-            topk_per_query: int = 10
+        self,
+        by: Literal["query", "keywords"] = "keywords",
+        topk_per_keyword: int = 1,
+        topk_per_query: int = 10,
     ):

Review Comment:
   indent twice here



-- 
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]

Reply via email to