wu981526092 commited on
Commit
7bc750c
·
1 Parent(s): a6fc11c
Files changed (31) hide show
  1. agentgraph/extraction/graph_utilities/knowledge_graph_merger.py +1 -1
  2. agentgraph/input/text_processing/chunking_service.py +2 -2
  3. agentgraph/methods/baseline/clustering_method.py +6 -4
  4. agentgraph/methods/baseline/direct_llm_method.py +1 -1
  5. agentgraph/methods/baseline/hybrid_method.py +2 -2
  6. agentgraph/methods/baseline/openai_agent.py +1 -1
  7. agentgraph/methods/baseline/original_method.py +2 -2
  8. agentgraph/methods/baseline/pydantic_method.py +6 -6
  9. agentgraph/methods/baseline/unified_method.py +2 -2
  10. agentgraph/methods/cristian/knowledge_graph_agents.py +1 -1
  11. agentgraph/methods/experimental/enhanced_adaptive_extractor.py +2 -2
  12. agentgraph/methods/production/multi_agent_knowledge_extractor.py +6 -6
  13. agentgraph/methods/production/pydantic_multi_agent_knowledge_extractor.py +4 -4
  14. agentgraph/methods/production/task_prompts.py +1 -1
  15. agentgraph/reconstruction/example_rag_usage.py +3 -3
  16. agentgraph/reconstruction/rag_prompt_reconstructor.py +2 -2
  17. agentgraph/testing/knowledge_graph_tester.py +3 -3
  18. agentgraph/testing/perturbation_types/jailbreak.py +3 -3
  19. backend/dependencies.py +2 -2
  20. backend/routers/traces.py +3 -3
  21. backend/services/cost_calculation_service.py +24 -7
  22. backend/services/processing_service.py +3 -3
  23. backend/services/test_service.py +2 -2
  24. backend/services/testing_service.py +3 -3
  25. frontend/src/components/features/traces/TraceKnowledgeGraphView.tsx +1 -1
  26. frontend/src/components/features/traces/TraceOverviewSection.tsx +1 -1
  27. frontend/src/components/shared/FloatingActionWidget.tsx +1 -1
  28. frontend/src/components/shared/modals/TraceDetailsModal.tsx +1 -1
  29. frontend/src/lib/api.ts +1 -1
  30. frontend/src/lib/models.ts +1 -1
  31. utils/config.py +2 -2
agentgraph/extraction/graph_utilities/knowledge_graph_merger.py CHANGED
@@ -70,7 +70,7 @@ class KnowledgeGraphMerger:
70
  Uses CrewAI and specialized agents to perform entity resolution and relationship consolidation.
71
  """
72
 
73
- def __init__(self, model: str = "gpt-4o-mini"):
74
  """
75
  Initialize the knowledge graph merger.
76
 
 
70
  Uses CrewAI and specialized agents to perform entity resolution and relationship consolidation.
71
  """
72
 
73
+ def __init__(self, model: str = "gpt-5-mini"):
74
  """
75
  Initialize the knowledge graph merger.
76
 
agentgraph/input/text_processing/chunking_service.py CHANGED
@@ -30,7 +30,7 @@ class ChunkingService:
30
  trace content with optimal parameters.
31
  """
32
 
33
- def __init__(self, default_batch_size: int = 3, default_model: str = "gpt-4o-mini"):
34
  """
35
  Initialize the chunking service with default parameters.
36
 
@@ -452,4 +452,4 @@ class ChunkingService:
452
  from .trace_line_processor import TraceLineNumberProcessor
453
  processor = TraceLineNumberProcessor()
454
  numbered_content, _ = processor.add_line_numbers(chunk_content, start_line=start_line)
455
- return numbered_content
 
30
  trace content with optimal parameters.
31
  """
32
 
33
+ def __init__(self, default_batch_size: int = 3, default_model: str = "gpt-5-mini"):
34
  """
35
  Initialize the chunking service with default parameters.
36
 
 
452
  from .trace_line_processor import TraceLineNumberProcessor
453
  processor = TraceLineNumberProcessor()
454
  numbered_content, _ = processor.add_line_numbers(chunk_content, start_line=start_line)
455
+ return numbered_content
agentgraph/methods/baseline/clustering_method.py CHANGED
@@ -49,7 +49,7 @@ logging.getLogger("chromadb").setLevel(logging.WARNING)
49
  verbose_level = 0
50
 
51
  # Set environment variables
52
- os.environ["OPENAI_MODEL_NAME"] = "gpt-4o-mini"
53
 
54
 
55
  class ClusteringKnowledgeExtractionMethod(BaseKnowledgeExtractionMethod):
@@ -279,7 +279,9 @@ class ClusteringKnowledgeExtractionMethod(BaseKnowledgeExtractionMethod):
279
 
280
  # Normalize model name to match pricing keys
281
  model_key = model_name.lower()
282
- if "gpt-4o-mini" in model_key:
 
 
283
  model_key = "gpt-4o-mini"
284
  elif "gpt-4o" in model_key:
285
  model_key = "gpt-4o"
@@ -301,8 +303,8 @@ class ClusteringKnowledgeExtractionMethod(BaseKnowledgeExtractionMethod):
301
  model_key = "claude-3-haiku"
302
 
303
  if model_key not in pricing:
304
- # Default to gpt-4o-mini pricing if model not found
305
- model_key = "gpt-4o-mini"
306
 
307
  rates = pricing[model_key]
308
 
 
49
  verbose_level = 0
50
 
51
  # Set environment variables
52
+ os.environ["OPENAI_MODEL_NAME"] = "gpt-5-mini"
53
 
54
 
55
  class ClusteringKnowledgeExtractionMethod(BaseKnowledgeExtractionMethod):
 
279
 
280
  # Normalize model name to match pricing keys
281
  model_key = model_name.lower()
282
+ if "gpt-5-mini" in model_key:
283
+ model_key = "gpt-5-mini"
284
+ elif "gpt-4o-mini" in model_key:
285
  model_key = "gpt-4o-mini"
286
  elif "gpt-4o" in model_key:
287
  model_key = "gpt-4o"
 
303
  model_key = "claude-3-haiku"
304
 
305
  if model_key not in pricing:
306
+ # Default to gpt-5-mini pricing if model not found
307
+ model_key = "gpt-5-mini"
308
 
309
  rates = pricing[model_key]
310
 
