Giter Club home page Giter Club logo

Comments (7)

adamrushy avatar adamrushy commented on September 27, 2024 2

Thank you @andrewcar for confirming. So let me share my sample code;

        openAI.sendCompletion(with: "Hello how are you", maxTokens: 100) { result in
            switch result {
            case .success(let success):
                print(success.choices.first?.text ?? "")
            case .failure(let failure):
                print(failure.localizedDescription)
            }
        }

Console output is:

I'm doing great, thank you! How are you?

from openaiswift.

andrewcar avatar andrewcar commented on September 27, 2024 1

I am getting the same issue.

UPDATE: Fixed! I had apparently left out some characters when using my API key. After generating a new one, it works! Thanks for making this library, @adamrushy!

from openaiswift.

andrewcar avatar andrewcar commented on September 27, 2024 1

@andrewcar which characters are you talking about? I am also facing same error. Maybe your solution can help.

If you go to your API keys, and if you have generated any secret keys, you'll see them there with the middle truncated.

So, when I visited there to double check mine, I noticed that the last characters didn't match up with what I was using to initialize the Swift library. I just created a new one and my issue was resolved.

UPDATE: The one I was using last night stopped working and also didn't match up with what I had in the truncated version on their site. Generated a new one just fine. Even though I haven't used mine in any public fashion, what I think is causing that is this:

In order to protect the security of your account, OpenAI may also automatically rotate any API key that we've found has leaked publicly.

from openaiswift.

adamrushy avatar adamrushy commented on September 27, 2024

Hey, @chetan-diy-ios

Can you share the text you're sending, please?

Thank you,
Adam

from openaiswift.

chetan-diy-ios avatar chetan-diy-ios commented on September 27, 2024

I tried many questions.
"Hello how are you"
"Biggest animal on planet"
"when is iPhone will actually get a update"

from openaiswift.

rishav4336 avatar rishav4336 commented on September 27, 2024

@andrewcar which characters are you talking about? I am also facing same error. Maybe your solution can help.

from openaiswift.

adamrushy avatar adamrushy commented on September 27, 2024

Closing based on above discussion, please open new issue with the issue persists 😀

from openaiswift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.