Not able to find secrets.toml file

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,
    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.

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.

Indeed it is supposed to contain text, so that is fine.

then still im getting the same error… pls help …

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.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.