agentgraph/methods/baseline/direct_llm_method.py CHANGED
@@ -44,7 +44,7 @@ logging.getLogger("httpx").setLevel(logging.WARNING)
44
  class DirectLLMKnowledgeExtractor(BaseKnowledgeExtractionMethod):
45
  """Direct LLM knowledge extraction method using OpenAI API with structured output."""
46
 
47
- def __init__(self, model: str = "gpt-4o-mini", **kwargs):
48
  super().__init__("direct_llm_method", **kwargs)
49
  self.client = OpenAI()
50
  self.model = model
 
44
  class DirectLLMKnowledgeExtractor(BaseKnowledgeExtractionMethod):
45
  """Direct LLM knowledge extraction method using OpenAI API with structured output."""
46
 
47
+ def __init__(self, model: str = "gpt-5-mini", **kwargs):
48
  super().__init__("direct_llm_method", **kwargs)
49
  self.client = OpenAI()
50
  self.model = model
agentgraph/methods/baseline/hybrid_method.py CHANGED
@@ -47,7 +47,7 @@ logging.getLogger("chromadb").setLevel(logging.WARNING)
47
  verbose_level = 0
48
 
49
  # Set environment variables
50
- os.environ["OPENAI_MODEL_NAME"] = "gpt-4o-mini"
51
 
52
  class HybridKnowledgeExtractionMethod(BaseKnowledgeExtractionMethod):
53
  """Hybrid 2-task knowledge extraction method using CrewAI."""
@@ -286,4 +286,4 @@ class HybridKnowledgeExtractionMethod(BaseKnowledgeExtractionMethod):
286
  logger.error(f"trace_data type: {type(trace_data)}")
287
  if isinstance(trace_data, str):
288
  logger.error(f"trace_data content (first 200 chars): {repr(trace_data[:200])}")
289
- return {"entities": [], "relations": []}
 
47
  verbose_level = 0
48
 
49
  # Set environment variables
50
+ os.environ["OPENAI_MODEL_NAME"] = "gpt-5-mini"
51
 
52
  class HybridKnowledgeExtractionMethod(BaseKnowledgeExtractionMethod):
53
  """Hybrid 2-task knowledge extraction method using CrewAI."""
 
286
  logger.error(f"trace_data type: {type(trace_data)}")
287
  if isinstance(trace_data, str):
288
  logger.error(f"trace_data content (first 200 chars): {repr(trace_data[:200])}")
289
+ return {"entities": [], "relations": []}
agentgraph/methods/baseline/openai_agent.py CHANGED
@@ -350,7 +350,7 @@ class OpenAIAgentKnowledgeExtractor(BaseKnowledgeExtractionMethod):
350
  2. Validation Agent -> Validate generated graph only
351
  """
352
 
353
- def __init__(self, model: str = "gpt-4o-mini", **kwargs):
354
  super().__init__("openai_agent_method", **kwargs)
355
  self.model = model
356
 
 
350
  2. Validation Agent -> Validate generated graph only
351
  """
352
 
353
+ def __init__(self, model: str = "gpt-5-mini", **kwargs):
354
  super().__init__("openai_agent_method", **kwargs)
355
  self.model = model
356
 
agentgraph/methods/baseline/original_method.py CHANGED
@@ -46,7 +46,7 @@ logging.getLogger("chromadb").setLevel(logging.WARNING)
46
  verbose_level = 0
47
 
48
  # Set environment variables
49
- os.environ["OPENAI_MODEL_NAME"] = "gpt-4o-mini"
50
 
51
  class OriginalKnowledgeExtractionMethod(BaseKnowledgeExtractionMethod):
52
  """Original 3-task knowledge extraction method using CrewAI."""
@@ -186,4 +186,4 @@ class OriginalKnowledgeExtractionMethod(BaseKnowledgeExtractionMethod):
186
  return result.get("kg_data", {"entities": [], "relations": []})
187
  else:
188
  # Return empty knowledge graph on failure
189
- return {"entities": [], "relations": []}
 
46
  verbose_level = 0
47
 
48
  # Set environment variables
49
+ os.environ["OPENAI_MODEL_NAME"] = "gpt-5-mini"
50
 
51
  class OriginalKnowledgeExtractionMethod(BaseKnowledgeExtractionMethod):
52
  """Original 3-task knowledge extraction method using CrewAI."""
 
186
  return result.get("kg_data", {"entities": [], "relations": []})
187
  else:
188
  # Return empty knowledge graph on failure
189
+ return {"entities": [], "relations": []}
agentgraph/methods/baseline/pydantic_method.py CHANGED
@@ -46,7 +46,7 @@ logging.getLogger("httpx").setLevel(logging.WARNING)
46
 
47
 
48
  async def get_agent_graph_entities(trace_content: str, temperature: float = 0.0) -> AgentRunResult[List[Entity]]:
49
- model = os.environ.get("OPENAI_MODEL_NAME", "gpt-4o-mini")
50
 
51
  # Use shared prompt templates
52
  system_prompt = ENTITY_EXTRACTION_SYSTEM_PROMPT
@@ -65,7 +65,7 @@ async def get_agent_graph_entities(trace_content: str, temperature: float = 0.0)
65
  async def get_agent_graph_relations(
66
  trace_content: str, entities: Optional[List[Entity]] = None, temperature: float = 0
67
  ) -> AgentRunResult[List[Relation]]:
68
- model = os.environ.get("OPENAI_MODEL_NAME", "gpt-4o-mini")
69
 
70
  # Use shared prompt templates
71
  system_prompt = RELATION_EXTRACTION_SYSTEM_PROMPT
@@ -118,7 +118,7 @@ def validate_knowledge_graph(kg: KnowledgeGraph) -> KnowledgeGraph:
118
 
119
 
120
  async def build_agent_graph(entities: List[Entity], relations: List[Relation], temperature: float = 0.0) -> AgentRunResult[KnowledgeGraph]:
121
- model = os.environ.get("OPENAI_MODEL_NAME", "gpt-4o-mini")
122
 
123
  # Use shared prompt templates
124
  system_prompt = GRAPH_BUILDER_SYSTEM_PROMPT
