|
class Orchestrator: |
|
def __init__(self): |
|
|
|
self.text_classification_agent = TextClassificationAgent() |
|
self.sentiment_analysis_agent = SentimentAnalysisAgent() |
|
self.summarization_agent = SummarizationAgent() |
|
self.code_generation_agent = CodeGenerationAgent() |
|
self.web_search_agent = WebSearchAgent() |
|
|
|
def handle_request(self, request_type, input_data): |
|
if request_type == "classification": |
|
return self.text_classification_agent.classify(input_data) |
|
elif request_type == "sentiment": |
|
return self.sentiment_analysis_agent.analyze(input_data) |
|
elif request_type == "summarization": |
|
return self.summarization_agent.summarize(input_data) |
|
elif request_type == "code_generation": |
|
return self.code_generation_agent.generate_code(input_data) |
|
elif request_type == "web_search": |
|
return self.web_search_agent.search(input_data) |
|
else: |
|
raise ValueError("Invalid request type") |
|
|
|
|
|
orchestrator = Orchestrator() |
|
result = orchestrator.handle_request("classification", "This is a test input") |
|
print(result) |
|
|