Giter Site home page Giter Site logo

Comments (2)

bluecoconut avatar bluecoconut commented on May 22, 2024

Hmm, I'm not sure.

1 thing to note: your key is visible in the screenshot, so you will probably want to roll that key asap.

it looks like the env var is getting noticed... so my best guess is something about cutting the key a character short or something when copying? Or having a deactivated key?

you can probably quickly test this (without using sketch apply) by just using lambdaprompt directly

import lambdaprompt
import os
os.environ['OPENAI_API_KEY'] = '***'

lambdaprompt.GPT3Prompt("Test completion after this line:")()

it will probably give you the same error (with the same wrong key) and then you can get one that works?

I just ran the above example, with a fresh key, and it worked immediately.

from sketch.

bluecoconut avatar bluecoconut commented on May 22, 2024

I think this isn't a bug with the library, and i just realized you could probably iterate with the api key directly on openai endpoint as well (just use requests and env vars, and see if your key works)

import requests
import os
os.environ["OPENAI_API_KEY"] = "***"
headers = {
        "Authorization": f"Bearer {os.environ.get('OPENAI_API_KEY')}",
        "Content-Type": "application/json",
    }

data = {
    "prompt": "Hello...",
    "model": "text-davinci-003",
}

resp = requests.post("https://api.openai.com/v1/completions", headers=headers, json=data)
print(resp.text)

If this works for you, then setting up environment variables the same way with sketch doesn't -- then i can re-open this issue (be sure to reach out again here). For now i'm going to close the issue.

from sketch.

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.