@@ -141,7 +141,7 @@ async def build_agent_graph(entities: List[Entity], relations: List[Relation], t
141
  # Hybrid method functions
142
  async def get_hybrid_extraction(trace_content: str, temperature: float = 0.0) -> AgentRunResult[str]:
143
  """First stage of hybrid method: combined entity and relation extraction (text output)."""
144
- model = os.environ.get("OPENAI_MODEL_NAME", "gpt-4o-mini")
145
 
146
  role = "Knowledge Extraction Specialist"
147
  goal = "Extract comprehensive entities and relationships from agent system data efficiently"
@@ -177,7 +177,7 @@ Your goal is: {goal}
177
 
178
  async def get_hybrid_validation(extraction_text: str, temperature: float = 0.0) -> AgentRunResult[KnowledgeGraph]:
179
  """Second stage of hybrid method: validation and enhancement (matches original)."""
180
- model = os.environ.get("OPENAI_MODEL_NAME", "gpt-4o-mini")
181
 
182
  role = "Knowledge Graph Validator and Enhancer"
183
  goal = "Validate, enhance, and structure extracted knowledge into a comprehensive knowledge graph"
@@ -306,7 +306,7 @@ async def get_agent_graph(trace_content: str, sequential: bool = False, hybrid:
306
  class PydanticKnowledgeExtractor(BaseKnowledgeExtractionMethod):
307
  """Direct LLM knowledge extraction method using pydantic_ai with structured output."""
308
 
309
- def __init__(self, model: str = "gpt-4o-mini", sequential: bool = False, hybrid: bool = False, temperature: float = 0.0, **kwargs):
310
  method_name = "pydantic_ai_method"
311
  if hybrid:
312
  method_name = "pydantic_hybrid_method"
 
46
 
47
 
48
  async def get_agent_graph_entities(trace_content: str, temperature: float = 0.0) -> AgentRunResult[List[Entity]]:
49
+ model = os.environ.get("OPENAI_MODEL_NAME", "gpt-5-mini")
50
 
51
  # Use shared prompt templates
52
  system_prompt = ENTITY_EXTRACTION_SYSTEM_PROMPT
 
65
  async def get_agent_graph_relations(
66
  trace_content: str, entities: Optional[List[Entity]] = None, temperature: float = 0
67
  ) -> AgentRunResult[List[Relation]]:
68
+ model = os.environ.get("OPENAI_MODEL_NAME", "gpt-5-mini")
69
 
70
  # Use shared prompt templates
71
  system_prompt = RELATION_EXTRACTION_SYSTEM_PROMPT
 
118
 
119
 
120
  async def build_agent_graph(entities: List[Entity], relations: List[Relation], temperature: float = 0.0) -> AgentRunResult[KnowledgeGraph]:
121
+ model = os.environ.get("OPENAI_MODEL_NAME", "gpt-5-mini")
122
 
123
  # Use shared prompt templates
124
  system_prompt = GRAPH_BUILDER_SYSTEM_PROMPT
 
141
  # Hybrid method functions
142
  async def get_hybrid_extraction(trace_content: str, temperature: float = 0.0) -> AgentRunResult[str]:
143
  """First stage of hybrid method: combined entity and relation extraction (text output)."""
144
+ model = os.environ.get("OPENAI_MODEL_NAME", "gpt-5-mini")
145
 
146
  role = "Knowledge Extraction Specialist"
147
  goal = "Extract comprehensive entities and relationships from agent system data efficiently"
 
177
 
178
  async def get_hybrid_validation(extraction_text: str, temperature: float = 0.0) -> AgentRunResult[KnowledgeGraph]:
179
  """Second stage of hybrid method: validation and enhancement (matches original)."""
180
+ model = os.environ.get("OPENAI_MODEL_NAME", "gpt-5-mini")
181
 
182
  role = "Knowledge Graph Validator and Enhancer"
183
  goal = "Validate, enhance, and structure extracted knowledge into a comprehensive knowledge graph"
 
306
  class PydanticKnowledgeExtractor(BaseKnowledgeExtractionMethod):
307
  """Direct LLM knowledge extraction method using pydantic_ai with structured output."""
308
 
309
+ def __init__(self, model: str = "gpt-5-mini", sequential: bool = False, hybrid: bool = False, temperature: float = 0.0, **kwargs):
310
  method_name = "pydantic_ai_method"
311
  if hybrid:
312
  method_name = "pydantic_hybrid_method"
agentgraph/methods/baseline/unified_method.py CHANGED
@@ -47,7 +47,7 @@ logging.getLogger("chromadb").setLevel(logging.WARNING)
47
  verbose_level = 0
48
 
49
  # Set environment variables
50
- os.environ["OPENAI_MODEL_NAME"] = "gpt-4o-mini"
51
 
52
  class UnifiedKnowledgeExtractionMethod(BaseKnowledgeExtractionMethod):
53
  """Unified 1-task knowledge extraction method using CrewAI."""
@@ -228,4 +228,4 @@ class UnifiedKnowledgeExtractionMethod(BaseKnowledgeExtractionMethod):
228
  logger.error(f"trace_data type: {type(trace_data)}")
229
  if isinstance(trace_data, str):
230
  logger.error(f"trace_data content (first 200 chars): {repr(trace_data[:200])}")
231
- return {"entities": [], "relations": []}
 
47
  verbose_level = 0
48
 
49
  # Set environment variables
50
+ os.environ["OPENAI_MODEL_NAME"] = "gpt-5-mini"
51
 
52
  class UnifiedKnowledgeExtractionMethod(BaseKnowledgeExtractionMethod):
53
  """Unified 1-task knowledge extraction method using CrewAI."""
 
228
  logger.error(f"trace_data type: {type(trace_data)}")
229
  if isinstance(trace_data, str):
230
  logger.error(f"trace_data content (first 200 chars): {repr(trace_data[:200])}")
231
+ return {"entities": [], "relations": []}
agentgraph/methods/cristian/knowledge_graph_agents.py CHANGED
@@ -412,7 +412,7 @@ Agent(
412
  role='SQL Query Generator',
413
  goal='Generate accurate Databricks SQL queries based on business requirements',
414
  backstory='You are an expert SQL developer specializing in Databricks SQL Warehouse. You understand complex business logic and can translate natural language requirements into efficient SQL queries.',
415
- llm='gpt-4o-mini'
416
  )
417
  ```
418
 
 
412
  role='SQL Query Generator',
413
  goal='Generate accurate Databricks SQL queries based on business requirements',
414
  backstory='You are an expert SQL developer specializing in Databricks SQL Warehouse. You understand complex business logic and can translate natural language requirements into efficient SQL queries.',
415
+ llm='gpt-5-mini'
416
  )
417
  ```
418
 
agentgraph/methods/experimental/enhanced_adaptive_extractor.py CHANGED
@@ -42,7 +42,7 @@ logging.basicConfig(level=logging.INFO)
42
  logger = logging.getLogger(__name__)
43
 
44
  # Environment setup
45
- os.environ["OPENAI_MODEL_NAME"] = "gpt-4o-mini"
46
 
47
  class ContentSection(BaseModel):
48
  """Represents a section of content for analysis"""
@@ -691,4 +691,4 @@ def create_enhanced_adaptive_crew() -> Crew:
691
  tasks=[], # Tasks are created dynamically
692
  verbose=True,
693
  process=Process.sequential
694
- )
 
42
  logger = logging.getLogger(__name__)
43
 
44
  # Environment setup
45
+ os.environ["OPENAI_MODEL_NAME"] = "gpt-5-mini"
46
 
47
  class ContentSection(BaseModel):
48
  """Represents a section of content for analysis"""
 
691
  tasks=[], # Tasks are created dynamically
692
  verbose=True,
693
  process=Process.sequential
694
+ )
agentgraph/methods/production/multi_agent_knowledge_extractor.py CHANGED
@@ -350,14 +350,14 @@ def format_context_documents(context_documents=None):
350
  return "\n".join(formatted_docs)
