Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Fixed, now is output_type = 'array'
Browse files
    	
        tools/linkedin_job_search.py
    CHANGED
    
    | @@ -1,5 +1,6 @@ | |
| 1 | 
             
            from smolagents.tools import Tool
         | 
| 2 | 
             
            import requests
         | 
|  | |
| 3 | 
             
            from typing import List
         | 
| 4 |  | 
| 5 | 
             
            class LinkedInJobSearchTool(Tool):
         | 
| @@ -12,13 +13,13 @@ class LinkedInJobSearchTool(Tool): | |
| 12 | 
             
                    "work_mode": {"type": "string", "description": "remote, hybrid, in-office"}
         | 
| 13 | 
             
                }
         | 
| 14 |  | 
| 15 | 
            -
                output_type = " | 
| 16 |  | 
| 17 | 
             
                def forward(self, position: str, location: str, work_mode: str) -> List[str]:
         | 
| 18 | 
             
                    """
         | 
| 19 | 
             
                    Searches LinkedIn for job postings using SerpAPI.
         | 
| 20 | 
             
                    """
         | 
| 21 | 
            -
                    SERPAPI_KEY = " | 
| 22 | 
             
                    base_url = "https://serpapi.com/search"
         | 
| 23 |  | 
| 24 | 
             
                    params = {
         | 
| @@ -42,7 +43,7 @@ class LinkedInJobSearchTool(Tool): | |
| 42 | 
             
                            for job in job_results
         | 
| 43 | 
             
                        ]
         | 
| 44 |  | 
| 45 | 
            -
                        return formatted_jobs  # ✅ Returns  | 
| 46 |  | 
| 47 | 
             
                    else:
         | 
| 48 | 
            -
                        return [f"Error: {response.status_code} - {response.text}"]  #  | 
|  | |
| 1 | 
             
            from smolagents.tools import Tool
         | 
| 2 | 
             
            import requests
         | 
| 3 | 
            +
            import json
         | 
| 4 | 
             
            from typing import List
         | 
| 5 |  | 
| 6 | 
             
            class LinkedInJobSearchTool(Tool):
         | 
|  | |
| 13 | 
             
                    "work_mode": {"type": "string", "description": "remote, hybrid, in-office"}
         | 
| 14 | 
             
                }
         | 
| 15 |  | 
| 16 | 
            +
                output_type = "array"  # ✅ "array" is an authorized type
         | 
| 17 |  | 
| 18 | 
             
                def forward(self, position: str, location: str, work_mode: str) -> List[str]:
         | 
| 19 | 
             
                    """
         | 
| 20 | 
             
                    Searches LinkedIn for job postings using SerpAPI.
         | 
| 21 | 
             
                    """
         | 
| 22 | 
            +
                    SERPAPI_KEY = "YOUR_SERPAPI_KEY"
         | 
| 23 | 
             
                    base_url = "https://serpapi.com/search"
         | 
| 24 |  | 
| 25 | 
             
                    params = {
         | 
|  | |
| 43 | 
             
                            for job in job_results
         | 
| 44 | 
             
                        ]
         | 
| 45 |  | 
| 46 | 
            +
                        return formatted_jobs  # ✅ Returns an array of strings
         | 
| 47 |  | 
| 48 | 
             
                    else:
         | 
| 49 | 
            +
                        return [f"Error: {response.status_code} - {response.text}"]  # Return error as array
         | 
 
			
