
    85i                         d dl Z d dlmZ d dlmZ  ed            e j        d          Z ee          Zdd	efd
Z	dS )    N)OpenAI)load_dotenvz/etc/pixcura-secrets.envOPENAI_API_KEY)api_key	radiologyenraw_transcriptc                 J   | rt          | t                    sdS d| d}	 t          j        j                            dd|dd| dgd	          }|j        d
         j        d         }|                                S # t          $ r}t          d|           | cY d}~S d}~ww xY w)z
    Cleans raw transcript text according to the chosen specialty.
    You can extend this later for multiple specialties.
     z2
You are a medical language model specializing in a  .
Your task is to clean and correct spoken dictation.

Rules:
- Fix grammar and punctuation.
- Fix accent/pronunciation mistakes.
- Keep ONLY English.
- Do NOT add findings.
- Do NOT remove clinical meaning.
- Make the output clean, professional, and concise.
zgpt-4o-minisystem)rolecontentuserg?)modelmessagestemperaturer   r   zError in clean_live_text:N)
isinstancestrclientchatcompletionscreatechoicesmessagestrip	Exceptionprint)r	   	specialtylanguagesystem_promptresponsecleaned_textes          ./var/www/html/pixcura-vrs/live_mode_example.pyclean_live_textr%      s      NC!@!@ r2;  M;*11!m<<N;;  2 
 
  '*29=!!###   )1---s   AA< <
B"BB"B")r   r   )
osopenair   dotenvr   getenvr   r   r   r%        r$   <module>r,      s    
			             & ' ' '+,, 
	'	'	'' 'C ' ' ' ' ' 'r+   