351
 
352
 
353
- def extract_knowledge_graph_with_context(input_data, context_documents=None, model="gpt-4o-mini"):
354
  """
355
  Extract knowledge graph using the multi-agent crew with optional context documents.
356
 
357
  Args:
358
  input_data: The trace data to analyze
359
  context_documents: Optional list of context documents to enhance extraction
360
- model: The OpenAI model name to use for extraction (default: gpt-4o-mini)
361
 
362
  Returns:
363
  Knowledge graph extraction result
@@ -390,17 +390,17 @@ def extract_knowledge_graph(input_data):
390
  Returns:
391
  Knowledge graph extraction result
392
  """
393
- return extract_knowledge_graph_with_context(input_data, context_documents=None, model="gpt-4o-mini")
394
 
395
 
396
  # Create a default crew instance for async methods (can be updated by setting model)
397
- agent_monitoring_crew = create_agent_monitoring_crew("gpt-4o-mini")
398
 
399
 
400
  class AgentMonitoringCrewFactory:
401
  """Factory class to create agent monitoring crews with dynamic models."""
402
 
403
- def __init__(self, model: str = "gpt-4o-mini"):
404
  self.model = model
405
  self._crew = None
406
 
@@ -429,4 +429,4 @@ class AgentMonitoringCrewFactory:
429
 
430
 
431
  # This will be imported by the extraction factory
432
- agent_monitoring_crew_factory = AgentMonitoringCrewFactory()
 
350
  return "\n".join(formatted_docs)
351
 
352
 
353
+ def extract_knowledge_graph_with_context(input_data, context_documents=None, model="gpt-5-mini"):
354
  """
355
  Extract knowledge graph using the multi-agent crew with optional context documents.
356
 
357
  Args:
358
  input_data: The trace data to analyze
359
  context_documents: Optional list of context documents to enhance extraction
360
+ model: The OpenAI model name to use for extraction (default: gpt-5-mini)
361
 
362
  Returns:
363
  Knowledge graph extraction result
 
390
  Returns:
391
  Knowledge graph extraction result
392
  """
393
+ return extract_knowledge_graph_with_context(input_data, context_documents=None, model="gpt-5-mini")
394
 
395
 
396
  # Create a default crew instance for async methods (can be updated by setting model)
397
+ agent_monitoring_crew = create_agent_monitoring_crew("gpt-5-mini")
398
 
399
 
400
  class AgentMonitoringCrewFactory:
401
  """Factory class to create agent monitoring crews with dynamic models."""
402
 
403
+ def __init__(self, model: str = "gpt-5-mini"):
404
  self.model = model
405
  self._crew = None
406
 
 
429
 
430
 
431
  # This will be imported by the extraction factory
432
+ agent_monitoring_crew_factory = AgentMonitoringCrewFactory()
agentgraph/methods/production/pydantic_multi_agent_knowledge_extractor.py CHANGED
@@ -163,7 +163,7 @@ def _ensure_event_loop():
163
  def extract_knowledge_graph_with_context(
164
  input_data: str,
165
  context_documents: Optional[List[Dict[str, Any]]] = None,
166
- model: str = "gpt-4o-mini",
167
  ):
168
  """Replicates `extract_knowledge_graph_with_context` but using Pydantic-AI.
169
 
@@ -220,7 +220,7 @@ def extract_knowledge_graph(input_data: str):
220
  return extract_knowledge_graph_with_context(
221
  input_data=input_data,
222
  context_documents=None,
223
- model="gpt-4o-mini",
224
  )
225
 
226
  # ---------------------------------------------------------------------------
@@ -230,7 +230,7 @@ def extract_knowledge_graph(input_data: str):
230
  class PydanticAICrewFactory:
231
  """Factory that mimics the AgentMonitoringCrewFactory interface but powered by Pydantic-AI."""
232
 
233
- def __init__(self, model: str = "gpt-4o-mini"):
234
  self.model = model
235
 
236
  def set_model(self, model: str):
@@ -267,4 +267,4 @@ PydanticAgentMonitoringFactory = PydanticAICrewFactory
267
 
268
  # Simple progress printing helper
269
  def _log(step: str):
270
- print(f"[PydanticAI] {step}")
 
163
  def extract_knowledge_graph_with_context(
164
  input_data: str,
165
  context_documents: Optional[List[Dict[str, Any]]] = None,
166
+ model: str = "gpt-5-mini",
167
  ):
168
  """Replicates `extract_knowledge_graph_with_context` but using Pydantic-AI.
169
 
 
220
  return extract_knowledge_graph_with_context(
221
  input_data=input_data,
222
  context_documents=None,
223
+ model="gpt-5-mini",
224
  )
225
 
226
  # ---------------------------------------------------------------------------
 
230
  class PydanticAICrewFactory:
231
  """Factory that mimics the AgentMonitoringCrewFactory interface but powered by Pydantic-AI."""
232
 
233
+ def __init__(self, model: str = "gpt-5-mini"):
234
  self.model = model
