wu981526092 commited on
Commit
5632471
·
1 Parent(s): 5d07fc9
agentgraph/extraction/graph_processing/knowledge_graph_processor.py CHANGED
@@ -122,7 +122,22 @@ class SlidingWindowMonitor:
122
 
123
  # Initialize extraction method
124
  from agentgraph.shared.extraction_factory import create_extraction_method, method_requires_line_numbers, method_requires_content_references
125
- self.extraction_method = create_extraction_method(method_name)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  self.requires_line_numbers = method_requires_line_numbers(method_name)
127
  self.requires_content_references = method_requires_content_references(method_name)
128
 
 
122
 
123
  # Initialize extraction method
124
  from agentgraph.shared.extraction_factory import create_extraction_method, method_requires_line_numbers, method_requires_content_references
125
+
126
+ # Pass model parameter to extraction method based on method type
127
+ if method_name == "production":
128
+ # For production method (multi-agent), no model parameter needed here - it's set dynamically
129
+ self.extraction_method = create_extraction_method(method_name)
130
+ elif method_name == "openai_structured":
131
+ # For OpenAI structured method, pass the model parameter
132
+ self.extraction_method = create_extraction_method(method_name, model=model)
133
+ else:
134
+ # For other methods, try to pass model parameter if supported
135
+ try:
136
+ self.extraction_method = create_extraction_method(method_name, model=model)
137
+ except TypeError:
138
+ # If method doesn't support model parameter, create without it
139
+ self.extraction_method = create_extraction_method(method_name)
140
+
141
  self.requires_line_numbers = method_requires_line_numbers(method_name)
142
  self.requires_content_references = method_requires_content_references(method_name)
143
 
agentgraph/methods/production/openai_structured_extractor.py CHANGED
@@ -342,6 +342,10 @@ class OpenAIStructuredFactory:
342
  def process_text(self, input_data: str) -> Dict[str, Any]:
343
  """Process text using the extractor."""
344
  return self.extractor.process_text(input_data)
 
 
 
 
345
 
346
  # Export factory instance
347
  openai_structured_factory = OpenAIStructuredFactory()
 
342
  def process_text(self, input_data: str) -> Dict[str, Any]:
343
  """Process text using the extractor."""
344
  return self.extractor.process_text(input_data)
345
+
346
+ def extract_knowledge_graph(self, input_data: str, context_documents: Optional[List[Dict[str, Any]]] = None) -> KnowledgeGraph:
347
+ """Extract knowledge graph using the current model."""
348
+ return self.extractor.extract_knowledge_graph(input_data, context_documents)
349
 
350
  # Export factory instance
351
  openai_structured_factory = OpenAIStructuredFactory()