Comments (18)
It's not an error by the app, but you just need to have your API KEY inside environment variable! it's the error you get!
from talk2gpt.
You need to put your api key inside an environment variable named OPENAI_API_KEY
You can do it from terminal, or with Python too:
>>>import os
>>>os.environ['OPENAI_API_KEY']=<your_api_key_here>
from talk2gpt.
You need to put your api key inside an environment variable named OPENAI_API_KEY , were do that ??? were this located ???
from talk2gpt.
You need to put your api key inside an environment variable named OPENAI_API_KEY , were do that ??? were this located ???
you can set an environment variable both using Python or from the terminal itself.
From Python: >>> import os;os.environ['OPENAI_API_KEY']='sk-************'
From command prompt (Windows): set OPENAI_API_KEY=sk-***************
From Linux/MAC Terminal: export OPENAI_API_KEY = 'sk-************'
Note that it will be available just for the terminal session in use then it will disappear and you have to re set it.
if you want to have it always available just write it in your python code, but it is reccomended to use environment variable for security reasons.
Using Python, you can do something like this:
import os
os.environ["OPENAI_API_KEY"]='sk-*******'
#your code here#
so, every time it will auto create the environment variable so you donpt have to set it every time
from talk2gpt.
import os
os.environ["OPENAI_API_KEY"]='sk-*******'
you mean put these in file and name it .env ???? if correct were to put that ??? i do cmd then python then type import os then type os.environ['OPENAI_API_KEY']= then try again python app.py but get same error !
from talk2gpt.
import os os.environ["OPENAI_API_KEY"]='sk-*******'
you mean put these in file and name it .env ???? if correct were to put that ??? i do cmd then python then type import os then type os.environ['OPENAI_API_KEY']= then try again python app.py but get same error !
the app.py
script is no longer available, the project has been updated, now it is in the form of a pypi package that can be installed with pip. pip install gptalk
and the you have to import in your Python code with import gptalk.gptalk as gpt3
Check the README file here on GitHub. There is an example. Or Join Discord.
in any case it is correct how you set the environment variable. only that it must be used in the same session. or, you can also declare it without environment variable like so:
import openai
openai.api_key='sk-*****'
If people has troubles with environment variables so In the next version/update I will make it possible to insert the apikey directly into a variable inside the app, so it will be easier
from talk2gpt.
import os os.environ["OPENAI_API_KEY"]='sk-*******'
you mean put these in file and name it .env ???? if correct were to put that ??? i do cmd then python then type import os then type os.environ['OPENAI_API_KEY']= then try again python app.py but get same error !
only now i saw that you forked the old project. Well, the apikey should still work, I propose a change to your code so that you can figure out where to put it, but don't make it public, please!!!!
from talk2gpt.
import os os.environ["OPENAI_API_KEY"]='sk-*******'
you mean put these in file and name it .env ???? if correct were to put that ??? i do cmd then python then type import os then type os.environ['OPENAI_API_KEY']= then try again python app.py but get same error !
I've fixed the code in your fork , now youjust need to have your apikey inside a file named apikey.txt, in the same folder where you are running the script. WARNING, DO NOT SHARE YOUR KEY ON GITHUB
from talk2gpt.
so now download my fork zip file , then i will see in it new .txt called apikey.txt ???? i download it not see .txt
from talk2gpt.
or i need to create just txt file and name it apikey.txt and put in same app.py directory ???
from talk2gpt.
if yes what type inside .txt ???? this correct :
import os
os.environ["OPENAI_API_KEY"]='sk-*******'
from talk2gpt.
and keep it txt ??? or rename it to .env ???
from talk2gpt.
brother send to me link to download zip file that i just put my key inside it
from talk2gpt.
or i need to create just txt file and name it apikey.txt and put in same app.py directory ???
exactly
from talk2gpt.
or i need to create just txt file and name it apikey.txt and put in same app.py directory ???
exactly
sorry, go to line 131 of your app.py . you will find openai.api_key=os.getenv(....
after openai.api_key=
insert your apikey inside double quotes like this : openai.api_key="sk-*****"
Save it, And you're ok
from talk2gpt.
i do this : i create new txt file and mane it apikey.txt and put this inside it :
os.environ['OPENAI_API_KEY']="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"
then i put it in same directory of app.py
then i open app.py in visual studio code and edit line 131 and i see this :
openai.api_key = os.getenv("sk-xxxxxxxxxxX")
change it to this :
openai.api_key="sk-*****" ????
from talk2gpt.
i do what i say to you up then i got this :
Human: what is Raspberry Pi
Traceback (most recent call last):
File "C:\Users\Lenovo\Downloads\Compressed\GPT-Talk-main-fork\GPT-Talk-main\app.py", line 237, in
main()
File "C:\Users\Lenovo\Downloads\Compressed\GPT-Talk-main-fork\GPT-Talk-main\app.py", line 184, in main
response = openai.Completion.create(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\openai\api_resources\completion.py", line 25, in create
return super().create(args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 115, in create
response, _, api_key = requestor.request(
^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\openai\api_requestor.py", line 181, in request
resp, got_stream = self._interpret_response(result, stream)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\openai\api_requestor.py", line 396, in _interpret_response
self._interpret_response_line(
File "C:\Python311\Lib\site-packages\openai\api_requestor.py", line 429, in _interpret_response_line
raise self.handle_error_response(
openai.error.AuthenticationError: Incorrect API key provided: sk-QVNoH************************************KD2X. You can find your API key at https://beta.openai.com.
C:\Users\Lenovo\Downloads\Compressed\GPT-Talk-main-fork\GPT-Talk-main>
from talk2gpt.
can you brother upload ready to use zip file to me and im just put my api in it ? please upload it somewhere and send to me link to download it
from talk2gpt.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from talk2gpt.