235
 
236
  def set_model(self, model: str):
 
267
 
268
  # Simple progress printing helper
269
  def _log(step: str):
270
+ print(f"[PydanticAI] {step}")
agentgraph/methods/production/task_prompts.py CHANGED
@@ -421,7 +421,7 @@ ENTITY_EXTRACTION_INSTRUCTION_PROMPT = """
421
  role='SQL Query Generator',
422
  goal='Generate accurate Databricks SQL queries based on business requirements',
423
  backstory='You are an expert SQL developer specializing in Databricks SQL Warehouse. You understand complex business logic and can translate natural language requirements into efficient SQL queries.',
424
- llm='gpt-4o-mini'
425
  )
426
  ```
427
 
 
421
  role='SQL Query Generator',
422
  goal='Generate accurate Databricks SQL queries based on business requirements',
423
  backstory='You are an expert SQL developer specializing in Databricks SQL Warehouse. You understand complex business logic and can translate natural language requirements into efficient SQL queries.',
424
+ llm='gpt-5-mini'
425
  )
426
  ```
427
 
agentgraph/reconstruction/example_rag_usage.py CHANGED
@@ -60,7 +60,7 @@ def example_usage():
60
  reconstructed_relations = reconstruct_prompts_from_knowledge_graph_rag(
61
  knowledge_graph=knowledge_graph,
62
  original_trace=original_trace,
63
- llm_config={"model": "gpt-4o-mini", "temperature": 0.1}
64
  )
65
 
66
  for relation in reconstructed_relations:
@@ -76,7 +76,7 @@ def example_usage():
76
  reconstructor = RagPromptReconstructor(
77
  knowledge_graph=knowledge_graph,
78
  original_trace=original_trace,
79
- llm_config={"model": "gpt-4o-mini", "temperature": 0.1}
80
  )
81
 
82
  # Reconstruct a specific relation
@@ -97,4 +97,4 @@ def example_usage():
97
  print(f"Reconstruction metadata: {enriched_kg.get('reconstruction_metadata', {})}")
98
 
99
  if __name__ == "__main__":
100
- example_usage()
 
60
  reconstructed_relations = reconstruct_prompts_from_knowledge_graph_rag(
61
  knowledge_graph=knowledge_graph,
62
  original_trace=original_trace,
63
+ llm_config={"model": "gpt-5-mini", "temperature": 0.1}
64
  )
65
 
66
  for relation in reconstructed_relations:
 
76
  reconstructor = RagPromptReconstructor(
77
  knowledge_graph=knowledge_graph,
78
  original_trace=original_trace,
79
+ llm_config={"model": "gpt-5-mini", "temperature": 0.1}
80
  )
81
 
82
  # Reconstruct a specific relation
 
97
  print(f"Reconstruction metadata: {enriched_kg.get('reconstruction_metadata', {})}")
98
 
99
  if __name__ == "__main__":
100
+ example_usage()
agentgraph/reconstruction/rag_prompt_reconstructor.py CHANGED
@@ -70,7 +70,7 @@ class RagPromptReconstructor:
70
  return LLM(**llm_config)
71
 
72
  return LLM(
73
- model="gpt-4o-mini",
74
  temperature=0.1,
75
  )
76
 
@@ -423,4 +423,4 @@ def enrich_knowledge_graph_with_prompts_rag(knowledge_graph: Dict[str, Any],
423
  "original_trace_length": len(original_trace)
424
  }
425
 
426
- return enhanced_kg
 
70
  return LLM(**llm_config)
71
 
72
  return LLM(
73
+ model="gpt-5-mini",
74
  temperature=0.1,
75
  )
76
 
 
423
  "original_trace_length": len(original_trace)
424
  }
425
 
426
+ return enhanced_kg
agentgraph/testing/knowledge_graph_tester.py CHANGED
@@ -81,9 +81,9 @@ def load_litellm_config(model: str = "gpt-5-mini", api_key: str = None):
81
  def run_knowledge_graph_tests(
82
  testing_data: Dict[str, Any],
83
  perturbation_types: List[str],
84
- model: str = "gpt-4o-mini",
85
  max_relations: int = None,
86
- judge_model: str = "gpt-4o-mini",
87
  openai_api_key: str = None,
88
  progress_callback: Optional[Callable[[int, int, str], None]] = None,
89
  **kwargs
@@ -132,4 +132,4 @@ def run_knowledge_graph_tests(
132
 
133
 
134
  if __name__ == '__main__':
135
- sys.exit(0)
 
81
  def run_knowledge_graph_tests(
82
  testing_data: Dict[str, Any],
83
  perturbation_types: List[str],
84
+ model: str = "gpt-5-mini",
85
  max_relations: int = None,
86
+ judge_model: str = "gpt-5-mini",
87
  openai_api_key: str = None,
88
  progress_callback: Optional[Callable[[int, int, str], None]] = None,
89
  **kwargs
 
132
 
133
 
134
  if __name__ == '__main__':
135
+ sys.exit(0)
agentgraph/testing/perturbation_types/jailbreak.py CHANGED
@@ -244,9 +244,9 @@ def test_relation_jailbreak(
244
 
245
  def run_jailbreak_tests(
246
  testing_data: Dict[str, Any],
247
- model: str = "gpt-4o-mini",
248
  max_relations: int = None,
249
- judge_model: str = "gpt-4o-mini",
250
  openai_api_key: str = None,
251
  progress_callback: Optional[Callable[[int, int, str], None]] = None,
252
  **kwargs
@@ -351,4 +351,4 @@ def run_jailbreak_tests(
351
 
352
  logger.info(f"Jailbreak testing completed: {results['summary']['successful_tests']}/{results['summary']['total_tested']} successful")
353
 
354
- return results
 
244
 
245
  def run_jailbreak_tests(
246
  testing_data: Dict[str, Any],
247
+ model: str = "gpt-5-mini",
248
  max_relations: int = None,
249
+ judge_model: str = "gpt-5-mini",
250
  openai_api_key: str = None,
251
  progress_callback: Optional[Callable[[int, int, str], None]] = None,
252
  **kwargs
 
351
 
352
  logger.info(f"Jailbreak testing completed: {results['summary']['successful_tests']}/{results['summary']['total_tested']} successful")
353
 
354
+ return results
backend/dependencies.py CHANGED
@@ -56,7 +56,7 @@ def get_knowledge_graph_tester(kg_path: Optional[str] = None) -> Any:
56
  knowledge_graph_path = kg_path or DEFAULT_KNOWLEDGE_GRAPH
57
  knowledge_graph_tester = KnowledgeGraphTester(
58
  knowledge_graph_path=knowledge_graph_path,
59
- model="gpt-4o" # Default model
60
  )
61
  logger.info(f"Initialized KnowledgeGraphTester with {knowledge_graph_path}")
62
  except Exception as e:
@@ -90,4 +90,4 @@ def get_prompt_reconstructor() -> Any:
90
  detail=f"Error initializing reconstructor: {str(e)}"
91
  )
92
 
93
- return prompt_reconstructor
 
56
  knowledge_graph_path = kg_path or DEFAULT_KNOWLEDGE_GRAPH
57
  knowledge_graph_tester = KnowledgeGraphTester(
58
  knowledge_graph_path=knowledge_graph_path,
59
+ model="gpt-5-mini" # Default model
60
  )
61
  logger.info(f"Initialized KnowledgeGraphTester with {knowledge_graph_path}")
62
  except Exception as e:
 
90
  detail=f"Error initializing reconstructor: {str(e)}"
91
  )
92
 
93
+ return prompt_reconstructor
backend/routers/traces.py CHANGED
@@ -985,7 +985,7 @@ async def get_enhanced_trace_statistics(trace_id: str, db: Session = Depends(get
985
  "input_cost_usd": cost_info.get("input_cost_usd", 0.0),
986
  "output_cost_usd": cost_info.get("output_cost_usd", 0.0),
987
  "avg_cost_per_call_usd": cost_info.get("avg_cost_per_call_usd", 0.0),
988
- "model_used": cost_info.get("model_used", "gpt-4o-mini"),
989
  "pricing_source": cost_info.get("pricing_source", "fallback"),
990
  "cost_efficiency_tokens_per_dollar": cost_info.get("cost_efficiency_tokens_per_dollar", 0),
991
  "model_metadata": cost_info.get("model_metadata"),
@@ -1072,7 +1072,7 @@ class ProcessTraceRequest(BaseModel):
1072
  splitter_type: str = "agent_semantic"
1073
  force_regenerate: bool = True
1074
  method_name: str = "production"
1075
- model: str = "gpt-4o-mini"
1076
  chunking_config: Optional[ChunkingConfig] = None
1077
 
1078
  @router.post("/{trace_id}/process")
@@ -1133,4 +1133,4 @@ async def process_trace(
1133
  raise HTTPException(
1134
  status_code=500,
1135
  detail=f"Error starting trace processing: {str(e)}"
1136
- )
 
985
  "input_cost_usd": cost_info.get("input_cost_usd", 0.0),
986
  "output_cost_usd": cost_info.get("output_cost_usd", 0.0),
987
  "avg_cost_per_call_usd": cost_info.get("avg_cost_per_call_usd", 0.0),
988
+ "model_used": cost_info.get("model_used", "gpt-5-mini"),
989
  "pricing_source": cost_info.get("pricing_source", "fallback"),
990
  "cost_efficiency_tokens_per_dollar": cost_info.get("cost_efficiency_tokens_per_dollar", 0),
991
  "model_metadata": cost_info.get("model_metadata"),
 
1072
  splitter_type: str = "agent_semantic"
1073
  force_regenerate: bool = True
1074
  method_name: str = "production"
1075
+ model: str = "gpt-5-mini"
1076
  chunking_config: Optional[ChunkingConfig] = None
1077
 
1078
  @router.post("/{trace_id}/process")
 
1133
  raise HTTPException(
1134
  status_code=500,
1135
  detail=f"Error starting trace processing: {str(e)}"
1136
+ )
backend/services/cost_calculation_service.py CHANGED
@@ -39,6 +39,21 @@ class CostCalculationService:
39
  def _get_fallback_pricing_data(self) -> Dict[str, Any]:
40
  """Return fallback pricing data if GitHub fetch fails."""
41
  return {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  "gpt-4o-mini": {
43
  "input_cost_per_token": 0.00000015,
44
  "output_cost_per_token": 0.0000006,
@@ -134,7 +149,7 @@ class CostCalculationService:
134
  def _normalize_model_name(self, model_name: str) -> str:
135
  """Normalize model name to match pricing keys."""
136
  if not model_name:
137
- return "gpt-4o-mini" # Default fallback
138
 
139
  model_lower = model_name.lower()
140
 
@@ -142,7 +157,9 @@ class CostCalculationService:
142
  model_lower = re.sub(r'^(openai/|anthropic/|gpt-|claude-)', '', model_lower)
143
 
144
  # Handle GPT models
145
- if "gpt-4o-mini" in model_lower:
 
 
146
  return "gpt-4o-mini"
147
  elif "gpt-4o" in model_lower:
148
  return "gpt-4o"
@@ -162,7 +179,7 @@ class CostCalculationService:
162
  return "claude-3-opus-20240229"
163
 
164
  # Default fallback
165
- return "gpt-4o-mini"
166
 
167
  def calculate_cost(
168
  self,
@@ -201,7 +218,7 @@ class CostCalculationService:
201
  # Fallback to default model if not found
202
  if not model_pricing:
203
  fallback_data = self._get_fallback_pricing_data()
204
- model_pricing = fallback_data.get(normalized_model, fallback_data["gpt-4o-mini"])
205
 
206
  # Extract pricing information
207
  input_cost_per_token = model_pricing.get("input_cost_per_token", 0.00000015)
@@ -270,9 +287,9 @@ class CostCalculationService:
270
  total_completion_tokens = token_analytics.get("total_completion_tokens", 0)
271
  prompt_calls = prompt_analytics.get("prompt_calls_detected", 0)
272
 
273
- # For now, assume gpt-4o-mini as default model since we don't store model info in trace
274
  # In future versions, this could be enhanced to detect model from trace content
275
- default_model = "gpt-4o-mini"
276
 
277
  cost_info = self.calculate_cost(default_model, total_prompt_tokens, total_completion_tokens)
278
 
@@ -295,4 +312,4 @@ class CostCalculationService:
295
  return {"error": str(e)}
296
 
297
  # Global instance
298
- cost_service = CostCalculationService()
 
39
  def _get_fallback_pricing_data(self) -> Dict[str, Any]:
40
  """Return fallback pricing data if GitHub fetch fails."""
41
  return {
42
+ "gpt-5-mini": {
43
+ "input_cost_per_token": 0.00000015,
44
+ "output_cost_per_token": 0.0000006,
45
+ "max_tokens": 128000,
46
+ "max_input_tokens": 128000,
47
+ "max_output_tokens": 16384,
48
+ "litellm_provider": "openai",
49
+ "mode": "chat",
50
+ "supports_function_calling": True,
51
+ "supports_vision": True,
52
+ "supports_response_schema": True,
53
+ "supports_prompt_caching": False,
54
+ "supports_system_messages": True,
55
+ "supports_tool_choice": True
56
+ },
57
  "gpt-4o-mini": {
58
  "input_cost_per_token": 0.00000015,
59
  "output_cost_per_token": 0.0000006,
 
149
  def _normalize_model_name(self, model_name: str) -> str:
150
  """Normalize model name to match pricing keys."""
151
  if not model_name:
152
+ return "gpt-5-mini" # Default fallback
153
 
154
  model_lower = model_name.lower()
155
 
 
157
  model_lower = re.sub(r'^(openai/|anthropic/|gpt-|claude-)', '', model_lower)
158
 
159
  # Handle GPT models
160
+ if "gpt-5-mini" in model_lower:
161
+ return "gpt-5-mini"
162
+ elif "gpt-4o-mini" in model_lower:
163
  return "gpt-4o-mini"
164
  elif "gpt-4o" in model_lower:
165
  return "gpt-4o"
 
179
  return "claude-3-opus-20240229"
180
 
181
  # Default fallback
182
+ return "gpt-5-mini"
183
 
184
  def calculate_cost(
185
  self,
 
218
  # Fallback to default model if not found
219
  if not model_pricing:
220
  fallback_data = self._get_fallback_pricing_data()
221
+ model_pricing = fallback_data.get(normalized_model, fallback_data["gpt-5-mini"])
222
 
223
  # Extract pricing information
224
  input_cost_per_token = model_pricing.get("input_cost_per_token", 0.00000015)
 
287
  total_completion_tokens = token_analytics.get("total_completion_tokens", 0)
288
  prompt_calls = prompt_analytics.get("prompt_calls_detected", 0)
289
 
290
+ # For now, assume gpt-5-mini as default model since we don't store model info in trace
291
  # In future versions, this could be enhanced to detect model from trace content
292
+ default_model = "gpt-5-mini"
293
 
294
  cost_info = self.calculate_cost(default_model, total_prompt_tokens, total_completion_tokens)
295
 
 
312
  return {"error": str(e)}
313
 
314
  # Global instance
315
+ cost_service = CostCalculationService()
backend/services/processing_service.py CHANGED
@@ -18,7 +18,7 @@ class PipelineError(Exception):
18
  """Exception raised for errors in the pipeline processing."""
19
  pass
20
 
21
- async def process_trace_task(trace_id: str, session: Session, task_id: str = None, splitter_type: str = "agent_semantic", force_regenerate: bool = False, method_name: str = "production", model: str = "gpt-4o-mini", chunking_config = None) -> Dict[str, Any]:
22
  """
