Fix Linting errors
This commit is contained in:
@@ -284,7 +284,9 @@ def create_graph_routes(rag, api_key: Optional[str] = None):
|
||||
"data": entity_data,
|
||||
}
|
||||
except ValueError as ve:
|
||||
logger.error(f"Validation error creating entity '{request.entity_name}': {str(ve)}")
|
||||
logger.error(
|
||||
f"Validation error creating entity '{request.entity_name}': {str(ve)}"
|
||||
)
|
||||
raise HTTPException(status_code=400, detail=str(ve))
|
||||
except Exception as e:
|
||||
logger.error(f"Error creating entity '{request.entity_name}': {str(e)}")
|
||||
@@ -328,9 +330,13 @@ def create_graph_routes(rag, api_key: Optional[str] = None):
|
||||
)
|
||||
|
||||
if not source_exists:
|
||||
raise ValueError(f"Source entity '{request.source_entity}' does not exist")
|
||||
raise ValueError(
|
||||
f"Source entity '{request.source_entity}' does not exist"
|
||||
)
|
||||
if not target_exists:
|
||||
raise ValueError(f"Target entity '{request.target_entity}' does not exist")
|
||||
raise ValueError(
|
||||
f"Target entity '{request.target_entity}' does not exist"
|
||||
)
|
||||
|
||||
# Create the relationship
|
||||
await rag.chunk_entity_relation_graph.upsert_edge(
|
||||
|
||||
@@ -828,8 +828,8 @@ class PostgreSQLDB:
|
||||
|
||||
# Execute the migration
|
||||
alter_sql = f"""
|
||||
ALTER TABLE {migration['table']}
|
||||
ALTER COLUMN {migration['column']} TYPE {migration['new_type']}
|
||||
ALTER TABLE {migration["table"]}
|
||||
ALTER COLUMN {migration["column"]} TYPE {migration["new_type"]}
|
||||
"""
|
||||
|
||||
await self.execute(alter_sql)
|
||||
|
||||
@@ -401,7 +401,7 @@ async def _handle_single_relationship_extraction(
|
||||
): # treat "relationship" and "relation" interchangeable
|
||||
if len(record_attributes) > 1 and "relation" in record_attributes[0]:
|
||||
logger.warning(
|
||||
f"{chunk_key}: LLM output format error; found {len(record_attributes)}/5 fields on REALTION `{record_attributes[1]}`~`{record_attributes[2] if len(record_attributes) >2 else 'N/A'}`"
|
||||
f"{chunk_key}: LLM output format error; found {len(record_attributes)}/5 fields on REALTION `{record_attributes[1]}`~`{record_attributes[2] if len(record_attributes) > 2 else 'N/A'}`"
|
||||
)
|
||||
logger.debug(record_attributes)
|
||||
return None
|
||||
@@ -2225,7 +2225,7 @@ async def extract_entities(
|
||||
await asyncio.wait(pending)
|
||||
|
||||
# Add progress prefix to the exception message
|
||||
progress_prefix = f"C[{processed_chunks+1}/{total_chunks}]"
|
||||
progress_prefix = f"C[{processed_chunks + 1}/{total_chunks}]"
|
||||
|
||||
# Re-raise the original exception with a prefix
|
||||
prefixed_exception = create_prefixed_exception(first_exception, progress_prefix)
|
||||
|
||||
@@ -1472,8 +1472,7 @@ async def aexport_data(
|
||||
|
||||
else:
|
||||
raise ValueError(
|
||||
f"Unsupported file format: {file_format}. "
|
||||
f"Choose from: csv, excel, md, txt"
|
||||
f"Unsupported file format: {file_format}. Choose from: csv, excel, md, txt"
|
||||
)
|
||||
if file_format is not None:
|
||||
print(f"Data exported to: {output_path} with format: {file_format}")
|
||||
|
||||
@@ -73,7 +73,7 @@ def batch_eval(query_file, result1_file, result2_file, output_file_path):
|
||||
"""
|
||||
|
||||
request_data = {
|
||||
"custom_id": f"request-{i+1}",
|
||||
"custom_id": f"request-{i + 1}",
|
||||
"method": "POST",
|
||||
"url": "/v1/chat/completions",
|
||||
"body": {
|
||||
|
||||
Reference in New Issue
Block a user