• @beckerist
    link
    15110 months ago

    I wonder if that key works…

        • @[email protected]OP
          link
          fedilink
          28
          edit-2
          10 months ago

          Original creator of the meme disabled the key before posting so it theoretically would give you an incorrect API key provided error. Double checked with a basic app before I posted it here lol

        • @jaybone
          link
          210 months ago

          if trouble == ‘Yes’

          return True; 
          
    • @MrOxiMoron
      link
      4110 months ago

      Dutch programmer, ‘of’ is dutch for ‘or’.

      I wonder if OpenAI is smart enough for that

      • @olutukko
        link
        510 months ago

        I would imagine it is. I have tried all sort of typos and it has never misunderstiood me because of that

        • @[email protected]
          link
          fedilink
          210 months ago

          I dunno, I once combined two languages in the context and it started to give me a bunch of python code. Was scary.

  • @[email protected]
    link
    fedilink
    9810 months ago

    Processors might no longer get twice as fast every few years, but now we can use the power of servers to write software that runs even slower.

    • @[email protected]
      link
      fedilink
      1810 months ago

      We can add caching so numbers that have been checked once can be quickly looked up from an inMemory database.

    • Rimu
      link
      fedilink
      3610 months ago

      gpt3.5 is faster though. You can tell they really thought about performance while writing this code because they used 3.5 instead. /s

  • Kata1yst
    link
    fedilink
    6710 months ago

    Rofl. I just imagine OP furiously updating LinkedIn with “AI Programmer”.

  • Rosco
    link
    fedilink
    4910 months ago

    Probably not a good idea to show your API key to everyone…

  • @kromem
    link
    English
    3810 months ago

    Inefficient solution.

    You should simplify it to just ask the model if the last bit of the binary representation of the integer is a 1 or a 0.

    • Natanael
      link
      fedilink
      610 months ago

      They don’t process inputs as binary (they use clusters of symbols, i.e. letter groups) so that’s not guaranteed to work

      • @AeonFelis
        link
        English
        310 months ago

        You can ask it if the last digit is odd or even, then.

      • @kromem
        link
        English
        010 months ago

        r/woosh

        • Natanael
          link
          fedilink
          510 months ago

          I did realize that too was a joke, still wanted to point that out

          • @kromem
            link
            English
            010 months ago

            Well, in the sake of pointing things out, GPT-4 can actually correctly answer the prompt, because it arrives at it in the opposite direction. It can tell the integer is even or odd and knows that even or odd integers in binary end in 0 or 1 respectively.

  • Endorkend
    link
    fedilink
    2910 months ago

    Have to say, this is not the most convoluted way of testing a simple thing I’ve seen in my years, not by a long shot.

  • peopleproblems
    link
    2410 months ago

    oh Jesus

    did this come full circle?

    we used python to query chatgpt to decide if a number is even or odd and return true or false?

    • Ephera
      link
      fedilink
      2310 months ago

      True or false or null.

      Mathematicians didn’t know it yet, but numbers can now be even, odd or neither.

      • Natanael
        link
        fedilink
        110 months ago

        Non integers certainly aren’t even or odd, so yes?

        • Ephera
          link
          fedilink
          210 months ago

          Yeah, I’m chalking that up to Python’s untypedness. I was going to write “integers”, but technically that function takes a “num”, whatever that is.

          For all we know, it could be a string, asking ChatGPT to hack the government. Is that even? Probably no. Or None. Or T-Rex. Without reading the entire function, we don’t know that it’s not returning T-Rex.

          Thankfully, it doesn’t matter. Just stick the result into an if-else, then False and None will land you in the else-branch. And both True and our Truthiness-Rex will land you in the if-branch. Just as Guido intended.

          …this rant brought to you by trauma.

  • @Arete
    link
    English
    2210 months ago

    Key seems valid. I’ll check all the integers for you to see how accurate it is.

    • @[email protected]
      link
      fedilink
      710 months ago

      While you’re at it, also test

      • one
      • three fifty
      • 69 nice
      • 6.9
      • 4,20
      • null (it’s German for zero)
      • pie (and pi)
      • cake
      • fruits
      • One million three hundred (wonder if it gets confused by “one” and “three”)
    • @ParanoiaComplex
      link
      610 months ago

      To be honest, I wouldn’t be surprised if it failed once every few 100s of thousands. Make sure to test all real integers

  • @[email protected]
    link
    fedilink
    English
    1510 months ago

    Don’t use OpenAI’s outdated tools. Also, don’t rely on prompt engineering to force the output to conform. Instead, use a local LLM and something like jsonformer or parserllm which can provably output well-formed/parseable text.

    • @lledrtx
      link
      810 months ago

      Agree this is better but neither of them actually seem “provable” though?

      • @[email protected]
        link
        fedilink
        English
        110 months ago

        I’ll be informal to boost your intuition. You know how a parser can reject invalid inputs? Parsers can be generated from grammars, so we can think of the grammars themselves as rejecting invalid inputs too. When we use a grammar for generation, every generated output will be a valid input when parsed, because the grammar can’t build any invalid sentences (by definition!)

        For example, suppose we want to generate a JSON object. The grammar for JSON objects starts with an opening curly brace “{”. This means that every parser which accepts JSON objects (and rejects everything else) must start by accepting “{”. So, our generator must start by emitting a “{” as well. Since our language-modeling generators work over probability distributions, this can be accomplished by setting the probability of every token which doesn’t start with “{” to zero.

    • @renzev
      link
      110 months ago

      Python is so great (half-sarcasm) that a trailing comma on its own constitutes a tuple (immutable list):

      mytuple = 4,
      assert len(mytuple) == 1
      assert mytuple[0] == 4
      
    • Ephera
      link
      fedilink
      110 months ago

      Yeah, I think, that’s only really JSON which is so pedantic about it…

      • enkers
        link
        fedilink
        8
        edit-2
        10 months ago

        Downside is that it includes your indentation whitespace, though I doubt chatgpt would care about that, as I’d imagine it gets discarded when it’s tokenized, but it’s still good to keep in mind when using " " ".

          • enkers
            link
            fedilink
            1
            edit-2
            10 months ago

            That’s a pretty clean looking solution. There are a few others as well, but yours seems better, and it’s in the standard lib to boot!