Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Update services/location_service.py
Browse files
    	
        services/location_service.py
    CHANGED
    
    | 
         @@ -32,7 +32,7 @@ class LocationService: 
     | 
|
| 32 | 
         
             
                        return None
         
     | 
| 33 | 
         | 
| 34 | 
         
             
                @staticmethod
         
     | 
| 35 | 
         
            -
                 
     | 
| 36 | 
         
             
                    url = "https://api.openai.com/v1/chat/completions"
         
     | 
| 37 | 
         
             
                    headers = {
         
     | 
| 38 | 
         
             
                        "Content-Type": "application/json",
         
     | 
| 
         @@ -56,7 +56,7 @@ class LocationService: 
     | 
|
| 56 | 
         
             
                    return output['choices'][0]['message']['content']
         
     | 
| 57 | 
         | 
| 58 | 
         
             
                @staticmethod
         
     | 
| 59 | 
         
            -
                 
     | 
| 60 | 
         
             
                    return f"""You are a Text Analyser where you will extract city , state , country from given piece of text given below.You will strictly extract following keys from the text country , state , city.
         
     | 
| 61 | 
         
             
                    {location} \n
         
     | 
| 62 | 
         
             
                    Rules:
         
     | 
| 
         | 
|
| 32 | 
         
             
                        return None
         
     | 
| 33 | 
         | 
| 34 | 
         
             
                @staticmethod
         
     | 
| 35 | 
         
            +
                def get_llm_response(system_prompt) -> str:
         
     | 
| 36 | 
         
             
                    url = "https://api.openai.com/v1/chat/completions"
         
     | 
| 37 | 
         
             
                    headers = {
         
     | 
| 38 | 
         
             
                        "Content-Type": "application/json",
         
     | 
| 
         | 
|
| 56 | 
         
             
                    return output['choices'][0]['message']['content']
         
     | 
| 57 | 
         | 
| 58 | 
         
             
                @staticmethod
         
     | 
| 59 | 
         
            +
                def system_prompt(location : str) -> str:
         
     | 
| 60 | 
         
             
                    return f"""You are a Text Analyser where you will extract city , state , country from given piece of text given below.You will strictly extract following keys from the text country , state , city.
         
     | 
| 61 | 
         
             
                    {location} \n
         
     | 
| 62 | 
         
             
                    Rules:
         
     |