Fix Linting errors
This commit is contained in:
parent
9f44e89de7
commit
f6d1fb98ac
5 changed files with 15 additions and 10 deletions
|
|
@ -284,7 +284,9 @@ def create_graph_routes(rag, api_key: Optional[str] = None):
|
||||||
"data": entity_data,
|
"data": entity_data,
|
||||||
}
|
}
|
||||||
except ValueError as ve:
|
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))
|
raise HTTPException(status_code=400, detail=str(ve))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error creating entity '{request.entity_name}': {str(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:
|
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:
|
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
|
# Create the relationship
|
||||||
await rag.chunk_entity_relation_graph.upsert_edge(
|
await rag.chunk_entity_relation_graph.upsert_edge(
|
||||||
|
|
|
||||||
|
|
@ -828,8 +828,8 @@ class PostgreSQLDB:
|
||||||
|
|
||||||
# Execute the migration
|
# Execute the migration
|
||||||
alter_sql = f"""
|
alter_sql = f"""
|
||||||
ALTER TABLE {migration['table']}
|
ALTER TABLE {migration["table"]}
|
||||||
ALTER COLUMN {migration['column']} TYPE {migration['new_type']}
|
ALTER COLUMN {migration["column"]} TYPE {migration["new_type"]}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
await self.execute(alter_sql)
|
await self.execute(alter_sql)
|
||||||
|
|
|
||||||
|
|
@ -401,7 +401,7 @@ async def _handle_single_relationship_extraction(
|
||||||
): # treat "relationship" and "relation" interchangeable
|
): # treat "relationship" and "relation" interchangeable
|
||||||
if len(record_attributes) > 1 and "relation" in record_attributes[0]:
|
if len(record_attributes) > 1 and "relation" in record_attributes[0]:
|
||||||
logger.warning(
|
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)
|
logger.debug(record_attributes)
|
||||||
return None
|
return None
|
||||||
|
|
@ -2225,7 +2225,7 @@ async def extract_entities(
|
||||||
await asyncio.wait(pending)
|
await asyncio.wait(pending)
|
||||||
|
|
||||||
# Add progress prefix to the exception message
|
# 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
|
# Re-raise the original exception with a prefix
|
||||||
prefixed_exception = create_prefixed_exception(first_exception, progress_prefix)
|
prefixed_exception = create_prefixed_exception(first_exception, progress_prefix)
|
||||||
|
|
|
||||||
|
|
@ -1472,8 +1472,7 @@ async def aexport_data(
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Unsupported file format: {file_format}. "
|
f"Unsupported file format: {file_format}. Choose from: csv, excel, md, txt"
|
||||||
f"Choose from: csv, excel, md, txt"
|
|
||||||
)
|
)
|
||||||
if file_format is not None:
|
if file_format is not None:
|
||||||
print(f"Data exported to: {output_path} with format: {file_format}")
|
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 = {
|
request_data = {
|
||||||
"custom_id": f"request-{i+1}",
|
"custom_id": f"request-{i + 1}",
|
||||||
"method": "POST",
|
"method": "POST",
|
||||||
"url": "/v1/chat/completions",
|
"url": "/v1/chat/completions",
|
||||||
"body": {
|
"body": {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue