AI for builders

Tana was always built with AI in mind. Tana gives you all the benefits of AI to date, plus it works on top of your notes and knowledge to make it highly relevant and specific to your needs.

Overview

Tana AI ✨ is a way of injecting AI functionality into your Tana setups. Through AI fields and commands, you are able to interact with your data in incredibly powerful ways.

Through some prompt engineering (both by us, behind the scenes, and by you, throughTana AI ✨ config pages), you can query powerful generative AI models, and get the resulting data right back in your Tana workspace.

While chatbots such as ChatGPT and Bing allow for great AI interactions, Tana is built to let you decide the workflows. With Tana AI ✨, you can set up functions that run on your nodes, tables or supertags to perform repeatable actions — catered for your exact needs.

For example:

  • 🎙️ It will let you transcribe audio, to quickly bring voice memos into Tana!
  • 🧑‍🎨 It will let you generate artwork on the fly, to create mockups and ideate design.
  • ✍️ It will let you generate text from your data, which lets you do anything from fill tables to steelman counter-arguments, to critique your work.

Setup

🔑 Your OpenAI keys

All interactions with the APIs require you to connect your own OpenAI API key. To get it, go to OpenAI's API Key page.

Once you have your API key at hand, 1️⃣ open the command line and run the "Set OpenAI API Key" command. Then 2️⃣ paste your key in the field and you're good to go.

🗄️ Your data and privacy

The different AI commands require us sending your data to the OpenAI API.

There is no functionality in the system that sends data to OpenAI unless you take a specific action that sends data (e.g. using the AskGPT command.)

If we ever introduce the option of automatic/background processing, we will change our terms, and have an explicit opt-in.

💸 Your spend limit

❗️IMPORTANT: Since you are using your own API key, you will be responsible for your own Pricing.

When experimenting, it can be easy to use a lot of tokens (AI in Tana is a lot of fun 🤖). We strongly recommend setting Usage limits in your OpenAI API.

❗Note: if you are a trial user of OpenAI you are likely to be hit with rate limiting. Entering a payment method (credit card information) will improve this.

Time-limited trial of Integrated AI

A small number of users have been invited to take part in testing this. If you are part of the trial and have questions, please reach out to help@tana.inc.

Basics

Instant AI, anywhere

The quickest and easiest way to use AI in Tana is directly where you are working. Just start a node with ai:, and this lets you quickly generate AI content in whichever context you're in.

You can also do the same through the command line, either pre-writing your prompt in a node and running Ask AI, or taking an existing node with content and running Ask AI to → and type out your prompt in the command line.

The plug-and-play AI commands will let you:

  • 📝 quickly query GPT, or 🎨 generate art with DALL-E, using your nodes as prompts.
  • 🗃️ cluster/sort your nodes using AI.
  • 🗣️ transcribe audio files into text.

There are seven standard commands that are accessible via the command line:

📝 Ask AI commands

  • Ask AI
  • Ask AI to →
  • Ask AI (creative)

🎨 DALL-E commands

  • Generate image(s) with DALL-E
  • Generate image(s) with DALL-E (enhanced prompt)

⌨️ Other commands

  • Cluster children with embeddings
  • Transcribe

AI Fields / Autofill

AI fields are super-powered fields: through GPT, they can be automatically filled in with useful data, based on what the AI can see of the field and its context.

Turn it on by going to Field configuration, and turn on ✨AI-enhanced field. An ✨AI button will appear next to the name of the field. To autofill the fields, click it.

By default, the AI looks at the node the field is attached to plus the node's children, other fields and description.

This is packaged into a prompt and sent to the AI, with the task Decide a value for the field: [field name]. The AI then does its best to answer.

┳┳ Smart tables

AI fields can be run on a single node, or as a part of a table.

Suggest AI fields

You can also have GPT suggest appropriate AI fields for you, from the "Add column" area in tables.

Builder's corner

For more advanced implementations of AI, we have created a highly modular set of building blocks which are covered below. It is a higher threshold of entry, but allows for customizations that are not possible anywhere else.