23
  Process a single trace and return the merged knowledge graph with proper timeout handling.
24
  """
@@ -73,7 +73,7 @@ async def process_trace_task(trace_id: str, session: Session, task_id: str = Non
73
 
74
  chunking_service = ChunkingService(
75
  default_batch_size=3,
76
- default_model="gpt-4o-mini"
77
  )
78
 
79
  check_timeout()
@@ -272,4 +272,4 @@ async def process_trace_task(trace_id: str, session: Session, task_id: str = Non
272
  except Exception as update_error:
273
  logger.error(f"Failed to update trace status: {update_error}")
274
 
275
- raise PipelineError(error_message)
 
18
  """Exception raised for errors in the pipeline processing."""
19
  pass
20
 
21
+ async def process_trace_task(trace_id: str, session: Session, task_id: str = None, splitter_type: str = "agent_semantic", force_regenerate: bool = False, method_name: str = "production", model: str = "gpt-5-mini", chunking_config = None) -> Dict[str, Any]:
22
  """
23
  Process a single trace and return the merged knowledge graph with proper timeout handling.
24
  """
 
73
 
74
  chunking_service = ChunkingService(
75
  default_batch_size=3,
76
+ default_model="gpt-5-mini"
77
  )
78
 
79
  check_timeout()
 
272
  except Exception as update_error:
273
  logger.error(f"Failed to update trace status: {update_error}")
274
 
275
+ raise PipelineError(error_message)
backend/services/test_service.py CHANGED
@@ -84,7 +84,7 @@ class TestService:
84
  def run_perturbation_test(
85
  tester,
86
  knowledge_graph: str,
87
- model: str = "gpt-4o",
88
  perturbation_type: str = "jailbreak",
89
  relation_type: str = "",
90
  max_jailbreaks: int = 5,
@@ -383,4 +383,4 @@ class TestService:
383
  return {
384
  "exists": False,
385
  "error": str(e)
386
- }
 
84
  def run_perturbation_test(
85
  tester,
86
  knowledge_graph: str,
87
+ model: str = "gpt-5-mini",
88
  perturbation_type: str = "jailbreak",
89
  relation_type: str = "",
90
  max_jailbreaks: int = 5,
 
383
  return {
384
  "exists": False,
385
  "error": str(e)
386
+ }
backend/services/testing_service.py CHANGED
@@ -407,7 +407,7 @@ async def perturb_knowledge_graph_task(kg_id: str, task_id: str) -> bool:
407
  test_results = run_knowledge_graph_tests(
408
  testing_data=testing_data,
409
  perturbation_types=["jailbreak", "counterfactual_bias"],
410
- model="gpt-4o-mini",
411
  progress_callback=progress_callback,
412
  )
413
  update_task_status(task_id, "RUNNING", "Tests completed, saving results", 80)
@@ -438,7 +438,7 @@ async def perturb_knowledge_graph_task(kg_id: str, task_id: str) -> bool:
438
  test_result=relation_result,
439
  perturbation_score=relation_result.get("perturbation_score"),
440
  test_metadata={
441
- "model": "gpt-4o-mini",
442
  'test_timestamp': datetime.now(timezone.utc).isoformat(),
443
  }
444
  )
@@ -459,4 +459,4 @@ async def perturb_knowledge_graph_task(kg_id: str, task_id: str) -> bool:
459
  logger.error(error_message)
460
  logger.error(traceback.format_exc())
461
  update_task_status(task_id, "FAILED", error_message)
462
- return False
 
407
  test_results = run_knowledge_graph_tests(
408
  testing_data=testing_data,
409
  perturbation_types=["jailbreak", "counterfactual_bias"],
410
+ model="gpt-5-mini",
411
  progress_callback=progress_callback,
412
  )
413
  update_task_status(task_id, "RUNNING", "Tests completed, saving results", 80)
 
438
  test_result=relation_result,
439
  perturbation_score=relation_result.get("perturbation_score"),
440
  test_metadata={
441
+ "model": "gpt-5-mini",
442
  'test_timestamp': datetime.now(timezone.utc).isoformat(),
443
  }
444
  )
 
459
  logger.error(error_message)
460
  logger.error(traceback.format_exc())
461
  update_task_status(task_id, "FAILED", error_message)
462
+ return False
frontend/src/components/features/traces/TraceKnowledgeGraphView.tsx CHANGED
@@ -437,7 +437,7 @@ export function TraceKnowledgeGraphView({
437
  chunkingConfig?: { min_chunk_size?: number; max_chunk_size?: number }
438
  ) => {
439
  const finalMethodName = methodName || "production";
440
- const finalModel = model || "gpt-4o-mini";
441
  console.log("TraceKnowledgeGraphView: Using method name:", finalMethodName);
442
  console.log("TraceKnowledgeGraphView: Using model:", finalModel);
443
  console.log(
 
437
  chunkingConfig?: { min_chunk_size?: number; max_chunk_size?: number }
438
  ) => {
439
  const finalMethodName = methodName || "production";
440
+ const finalModel = model || "gpt-5-mini";
441
  console.log("TraceKnowledgeGraphView: Using method name:", finalMethodName);
442
  console.log("TraceKnowledgeGraphView: Using model:", finalModel);
443
  console.log(
frontend/src/components/features/traces/TraceOverviewSection.tsx CHANGED
@@ -317,7 +317,7 @@ export function TraceOverviewSection({
317
  {/* Left side: Model and Cost */}
318
  <div className="flex-1">
319
  <p className="text-lg font-bold text-green-800 mb-1">
320
- {enhancedStats?.cost?.model_used || "gpt-4o-mini"}
321
  </p>
322
  <p className="text-base font-semibold text-green-600">
323
  Avg:{" "}
 
317
  {/* Left side: Model and Cost */}
318
  <div className="flex-1">
319
  <p className="text-lg font-bold text-green-800 mb-1">
320
+ {enhancedStats?.cost?.model_used || "gpt-5-mini"}
321
  </p>
322
  <p className="text-base font-semibold text-green-600">
323
  Avg:{" "}
frontend/src/components/shared/FloatingActionWidget.tsx CHANGED
@@ -268,7 +268,7 @@ export function FloatingActionWidget() {
268
  splitterType,
269
  true, // force_regenerate = true to allow generating new graphs even if existing ones exist
270
  finalMethodName,
271
- modelName || "gpt-4o-mini",
272
  chunkingConfig
273
  );
274
 
 
268
  splitterType,
269
  true, // force_regenerate = true to allow generating new graphs even if existing ones exist
270
  finalMethodName,
271
+ modelName || "gpt-5-mini",
272
  chunkingConfig
273
  );
274
 
frontend/src/components/shared/modals/TraceDetailsModal.tsx CHANGED
@@ -260,7 +260,7 @@ This action cannot be undone.`;
260
  splitterType,
261
  true,
262
  finalMethodName,
263
- modelName || "gpt-4o-mini",
264
  chunkingConfig
265
  );
266
 
 
260
  splitterType,
261
  true,
262
  finalMethodName,
263
+ modelName || "gpt-5-mini",
264
  chunkingConfig
265
  );
266
 
frontend/src/lib/api.ts CHANGED
@@ -180,7 +180,7 @@ export const api = {
180
  splitterType: string = "agent_semantic",
181
  forceRegenerate: boolean = true,
182
  methodName: string = "production",
183
- model: string = "gpt-4o-mini",
184
  chunkingConfig?: { min_chunk_size?: number; max_chunk_size?: number }
185
  ) => {
186
  const requestBody = {
 
180
  splitterType: string = "agent_semantic",
181
  forceRegenerate: boolean = true,
182
  methodName: string = "production",
183
+ model: string = "gpt-5-mini",
184
  chunkingConfig?: { min_chunk_size?: number; max_chunk_size?: number }
185
  ) => {
186
  const requestBody = {
frontend/src/lib/models.ts CHANGED
@@ -117,7 +117,7 @@ export const getModelById = (modelId: string): ModelConfig | undefined => {
117
  return allModels.find((model) => model.id === modelId);
118
  };
119
 
120
- export const getDefaultModel = (): string => "gpt-4o-mini";
121
 
122
  export function getCurrentModelName(): string {
123
  try {
 
117
  return allModels.find((model) => model.id === modelId);
118
  };
119
 
120
+ export const getDefaultModel = (): string => "gpt-5-mini";
121
 
122
  export function getCurrentModelName(): string {
123
  try {
utils/config.py CHANGED
@@ -8,7 +8,7 @@ load_dotenv(dotenv_path=env_path)
8
 
9
  # OpenAI Configuration
10
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
11
- OPENAI_MODEL_NAME = os.getenv("OPENAI_MODEL_NAME", "gpt-4o-mini")
12
 
13
  AZURE_API_KEY = os.getenv("AZURE_API_KEY")
14
  AZURE_API_BASE = os.getenv("AZURE_API_BASE")
@@ -44,4 +44,4 @@ def validate_config():
44
  print(f"Please set them in the .env file or as environment variables")
45
  return False
46
 
47
- return True
 
8
 
9
  # OpenAI Configuration
10
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
11
+ OPENAI_MODEL_NAME = os.getenv("OPENAI_MODEL_NAME", "gpt-5-mini")
12
 
13
  AZURE_API_KEY = os.getenv("AZURE_API_KEY")
14
  AZURE_API_BASE = os.getenv("AZURE_API_BASE")
 
44
  print(f"Please set them in the .env file or as environment variables")
45
  return False
46
 
47
+ return True