• hawkwind@lemmy.management
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    1 year ago

    I just started using it a week ago and I can’t stop geeking out over it!

    My favourite is that it even writes comments well which is the thing most programmers hate the most!

    • 𝕊𝕚𝕤𝕪𝕡𝕙𝕖𝕒𝕟@programming.devOPM
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      1 year ago

      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!