If you are like me, and you didnโt immediately understand why people rave about Copilot, these simple examples by Simon Willison may be useful to you:
The biggest aha-moment with Copilot for me was when I wanted to implement tools for my GPT-based personal assistant. The function calling wasnโt yet available in the OpenAI API, and Iโve found that GPT-3.5 was really bad at using tools consistently in a long chat conversation. So I decided to implement a classifier DAG, with either a simple LLM prompt or a regular function in its nodes. Something like this:
what is this? (reminder | todo | other)
reminder -> what kind of reminder? (one-time | recurring)
one-time -> return the ISO timestamp and the reminder text in a JSON object like this
recurring -> return the cron expression and the reminder text in a JSON object like this
todo -> what kind of todo operation (add | delete | ...)
...
other -> just respond normally
I wrote an example of using this classifier graph in code, something like this (itโs missing a lot of important details):
const decisionTree = new Decision(
userIntentClassifier, {
"REMINDER": new Decision(
reminderClassifier, {
"ONE_TIME": new Sequence(
parseNaturalLanguageTime,
createOneTimeReminder,
explainAction
),
"RECURRING": new Sequence(
createRecurringReminder,
explainAction
),
}
),
"TASK": new Decision(
taskClassifier, {
...
}
),
"NONE": answerInChat,
}
);
decisionTree.call(context);
And then I started writing class Decision
, class Sequence
, etc. and it implemented the classes perfectly!