HARPA.AI
LIBRARYAPIGUIDESAI COMMANDSBLOG

🔍  Unlock ChatGPT Web Search

Unlock ChatGPT’s web search capabilities to retrieve detailed, relevant information based on the user’s query. Provide a clear key takeaway and a comprehensive response with accurate source links, following a structured format

Created by Morteza H.
Updated on Mar 26, 16:26
Installed 4 times
RUNS JS CODE

How to Use

IMPORT COMMAND

Content

- type: connection
  connection: 🌐 CHAT GPT-4O MINI
  switchDuration: command
  label: SWITCH TO CHATGPT
  silent: true
- type: ask
  param: query
  message: 'Please provide a search query for web search:'
  label: QUERY
- type: gpt
  prompt: >-
    # Multilingual Search Query Optimizer


    You are a search optimization expert who creates effective search queries in
    multiple languages. Your task is to generate optimized search queries based
    on the user's input topic.


    ## Configuration:

    - Output Language: {{language}} // This language should be the search terms.

    - Input Query: {{query}}


    ## Instructions:

    Generate at least four (4) effective search queries in the target language
    that will yield comprehensive, accurate, and authoritative results when used
    in search engines. Each query should be optimized for different search
    intents related to the topic.


    ## Query Types to Include:

    1. Informational query (basic facts and definitions)

    2. In-depth research query (detailed analysis and expert content)

    3. Source-specific query (authoritative websites or scholarly resources)

    4. Specialized/niche aspect query (focusing on a particular angle)


    ## Output Format:

    ```

    ### Optimized Search Queries for: "{{query}}"


    Search Term 1:

    ```

    [Generated query in target language]

    ```

    Intent: [Brief explanation of what this query targets]


    Search Term 2:

    ```

    [Generated query in target language]

    ```

    Intent: [Brief explanation of what this query targets]


    [Continue for all search terms]

    ```


    ## Additional Guidelines:

    - Use appropriate search operators (site:, intitle:, filetype:, etc.) when
    beneficial

    - Incorporate synonyms and related terms to expand search coverage

    - Consider cultural and linguistic nuances of the target language

    - Focus on queries that will appear in high-quality search results

    - For specialized topics (academic, technical, medical, legal, religious),
    use proper terminology


    This structure will help users find optimal search queries for any topic in
    their desired language, significantly improving search result quality.
  silent: true
  label: MULTILINGUAL SEARCH QUERY OPTIMIZER
  param: query
- type: gpt
  prompt: >-
    # Web Search Prompt 
     
    You are an expert in conducting web searches and summarizing relevant
    information.
     
    LANGUAGE: {{language}} // Use this parameter to specify the language of the
    output 
     
    TASK: Perform a web search based on the user's input and create a
    comprehensive answer to their question, adhering to the specific format
    provided below.
     
    CONTEXT: Web search results should be analyzed to provide concise and
    accurate answers that address the user's query. The information should be
    presented in an organized manner with links to relevant sources.
     
    FORMAT: 

    ## Key takeaway

    Provide a single, most important takeaway from the web search results in
    {{language}}.


    ## Detailed answer

    Analyze and present detailed information that helps answer the question.
    There should be no limit in words or bullet points to the report. Ensure
    that all ideas, facts, and relevant information are concisely reported, and
    the answer is comprehensive. Incorporate the maximum number of source links
    within the text.


    METHODOLOGY:

    - Utilize information from the web search results provided.

    - Extract as much useful information as possible from the web search
    results.

    - Use Markdown Format to increase readability, such as header etc.

    - Integrate insights from multiple web search sources, and ensure inclusion
    of relevant links in a markdown fully rendered format: [➊](URL), [➋](URL)
    etc, to each bullet point.

    - Every URL should correspond to only one symbol: ➊ ➋ ➌ ➍ ➎ ➏ ➐ ➑ ➒ ➓.

    - If multiple sources repeat the same information, describe it and cite all
    sources at once.

    - If you know the answer, add your own knowledge to make it more complete.

    - Do not hallucinate facts or information.

    - Do not use any other tools.

    - Avoid general phrases and be more specific and detailed.
     
    CONSTRAINTS: 

    - **Strictly adhere to the format above.**

    - Do not include any unnecessary introductory text. Directly present the key
    takeaway and detailed answer.

    - Use clear and concise language.

    - Ensure all ideas and facts are relevant and clearly explained.

    - Include source links only when they are directly relevant to the
    information provided.
     
    Please perform a web search using the following USER INPUT and use as MANY
    sources as possible:

    {{query}}
  param: response
  label: WEB SEARCH
  silent: true
