Create orchestrator.py
Browse files- orchestrator.py +27 -0
orchestrator.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class Orchestrator:
|
| 2 |
+
def __init__(self):
|
| 3 |
+
# Initialize agents here
|
| 4 |
+
self.text_classification_agent = TextClassificationAgent()
|
| 5 |
+
self.sentiment_analysis_agent = SentimentAnalysisAgent()
|
| 6 |
+
self.summarization_agent = SummarizationAgent()
|
| 7 |
+
self.code_generation_agent = CodeGenerationAgent()
|
| 8 |
+
self.web_search_agent = WebSearchAgent()
|
| 9 |
+
|
| 10 |
+
def handle_request(self, request_type, input_data):
|
| 11 |
+
if request_type == "classification":
|
| 12 |
+
return self.text_classification_agent.classify(input_data)
|
| 13 |
+
elif request_type == "sentiment":
|
| 14 |
+
return self.sentiment_analysis_agent.analyze(input_data)
|
| 15 |
+
elif request_type == "summarization":
|
| 16 |
+
return self.summarization_agent.summarize(input_data)
|
| 17 |
+
elif request_type == "code_generation":
|
| 18 |
+
return self.code_generation_agent.generate_code(input_data)
|
| 19 |
+
elif request_type == "web_search":
|
| 20 |
+
return self.web_search_agent.search(input_data)
|
| 21 |
+
else:
|
| 22 |
+
raise ValueError("Invalid request type")
|
| 23 |
+
|
| 24 |
+
# Example usage:
|
| 25 |
+
orchestrator = Orchestrator()
|
| 26 |
+
result = orchestrator.handle_request("classification", "This is a test input")
|
| 27 |
+
print(result)
|