Hii all. This is my code
import openai
import streamlit as st
from streamlit_chat import message
openai.api_key = st.secrets['pass']
def generate_response(prompt):
completions = openai.Completion.create(
engine = "text-davinci-003",
prompt = prompt,
max_tokens = 1024,
n = 1,
stop = None,
temperature=0.5,
)
message = completions.choices[0].text
return message
#Creating the chatbot interface
st.title("chatBot : Streamlit + openAI")
but its giving the error…
I see that .streamlit folder in there is my home diectory /user/shiva but secrets.toml is not found. how to create that file.
Goyo
March 15, 2023, 1:30pm
2
Open the folder in the File Explorer, right click, New, Text file, change the name to secrets.toml
.
Hii. Thankyou for helping. Yes I created a text file and named as secret.toml. it is taken as text file and not toml file.
Goyo
March 15, 2023, 10:35pm
4
Indeed it is supposed to contain text, so that is fine.
then still im getting the same error… pls help …
Goyo
March 21, 2023, 8:50am
6
Sorry, I always forget that Windows by default doesn’t show you the complete file names.
If you select View->File name extensions , you will see that secrets.toml is actually secrets.toml.txt . Remove the .txt part.
did you got the solution of this error ?
The solution should be as @Goyo mentioned above: make sure the file is named correctly and in the correct folder. (In a folder named .secrets
, have a file named secrets.toml
.) If you cannot see your file extension in your file navigation, be extra careful about secrets.toml
vs something like secrets.toml.txt
on accident. I recommend working with your files directly in your IDE (like VS code) which should show you your complete file names with extensions.
system
Closed
August 10, 2023, 10:46pm
9
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.