Coda your AI on legal texts — part I
single and composed variables
I am using Coda AI on a daily basis and so I have an interest in how others use it in and with Coda. On Twitter and in the Coda community I see mainly examples relating to the creative part of AI. Write me a letter, make a summary, evaluate feedback, help me planning a trip, show me recipes related to Brussels loaf and so forth. Interesting, even useful in certain occasions but too often not inspiring in a Coda context. We know that AI can do this and in most cases we don’t need Coda to repeat these tricks. I am looking for something specific. Let me first elaborate on the creative part of AI before diving in what I believe is a fundamental Coda strenght.
AI and creativity
AI and creativity are doing well together, very well indeed to the extend that getting a consistent outcome following strict patterns from any AI is difficult.
In response to Ethan, we read:
“LLM’s are better suited for creative tasks with lower accuracy thresholds. The real challenge […] is to get LLM’s to follow instructions like traditional deterministic software systems”
My Coda challenge
Like the author, we want AI in Coda to output texts based on data sets of all sorts each time following the same pattern as close as possible. We have a legal text and we want the variables be replaced.
It is about single values like a birthday or a first name and about composed values (even phrases) for example related to the type of contract.
Using the Format()
function, we can create templates for even complex texts. However, this method is not efficient as it requires linking multiple smaller templates to create a larger one, which can easily become disorganized and difficult to maintain over time. Once the template is working correctly, it is best not to make any further changes to avoid potential errors.
Nevertheless, the main Coda advantage is — for me at least — blending structured and unstructured data with both single and composed values.
We as Coda makers are not the only ones trying to template text. Let’s have a look at the wonderful contribution you find here:
The AI turns a text (an email) into a template by replacing the variables you recognize by the square brackets [ ].
This is an inspiring start and contains a specific promise : we can feed the AI with our (legal) text and and ask it to help us to turn the example text into a template. We replace a single variable with a single value and this works fine for simple parameters like a birthday, a family name.
What about a use case we need multiple variables at once, a composed variable?
Composed variables
In Coda most data lives in tables. It is structured data getting in there via forms, packs, copy — paste or you type it manually. No matter how it arrives, it is and remains structured data you can query.
Imagine we have a table with people who are part of a family. There is variation in the family composition. No kids, one, two, three and with a mix of sons and daughters covering various ages ranging from kids via young adults to adults.
When you look for a textual outcome you can have something like:
- one child, an adult named Christiaan, 22 years old.
- two children: Christiaan an adult 22 years old and Jean 19 years and a young adult.
- three children : Christiaan an adult 22 years old, Jean 19 years, a young adult and Delphine 17 years old and a child.
In this set up we do no not replace one variable with a value, instead depending on the how many children there are, we compose a phrase. It is our ambition to have Coda AI helping us to get us the right phrase, each time over and over again and without confabulation.
In my previous article I wrote about prompting:
A proper outcome is only in reach when we provide sufficient examples to the Coda AI to show the way and this requires us to become a prompt artist.
Becoming a prompt artist
This is about figuring out what kind of text to feed the AI to get it to take on the behavior we want. It is a kind of art, highly flexible and there is no specific way of doing it good. You write to make the model understand what it needs to do for you. The exact wording and the order of the instructions in the prompt matter. It is worthwhile to experiment with different structures. Not only that, feed it with as many examples as you can. Over time I learnt that I can start without examples and when I see phrases that please me, I put them aside and turn them into examples when I have seen some variations. As you may understand from this, prompting is closer to art than to science, so maybe we should talk about prompt artist.
Prompt design allows for fast experimentation and customization and because we are not writing any complicated code, we don’t need to be a Machine Learning expert to get started and be successful.
Good to read
Below some sources I based my blog on.
My name is Christiaan and blog about Coda. Since the summer of 2023 mainly about how to Coda with AI to support organisations dealing with texts and templates. My blogs are for beginners and experienced users. The central theme is that in Coda everything is a list.
I hope you enjoyed this article. If you have questions feel free to reach out. Though this article is for free, my work (including advice) won’t be, but there is always room for a chat to see what can be done. You find my (for free) contributions to the Coda Community and on Twitter.
Coda comes with a set of building blocks ー like pages for infinite depth, tables that talk to each other, and buttons that take action inside or outside your doc ーso anyone can make a doc as powerful as an app (source).
Not to forget: the Coda Community provides great insights for free once you add a sample doc.