mirror of
https://github.com/FuzzingLabs/fuzzforge_ai.git
synced 2026-08-15 05:50:21 +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,33 +187,69 @@ 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
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
text: Text to ingest
|
text: Text to ingest
|
||||||
dataset: Dataset name (defaults to project_name_codebase)
|
dataset: Dataset name (defaults to project_name_codebase)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Dict containing ingest results
|
Dict containing ingest results
|
||||||
"""
|
"""
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
await self.initialize()
|
await self.initialize()
|
||||||
|
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return {"error": "Cognee not initialized"}
|
return {"error": "Cognee not initialized"}
|
||||||
|
|
||||||
if not dataset:
|
if not dataset:
|
||||||
dataset = f"{self.project_context['project_name']}_codebase"
|
dataset = f"{self.project_context['project_name']}_codebase"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Add text to dataset
|
# Add text to dataset
|
||||||
await self._cognee.add([text], dataset_name=dataset)
|
await self._cognee.add([text], dataset_name=dataset)
|
||||||
|
|
||||||
# Process (cognify) the dataset
|
# Process (cognify) the dataset
|
||||||
await self._cognee.cognify([dataset])
|
await self._cognee.cognify([dataset])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"text_length": len(text),
|
"text_length": len(text),
|
||||||
"dataset": dataset,
|
"dataset": dataset,
|
||||||
|
|||||||
Reference in New Issue
Block a user