Spaces:
Running
Running
Commit ·
5632471
1
Parent(s): 5d07fc9
add
Browse filesFiles changed (2)
121 unmodified lines122123124125126127128121 unmodified lines# Initialize extraction methodfrom agentgraph.shared.extraction_factory import create_extraction_method, method_requires_line_numbers, method_requires_content_referencesself.extraction_method = create_extraction_method(method_name)self.requires_line_numbers = method_requires_line_numbers(method_name)self.requires_content_references = method_requires_content_references(method_name)121 unmodified lines122123124125126127128129130131132133134135136137138139140141142143121 unmodified lines# Initialize extraction methodfrom agentgraph.shared.extraction_factory import create_extraction_method, method_requires_line_numbers, method_requires_content_references# Pass model parameter to extraction method based on method typeif method_name == "production":# For production method (multi-agent), no model parameter needed here - it's set dynamicallyself.extraction_method = create_extraction_method(method_name)elif method_name == "openai_structured":# For OpenAI structured method, pass the model parameterself.extraction_method = create_extraction_method(method_name, model=model)else:# For other methods, try to pass model parameter if supportedtry:self.extraction_method = create_extraction_method(method_name, model=model)except TypeError:# If method doesn't support model parameter, create without itself.extraction_method = create_extraction_method(method_name)self.requires_line_numbers = method_requires_line_numbers(method_name)self.requires_content_references = method_requires_content_references(method_name)
341 unmodified lines342343344345346347341 unmodified linesdef process_text(self, input_data: str) -> Dict[str, Any]:"""Process text using the extractor."""return self.extractor.process_text(input_data)# Export factory instanceopenai_structured_factory = OpenAIStructuredFactory()341 unmodified lines342343344345346347348349350351341 unmodified linesdef process_text(self, input_data: str) -> Dict[str, Any]:"""Process text using the extractor."""return self.extractor.process_text(input_data)def extract_knowledge_graph(self, input_data: str, context_documents: Optional[List[Dict[str, Any]]] = None) -> KnowledgeGraph:"""Extract knowledge graph using the current model."""return self.extractor.extract_knowledge_graph(input_data, context_documents)# Export factory instanceopenai_structured_factory = OpenAIStructuredFactory()
agentgraph/extraction/graph_processing/knowledge_graph_processor.py+16-1
agentgraph/methods/production/openai_structured_extractor.py+4