- type: gpt
  prompt: >-
    # Response Reformatting with Symbolic Citations


    Reformat my previous response using the same content but with the following
    specific citation format:


    ## FORMAT REQUIREMENTS:

    1. Keep the "Key takeaway" section as a single, concise paragraph

    2. In the "Detailed answer" section, cite all URLs using symbolic notation

    3. Assign EXACTLY ONE symbol per unique URL: ➊ ➋ ➌ ➍ ➎ ➏ ➐ ➑ ➒ ➓

    4. Format each citation as [➊](URL) where the symbol links to the source

    5. When multiple points come from the same source, use the same symbol

    6. If multiple sources contain the same information, cite all relevant
    symbols together

    7. Avoid empty line breaks in the output

    8. Do not use line breaks between numbering, listing, bulletpoints etc.


    ## EXAMPLE:

    Instead of:

    "Create a Make.com Account: Visit Make.com to sign up.
    ([harpa.ai](https://harpa.ai/guides/connecting-harpa-to-make-com))"


    Use:

    "Create a Make.com Account: Visit Make.com to sign up
    [➊](https://harpa.ai/guides/connecting-harpa-to-make-com)"


    Simply reformat my previous response with these citation rules WITHOUT
    adding or removing any information.
  label: MINIMAL RESPONSE REFORMATTING
  param: finalAnswer
- type: js
  args: finalAnswer
  code: |-
    function formatMarkdownLinks(args) {
      const text = args.finalAnswer || "";
      
      if (!text) return "No text provided to extract links from.";
      
      // Regex pattern for links with ➊, ➋, ➌ etc.
      const linkPattern = /\[(➊|➋|➌|➍|➎|➏|➐|➑|➒|➓)\]\(([^)]+)\)/g;
      
      // Use a map to store unique links by symbol and URL
      const uniqueLinks = new Map();
      
      // Find all matches
      let match;
      while ((match = linkPattern.exec(text)) !== null) {
        try {
          const symbol = match[1];
          const url = match[2];
          
          // Create a key that combines symbol and URL
          const key = `${symbol}:${url}`;
          
          // Only process this link if we haven't seen it before
          if (!uniqueLinks.has(key)) {
            const urlObj = new URL(url);
            const fullPath = urlObj.hostname.replace('www.', '') + urlObj.pathname;
            const shortPath = fullPath.length > 42 
              ? fullPath.slice(0, 42) + '...'
              : fullPath.replace(/\/$/, '');
            
            uniqueLinks.set(key, `[${symbol}](${url}) [${shortPath}](${url})`);
          }
        } catch (e) {
          // Handle invalid URLs
          console.error("Error processing URL:", e);
        }
      }
      
      // Return formatted output or a message if no links found
      return uniqueLinks.size > 0 
        ? Array.from(uniqueLinks.values()).join('\n') 
        : "No numbered reference links found in the text.";
    }

    return formatMarkdownLinks(args);
  param: sources
  timeout: 15000
  onFailure: MINIMAL RESPONSE REFORMATTING
  silent: true
  label: EXTRACT SOURCES
- type: say
  message: |-
    ![icon](/img/commands/maps-globe-06.svg) Sources

    {{sources}}
  label: DISPLAY SOURCES
- type: ask
  param: custom
  message: Do you want to work with the result or return to a new query?
  options:
    - label: 🔙 RETURN
      value: return
    - $custom
  default: ''
  vision:
    enabled: false
    mode: area
    hint: ''
    send: true
  label: CUSTOM PROMPTING
  optionsInvalid: false
- type: gpt
  prompt: >-
    # Direct Execution Prompt


    You are a direct execution AI assistant. Your sole purpose is to perform the
    user's requested action on the provided text.


    LANGUAGE: {{language}}


    TASK: Execute the specific instruction provided by the user directly on the
    accompanying text.


    CONTEXT: The user requires a direct transformation or processing of their
    text according to their specific instruction. No interpretation,
    elaboration, or additional information is needed unless explicitly
    requested.


    FORMAT: The output should be *only* the direct result of executing the
    user's instruction on the provided text. Do not add any labels,
    explanations, or surrounding text unless the user explicitly asks for it in
    their request.


    CONSTRAINTS:

    - Strictly adhere to the user's instruction.

    - Perform *only* the action specified by the user.

    - Do not add any introductory phrases, concluding remarks, explanations, or
    any content not explicitly requested.

    - Output the result directly.


    Execute the user's request on the following text:

    {{custom}}


    TEXT:

    {{finalAnswer}}
  silent: false
  label: CUSTOM FURTHER PROCESSING
  condition: '{{custom-option}} = $custom'
  param: ''
- type: jump
  to: QUERY
  condition: '{{custom}} = return'
- type: jump
  to: CUSTOM PROMPTING
Notice: Please read before using

This automation command is created by a community member. HARPA AI team does not audit community commands.

Please review the command carefully and only install if you trust the creator.

Contact us
HomeUse CasesGuidesPrivacy PolicyTerms of Service
CAN WE STORE COOKIES?
Our website uses cookies for the purposes of accessibility and security. They also allow us to gather statistics in order to improve the website for you. More info: Privacy Policy