Prompt Workbench

When triggering an AI lookup field, when running Ask AI from the command line, or running a custom Ask AI command, the AI is given a prompt composed of your data + a request.

The key to creating powerful AI functionality in your Tana workflows, is understanding what is sent to the AI when you run a command.

You can view, test and edit your prompt in the Prompt Workbench.

Access the workbench in the following ways:

  • When you turn on AI-enhanced field in the field configuration (see image below)
  • On the Ask AI command node

When you open the prompt workbench, you'll see this:

The prompt workbench consists of a few sections:

Test node

You can set which node is used for testing and setting up your prompt

Custom Prompt

The Custom Prompt is the window where you feed your own prompt into the AI function you are configuring.

Prompt expressions in Tana are built like Title expressions, with some extra functionality:

  • To get the name of the node that you are targeting, use ${name}
  • To reference field values, use ${field label}.
  • To reference the entire node context with all fields and children in Tana Paste format, use ${sys:context}
  • To return a node's supertags, use ${sys:tags}
  • To show a node's children (excluding content inherited from supertag), use ${sys:content}
  • To insert the current date/date and time, use ${sys:currentDate} and ${sys:currentDateTime} respectively. Keep in mind that GPT doesn't know the current date or time natively.
  • To return the URL and ID of the node, use ${sys:nodeURL} and ${sys:nodeId} respectively.
  • All of the normal title expressions are also available.

To get the full context of the field content, use a field definition.

  • To get the field definition, put your cursor on the name of a field, Cmd/Ctrl+C to copy, put your cursor inside the prompt and Cmd/Ctrl+V to paste a reference to the field definition

The video shows the difference between the title expression pointing to a field versus the field definition in terms of what gets sent in the prompt:

You can also use dynamic content in your prompts: use a reference to a node directly in your prompt (including search nodes), or create search nodes in the prompt.

Expanded Prompt

The expanded prompt section shows what is being sent to the OpenAI API. To see what is being sent from and to Tana when you're using AI, use the GPT Log Monitor (see below)

Temperature

If you frequently get unsatisfying responses that start with "As a language model”, try turning the temperature up for your prompt. Increasing the model's creativity seems to often get it to loosen up a bit.

A rule of thumb:

  • If you are generating new content, use a high temperature.
  • If you are restructuring your existing data, use a low temperature.

The GPT Log Monitor

Tana has a monitor you can look at to see a history of AI commands you have used, tokens spent, approximate cost, and also the payloads that were sent from and to Tana.

Click on the line items to expand and see the payloads.

On Tana Paste: All output from the AI is parsed with Tana Paste before being inserted into Tana. For smaller texts, this should make no difference for you, but it does offer the possibility of teaching the AI to generate rich Tana data structures.

For example, you can tell it to generate a list of cities, and tag each as city, with the population as a field. Providing examples are really helpful:

- Rio de Janeiro #city
- Population:: 4M

Other useful tricks you can tell AI to do to output in a more Tana Paste friendly format:

  • “Output as Markdown table”
  • “Output as Markdown code block”
  • “Output as hierarchical Markdown, and use indentation instead of # for headers”
  • “use - [ ] for tasks”

You can even make it generate search nodes. For more on that, read up on Tana Paste.

AI Command nodes

To learn about implementing custom AI commands through command nodes, see AI Commands

Autotag

Autotag is an AI Command that is designed to help users sort and organize their content. Autotag uses AI to analyze different items, recognize what they are, and apply the relevant tags.

Set up the command Autotag with parameter Tag candidates, list a few supertag candidates in the configuration, and now run this custom command on a list of nodes.

Once supertags have been assigned, you can use Autofill to fill in fields based on the contents of the name. For example, AI can provide suggestions to fill fields, such as deadline, topic, even follow-up task, based on what it finds. You can also set it to auto-generate a new title and description. You can also exclude fields from the action, and choose to run on GPT-4 for different results. All of this can be switched on in the Supertag configuration as AI-enhanced tag.



