HARPA.AI
USE CASESGUIDESAI COMMANDSBLOGPRIVACY

Parameters

CONTENTS

# Command parameters

Whenever you send a question (prompt) in chat, HARPA injects parameters into the prompt text. For example, if you type Please summarize this web page: {{page}} in chat, HARPA will extract text from the web page and inject it into the GPT prompt.

There are many predefined parameters you can use in your prompts:

  • {{page}} - web page text content, starting from the top of the page. Long pages are truncated to fit into GPT input. Page parameter supports extra options:
    • {{page url}} will retrieve the web page content from the specified URL. Work with the most websites except where retrieval is blocked, such as LinkedIn.com and X.com. Supports JavaScript.
    • {{page query}} will scan the page content for text semantically similar to the given query and return that as a parameter value. This is helpful when page is too large to fit into GPT input.
    • {{page limit=500}} specify a limit in tokens or percentage of the model context window, e.g. 10%.
  • {{selection}} - selected text on the web page, if any. This is useful when you want to summarize a specific portion of the web page.
  • {{title}} - web page title.
  • {{desc}} - web page meta description.
  • {{url}} - web page URL.
  • {{domain}} - web page domain.
  • {{language}} - language defined in the app settings, e.g. English; this is useful to instruct GPT to reply in a certain language across your commands. Most of the preconfigured commands use this parameter to tailor the response.
  • {{transcript}} - YouTube video transcript, useful for summarizing and extracting information from YouTube videos
  • {{transcriptPlain}} - YouTube video transcript, without timestamps.
  • {{message x}} - previous chat message, where x is a number, e.g. {{message 0}} is the first message, {{message 1}} is the second message, {{message -1}} is the last message, etc.
  • {{serp term}} - query web for the search term and find up to 10 top links. Supports search operators, e.g.: {{serp running weight loss site:ncbi.nlm.nih.gov}}.
  • {{gpt}} - last GPT response, useful for chaining prompts.

You can create and use custom parameters such as:

  • {{p1}}, {{name}}, {{param}}... - these parameters let you customize your command every time it is run. You can use automatically assigned names (p1, p2, etc.) or choose custom ones.

You can create custom parameters using CALC Set Parameter function and inspect available parameters by running /echo command in chat.

Parameters are interpolated both in the chat window as well as custom commands, e.g. in GPT, SAY and CALC steps. They may serve as the default value in the ASK step when the user provides no input and simply presses Enter.

# Global parameters

Parameters, e.g. {{p1}}, are retained for the duration of the single command. If you prefix parameter name with g., like this {{g.p1}}, parameter becomes a global one.

Global parameters are available across multiple commands, enabling the orchestration of complex command chains. Such chains can undertake tasks like gathering data from an open webpage into a list and subsequently triggering another command for data processing or Zapier integration.

You can use ASK step or CALC Set Parameter step to establish a global parameter. For example, you can prompt yourself to input a global parameter such as {{g.email}}, which could then be used in chat or commands at any time.

In this example, the SAY step is optional, but you can include it to verify that the parameter has been set.

A working example of a Global Parameter is the /mimic-writing command. It saves the analysis of your writing style into {{g.mimic.style}}, allowing you to rewrite any text in your unique style.

# Dot Notation

Dot notation is used in HARPA to access nested data structures, for example:

  • {{users.0.name.toUpperCase}} will get the first element of a users list parameter, access its name property and convert it to uppercase.
  • 0 is the index of the first element in the list. You can use negative indices to access elements from the end of the list, e.g. -1 is the last element, -2 is the second last element, etc.
  • toUpperCase is a JavaScript function, and you can use any JavaScript function without arguments in dot notation, e.g. trim, toUpperCase, toLowerCase, etc.

# Page context

GPT input has a token limit, e.g. 4096 on GPT-3.5-turbo model, which is approximately 3000 words of English text. This limit is shared across chat history, question and response. Large web pages may not fit into the GPT input, so HARPA truncates {{page}} parameter automatically.

You can specify a keyword or query within the {{page}} parameter to extract portion of the page relevant to that keyword. For example: {{page Adobe Photoshop}} will instruct HARPA to scan the web page content for content semantically similar to "Adobe Photoshop" and return that as a parameter value.

NEXT POST
Contact us
HomeUse CasesGuidesPrivacy PolicyTerms of Service