|
from groq import Groq |
|
|
|
client = Groq( |
|
api_key="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", |
|
) |
|
|
|
def get_physiotherapy_assistant_response(prompt : str): |
|
try: |
|
system_message = """You are a helpful physiotherapy assistant, trained to provide useful information about exercises, recovery, and treatments. |
|
You can help users with various physical therapy-related queries.""" |
|
|
|
if not prompt or len(prompt.strip()) < 5: |
|
return "Please provide more details about your physiotherapy question. I need more context to assist you effectively." |
|
|
|
chat_completion = client.chat.completions.create( |
|
messages=[ |
|
{"role": "system", "content": system_message}, |
|
{"role": "user", "content": prompt}, |
|
], |
|
model="llama-3.3-70b-versatile", |
|
) |
|
assistant_response = chat_completion.choices[0].message.content |
|
return assistant_response |
|
except Exception as e: |
|
return f"An error occurred while processing your request: {str(e)}" |