Related release notes

  • improvedWe updated to the latest GPT 4 model. ()
  • improvedWe now pass on quota errors from OpenAI API accounts to users who are using their own key, in an effort to try to be a smidge more helpful than "not helpful at all" ()
  • improvedStreaming AI responses now support 'inline code' blocks ()
  • fixedWe now notify the user (you) if the prompt in prompt workbench is too long for the AI model selected. ()
  • fixedAI AutoFill will now keep the original node title as a child node if autofill overwrites the title. (say that 10 times, fast). ()
  • improvedMade AutoFill more robust 💪 ()
  • improvedOpenLink now works with mailto and other custom protocols. ()
  • improvedAutoFill will keep original node title as child if it's overwritten ()
  • improvedWe made AutoFill more robust ()

Related FAQs

  • Can I retrieve the prompt I used for an AI request?

    Yes, use the open GPT log monitor via the command line. Once open, click on one of the jobs to open it. This shows you the raw inputs and output from OpenAI, including the prompt you used.

    Related docs:

  • How can I save the image from AI-generated banners?

    Right-click on the banner > Move banner image to node. Then you can download it like you would with any image.

    Related docs:

  • How do I fix "The aiForBuilders feature is not enabled" error?

    To activate AI for Builders, go to Settings > Tana Labs > AI for Builders

    It can happen that this setting gets reset if you switch browsers or client. This setting is stored per browser/client, not per account.

    Related docs:

  • I activated "AI for Builders" but using AI commands keeps on producing errors?

    Errors when trying to run AI commands in Tana usually stem from one of two things:

    • Your OpenAI API key has not been entered
    • A payment method for using OpenAI's API has not been entered (this is a separate billing from ChatGPT i.e. not included in a ChatGPT Pro subscription)

    For more on how to setup OpenAI, read this: https://tana.inc/docs/ai-for-builders#setup

    Related docs:

  • I already pay for ChatGPT Pro, can I use that to run AI on Tana?

    No, using ChatGPT and the use of their API are two separate services according to OpenAI, and so there is separate billing for each. The API is pay-as-you-go, so you have to ensure it is activated before you can use AI in Tana.

    For more on how to setup OpenAI, read this: https://tana.inc/docs/ai-for-builders#setup

    Related docs:

  • What do the AI error messages Out of budget and 0/1 left mean?
    This writeup is from community member Theo Koster outlining a detailed walkthrough on how to set up your OpenAI account so you can use it with AI for Builders. It covers several errors like out of budget, 0/1 left, and rate limit for this api key has been hit. Here's Theo:

    There is no new information in this post, just a handy list of actions that I needed to assemble from different posts. If you get error messages using AI functionality, here is how I solved these.

    First: you've got to understand that Tana uses the OpenAI API. This is a different product than the OpenAI chatbot ChatGPT. So even if you have a paid account with the OpenAI ChatGPT, this is of no use to using the OpenAI API.

    Second: you have a limited amount of free queries available with the OpenAI API. This is why you run into error messages after a week of using the AI facilities in Tana. So you've got to pay extra. If you don't want to do that, fine, but face the limits. The good news here is that you can limit your credit to ± $5 and you can limit your maximum spend per month. My burn rate on my first day on a paid plan was 32 cents.

    How I got it all working:

    Now you should be good to go.

    Thanks Theo for the thorough writeup!

    Related docs:

  • What does "Retrying AI requests failed, giving up operation" error mean?

    This message means that the request to OpenAI was denied upon receipt, and there can be several reasons for this:

    1. Not enough funds

    • Recently, OpenAI changed their payment rules and you have to prepay to cover for API costs.

    2. Token window too small

    • Your request may be spending too many tokens on the prompt. Switch model to one that has a higher token limit

    3. OpenAI service disruption

    • If OpenAI's API is temporarily experiencing instability or down time, this may trigger this error. You can check their status here.

    There may be more causes, and if we identify them we'll add them here.

    Related docs: