Skip to content

Commit 37a0a15

Browse files
authored
Merge pull request #35 from GYFX35/feat-telecommunication-roles-78552990318764741
feat: Add telecommunication assistant and support roles
2 parents d966462 + e86d0de commit 37a0a15

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

app.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,28 @@ def it_support_endpoint():
790790
return jsonify({"status": "success", "message": message})
791791

792792

793+
@app.route('/api/v1/support/telecommunication', methods=['POST'])
794+
@require_api_key
795+
def telecommunication_support_endpoint():
796+
data = request.get_json()
797+
prompt = data.get('prompt')
798+
if not prompt:
799+
return jsonify({"error": _("Prompt is required")}), 400
800+
message = google_ai.provide_telecommunication_support(prompt)
801+
return jsonify({"status": "success", "message": message})
802+
803+
804+
@app.route('/api/v1/assistant/telecommunication', methods=['POST'])
805+
@require_api_key
806+
def telecommunication_assistant_endpoint():
807+
data = request.get_json()
808+
prompt = data.get('prompt')
809+
if not prompt:
810+
return jsonify({"error": _("Prompt is required")}), 400
811+
message = google_ai.generate_telecommunication_assistant_response(prompt)
812+
return jsonify({"status": "success", "message": message})
813+
814+
793815
@app.route('/api/v1/data/analyze', methods=['POST'])
794816
@require_api_key
795817
def analyze_data_endpoint():

google_ai.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,3 +344,55 @@ def learn_language(prompt: str) -> str:
344344
except Exception as e:
345345
print(f"Error providing language learning assistance with Vertex AI: {e}")
346346
return f"Error: {e}"
347+
348+
349+
def provide_telecommunication_support(prompt: str) -> str:
350+
"""
351+
Provides telecommunication support for a given issue using Vertex AI.
352+
"""
353+
model = GenerativeModel("gemini-1.5-flash")
354+
355+
generation_prompt = f"""
356+
You are a knowledgeable telecommunication support specialist. Your task is to provide a solution to the following technical issue.
357+
358+
User Issue:
359+
---
360+
{prompt}
361+
---
362+
363+
Provide a clear, step-by-step solution.
364+
"""
365+
366+
try:
367+
response = model.generate_content(generation_prompt)
368+
return response.text.strip()
369+
370+
except Exception as e:
371+
print(f"Error providing telecommunication support with Vertex AI: {e}")
372+
return f"Error: {e}"
373+
374+
375+
def generate_telecommunication_assistant_response(prompt: str) -> str:
376+
"""
377+
Generates a telecommunication assistant response for a given issue using Vertex AI.
378+
"""
379+
model = GenerativeModel("gemini-1.5-flash")
380+
381+
generation_prompt = f"""
382+
You are a helpful telecommunication assistant. Your task is to provide a response to the following user query.
383+
384+
User Query:
385+
---
386+
{prompt}
387+
---
388+
389+
Provide a clear and concise response.
390+
"""
391+
392+
try:
393+
response = model.generate_content(generation_prompt)
394+
return response.text.strip()
395+
396+
except Exception as e:
397+
print(f"Error generating telecommunication assistant response with Vertex AI: {e}")
398+
return f"Error: {e}"

0 commit comments

Comments
 (0)