Skip to content

Commit ec1aba2

Browse files
authored
Merge pull request #31 from GYFX35/feat/add-new-ai-roles-7826620215432288341
feat: Add business strategist, IT support, and data scientist roles
2 parents 3572398 + e2688bd commit ec1aba2

File tree

2 files changed

+108
-0
lines changed

2 files changed

+108
-0
lines changed

app.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,39 @@ def automate_script_endpoint():
774774
return jsonify({"status": "success", "message": message})
775775

776776

777+
@app.route('/api/v1/business/strategy', methods=['POST'])
778+
@require_api_key
779+
def business_strategy_endpoint():
780+
data = request.get_json()
781+
prompt = data.get('prompt')
782+
if not prompt:
783+
return jsonify({"error": _("Prompt is required")}), 400
784+
message = google_ai.generate_business_strategy(prompt)
785+
return jsonify({"status": "success", "message": message})
786+
787+
788+
@app.route('/api/v1/support/it', methods=['POST'])
789+
@require_api_key
790+
def it_support_endpoint():
791+
data = request.get_json()
792+
prompt = data.get('prompt')
793+
if not prompt:
794+
return jsonify({"error": _("Prompt is required")}), 400
795+
message = google_ai.provide_it_support(prompt)
796+
return jsonify({"status": "success", "message": message})
797+
798+
799+
@app.route('/api/v1/data/analyze', methods=['POST'])
800+
@require_api_key
801+
def analyze_data_endpoint():
802+
data = request.get_json()
803+
prompt = data.get('prompt')
804+
if not prompt:
805+
return jsonify({"error": _("Prompt is required")}), 400
806+
message = google_ai.analyze_data(prompt)
807+
return jsonify({"status": "success", "message": message})
808+
809+
777810
@app.route('/api/register', methods=['POST'])
778811
def register():
779812
data = request.get_json()

google_ai.py

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,78 @@ def generate_promotion_from_content(url: str, content: str) -> str:
139139
except Exception as e:
140140
print(f"Error generating promotion from content with Vertex AI: {e}")
141141
return f"Error: {e}"
142+
143+
def generate_business_strategy(prompt: str) -> str:
144+
"""
145+
Generates a business strategy from a prompt using Vertex AI.
146+
"""
147+
model = GenerativeModel("gemini-1.5-flash")
148+
149+
generation_prompt = f"""
150+
You are an expert business strategist. Your task is to develop a business strategy based on the following user prompt.
151+
152+
User Prompt:
153+
---
154+
{prompt}
155+
---
156+
157+
The strategy should be comprehensive and include actionable steps.
158+
"""
159+
160+
try:
161+
response = model.generate_content(generation_prompt)
162+
return response.text.strip()
163+
164+
except Exception as e:
165+
print(f"Error generating business strategy with Vertex AI: {e}")
166+
return f"Error: {e}"
167+
168+
def provide_it_support(prompt: str) -> str:
169+
"""
170+
Provides IT support for a given issue using Vertex AI.
171+
"""
172+
model = GenerativeModel("gemini-1.5-flash")
173+
174+
generation_prompt = f"""
175+
You are a knowledgeable IT support specialist. Your task is to provide a solution to the following technical issue.
176+
177+
User Issue:
178+
---
179+
{prompt}
180+
---
181+
182+
Provide a clear, step-by-step solution.
183+
"""
184+
185+
try:
186+
response = model.generate_content(generation_prompt)
187+
return response.text.strip()
188+
189+
except Exception as e:
190+
print(f"Error providing IT support with Vertex AI: {e}")
191+
return f"Error: {e}"
192+
193+
def analyze_data(prompt: str) -> str:
194+
"""
195+
Analyzes data and provides insights using Vertex AI.
196+
"""
197+
model = GenerativeModel("gemini-1.5-flash")
198+
199+
generation_prompt = f"""
200+
You are a skilled data scientist. Your task is to analyze the following data and provide insights.
201+
202+
Data and Request:
203+
---
204+
{prompt}
205+
---
206+
207+
Provide key insights, trends, and conclusions from the data.
208+
"""
209+
210+
try:
211+
response = model.generate_content(generation_prompt)
212+
return response.text.strip()
213+
214+
except Exception as e:
215+
print(f"Error analyzing data with Vertex AI: {e}")
216+
return f"Error: {e}"

0 commit comments

Comments
 (0)