mirror of
https://github.com/FuzzingLabs/fuzzforge_ai.git
synced 2026-08-15 11:40:18 +02:00
fix: Add missing cognify_text method to CogneeProjectIntegration
Resolves AttributeError when agent_executor calls cognify_text(). The method adds text to a dataset and cognifies it into a knowledge graph.
This commit is contained in:
@@ -187,6 +187,42 @@ class CogneeProjectIntegration:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
return {"error": f"Failed to list data: {e}"}
|
return {"error": f"Failed to list data: {e}"}
|
||||||
|
|
||||||
|
async def cognify_text(self, text: str, dataset: str = None) -> Dict[str, Any]:
|
||||||
|
"""
|
||||||
|
Cognify text content into knowledge graph
|
||||||
|
|
||||||
|
Args:
|
||||||
|
text: Text to cognify
|
||||||
|
dataset: Dataset name (defaults to project_name_codebase)
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Dict containing cognify results
|
||||||
|
"""
|
||||||
|
if not self._initialized:
|
||||||
|
await self.initialize()
|
||||||
|
|
||||||
|
if not self._initialized:
|
||||||
|
return {"error": "Cognee not initialized"}
|
||||||
|
|
||||||
|
if not dataset:
|
||||||
|
dataset = f"{self.project_context['project_name']}_codebase"
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Add text to dataset
|
||||||
|
await self._cognee.add([text], dataset_name=dataset)
|
||||||
|
|
||||||
|
# Process (cognify) the dataset
|
||||||
|
await self._cognee.cognify([dataset])
|
||||||
|
|
||||||
|
return {
|
||||||
|
"text_length": len(text),
|
||||||
|
"dataset": dataset,
|
||||||
|
"project": self.project_context["project_name"],
|
||||||
|
"status": "success"
|
||||||
|
}
|
||||||
|
except Exception as e:
|
||||||
|
return {"error": f"Cognify failed: {e}"}
|
||||||
|
|
||||||
async def ingest_text_to_dataset(self, text: str, dataset: str = None) -> Dict[str, Any]:
|
async def ingest_text_to_dataset(self, text: str, dataset: str = None) -> Dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
Ingest text content into a specific dataset
|
Ingest text content into a specific dataset
|
||||||
|
|||||||
Reference in New Issue
Block a user