Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/ahmed-ellaban_lead-trace.json
T

1 line
10 KiB
JSON

{"repo": "ahmed-ellaban/lead-trace", "files": {"moonshot.py": {"decca4254abfab38b90407eb70b1b91408abd253": {"t": 1785674094.91479, "n": 9569, "h": "c075cc99fa44cbe5", "c": "import time\nfrom typing import *\nimport os\nimport json\n\nfrom openai import OpenAI\nfrom openai.types.chat.chat_completion import Choice\n\nclient = OpenAI(\n api_key=\"sk-GcD3OHWHbR11VdVLIYPl9mX21AbmU6bldRQtsX3dmydXkpZs\",\n # Replace with your API Key from the Moonshot open platform\n base_url=\"https://api.moonshot.cn/v1\",\n)\n\n\ndef get_prompt(company_name):\n prompt = f\"\"\"\n Search for and extract the following details about the company named \"{company_name}\" with as much detail as possible.\n\n Use the following **search strategy** to ensure that all links, emails, and phone numbers are **valid** and **not** returning 404 or other error statuses:\n\n 1. **Official Company Website**:\n - Look for \"About Us,\" \"Contact,\" or \"Press\" pages for logo, emails, phone numbers, and leadership info.\n - If any link returns a 404 or error, discard it and find a working alternative.\n\n 2. **Official Social Media Profiles** (LinkedIn, Twitter/X, Facebook, Instagram, YouTube, TikTok, GitHub, etc.):\n - Verify that each profile link is active and does not lead to a removed or suspended page.\n\n 3. **Reputable Business Directories & Databases** (Crunchbase, ZoomInfo, Bloomberg, AngelList):\n - If official info is missing, use these directories for approximate data (revenue, company size, leadership).\n - Ensure the directory links provided are valid and publicly accessible.\n\n 4. **News & Press Releases** (company press statements, reputable news outlets, PR Newswire):\n - Check for recent announcements, leadership changes, or expansions.\n - Avoid linking to archived or removed pages.\n\n 5. **Regulatory or Government Websites**:\n - For business registrations or legal filings if publicly available.\n - Verify any external link is live and not erroring.\n\n 6. **Fallback to Well-Known Aggregators** (e.g., Wikipedia, corporate wikis, archives):\n - Use these if no direct official or reputable source can confirm a detail.\n - Confirm any aggregator link is working (no 404 or outdated references).\n\n If conflicting data appears, **prioritize official sources** first. \n If no official sources are found, return the **most widely recognized** alternative. \n If any detail remains unavailable, set it to `null`, `\"\"`, or `[]`.\n\n ---\n\n ### Required Information:\n\n 1. **Official Website** \n - The primary domain representing the company. \n - If unavailable, provide a widely used unofficial website.\n\n 2. **Company Logo** \n - Direct URL to the company's logo (from the official site if possible, or a trusted source). \n - Must be a publicly accessible link (not leading to 404).\n\n 3. **Social Media Profiles** \n - Direct links to active and working profiles on LinkedIn, Twitter/X, Facebook, Instagram, YouTube, TikTok, GitHub, etc. \n - No suspended or inactive pages.\n\n 4. **Contact Details** \n - Official & Unofficial Emails (General, Support, Sales, HR).\n - Phone Numbers (Local & International).\n - Fax Number (if available).\n - WhatsApp Business Number (if available).\n - Live Chat URL (if applicable).\n - Press Contact Page (if applicable).\n - If an official email or phone number does not exist, return a reliable working alternative.\n\n 5. **Core Company Information** \n - Short Description (company overview).\n - Full Legal Name and Alternative Names/Acronyms.\n - Industry or Sector.\n - Founded Year (plus brief foundation story if available).\n - Headquarters Location (City, Country).\n - Business Type (Public, Private, Nonprofit, etc.).\n - Company Size (approximate employees).\n - Annual Revenue (if publicly disclosed).\n - Registration Number (if available).\n - Stock Ticker & IPO Date (if publicly traded).\n\n 6. **Leadership & Key People** \n - CEO Full Name, LinkedIn, email, phone number (if available).\n - Other Key Leadership (Founders, Board Members, Executives).\n - If official contact details are missing, provide an alternative method (assistant or press contact).\n\n 7. **Business & Operations** \n - Branch or Subsidiary Locations.\n - Parent Company & Major Subsidiaries.\n - Notable Competitors.\n - Key Partnerships or Affiliates.\n - Major Milestones or Awards.\n\n 8. **Career & Hiring** \n - Job Openings or Careers Page URL.\n - Business Hours (if relevant).\n\n 9. **News & Press** \n - Recent Press Releases or Headlines (if available).\n - Media or Press Kit Page (if applicable).\n\n 10. **Sources & References** \n - A list of all URLs used to gather this data.\n - Include official sources first, then reputable or widely accepted sources.\n - Ensure each listed URL is live (not returning 404 or errors).\n\n ---\n\n ### Strict JSON Format for Output:\n ```json\n {{\n \"company\": \"\",\n \"logo\": \"\",\n \"alternative_names\": [],\n \"description\": \"\",\n \"foundation_story\": \"\",\n \"industry\": \"\",\n \"founded_year\": \"\",\n \"headquarters\": \"\",\n \"business_type\": \"\",\n \"company_size\": \"\",\n \"revenue\": \"\",\n \"stock_ticker\": \"\",\n \"ipo_date\": \"\",\n \"website\": \"\",\n \"social_media\": {{\n \"linkedin\": \"\",\n \"twitter\": \"\",\n \"facebook\": \"\",\n \"instagram\": \"\",\n \"youtube\": \"\",\n \"tiktok\": \"\",\n \"github\": \"\"\n }},\n \"contact_details\": {{\n \"emails\": {{\n \"general\": \"\",\n \"support\": \"\",\n \"sales\": \"\",\n \"hr\": \"\"\n }},\n \"phone_numbers\": [],\n \"fax\": \"\",\n \"whatsapp\": \"\",\n \"live_chat\": \"\",\n \"press_contact\": \"\"\n }},\n \"leadership\": {{\n \"ceo\": {{\n \"full_name\": \"\",\n \"linkedin\": \"\",\n \"email\": \"\",\n \"phone_numbers\": []\n }},\n \"founders\": [],\n \"board_members\": []\n }},\n \"business_info\": {{\n \"registration_number\": \"\",\n \"parent_company\": \"\",\n \"subsidiaries\": [],\n \"competitors\": [],\n \"partnerships\": []\n }},\n \"milestones_awards\": [],\n \"careers\": {{\n \"job_openings_url\": \"\",\n \"business_hours\": \"\"\n }},\n \"news\": {{\n \"recent_press_releases\": [],\n \"media_kit_url\": \"\"\n }},\n \"sources\": []\n }}\n Final Instructions:\n Return only this JSON object with no extra text.\n Discard any 404 or invalid links and find a working alternative instead.\n If any detail is unavailable, set it to null, \"\", or []. \"\"\"\n return prompt\n\n\ndef search_impl(arguments: Dict[str, Any]) -> Any:\n \"\"\"\n When using the search tool provided by Moonshot AI, simply return the arguments unchanged.\n\n If you want to use another model and retain the web search functionality,\n modify this implementation accordingly while keeping the function signature unchanged.\n\n This ensures maximum compatibility across different models without breaking the code.\n \"\"\"\n return arguments\n\n\ndef chat(messages) -> Choice:\n completion = client.chat.completions.create(\n model=\"moonshot-v1-128k\",\n messages=messages,\n temperature=0.3,\n tools=[\n {\n \"type\": \"builtin_function\",\n \"function\": {\n \"name\": \"$web_search\",\n },\n }\n ]\n )\n return completion.choices[0]\n\n\ndef company_search(company_name: str = \"Apple Inc.\"):\n messages = [\n {\"role\": \"system\",\n \"content\": \"You are Vitural Assitant that will search the web for information about a company, and return only json response in english.\"},\n ]\n\n messages.append({\n \"role\": \"user\",\n \"content\": get_prompt(company_name),\n })\n\n finish_reason = None\n while finish_reason is None or finish_reason == \"tool_calls\":\n choice = chat(messages)\n finish_reason = choice.finish_reason\n if finish_reason == \"tool_calls\":\n messages.append(choice.message)\n for tool_call in choice.message.tool_calls:\n tool_call_name = tool_call.function.name\n tool_call_arguments = json.loads(tool_call.function.arguments)\n if tool_call_name == \"$web_search\":\n tool_result = search_impl(tool_call_arguments)\n else:\n tool_result = f\"Error: unable to find tool by name '{tool_call_name}'\"\n\n messages.append({\n \"role\": \"tool\",\n \"tool_call_id\": tool_call.id,\n \"name\": tool_call_name,\n \"content\": json.dumps(tool_result),\n })\n\n print(choice.message.content)\n\n\nif __name__ == '__main__':\n start = time.time()\n result =company_search(\"360 home offers\")\n print(result)\n print(f\"Time taken: {time.time() - start:.2f} seconds\")\n"}}}}