Error when try to Deploy: pydantic.v1.error

Hello everyone,

I am trying to deploy with an AI tool using OpenAI, but I keep receiving this error.pydantic.v1.error_wrappers.ValidationError.

The initial project used a Config.yaml, but I adapted it to st.secrets from Streamlit, but I still keep receiving the same error.

Reading the logs, I could see that there is this error:
ValidationError: 1 validation error for ChatOpenAI, this indicates that it is still the same problem of not finding the API key.

What am I doing wrong?

Thanks!

Link to the repo

────────────────────── Traceback (most recent call last) ───────────────────────

  /home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptru  

  nner/script_runner.py:589 in _run_script                                      

                                                                                

  /mount/src/dan-chat-rpg/AppRPG.py:26 in <module>                              

                                                                                

     23 os.environ['OPENAI_API_KEY'] = st.secrets["OPENAI_API_KEY"]             

     24                                                                         

     25                                                                         

  ❱  26 openai = ChatOpenAI(                                                    

     27 │   model_name='gpt-3.5-turbo',                                         

     28 │   temperature=0                                                       

     29 │   )                                                                   

                                                                                

  /home/adminuser/venv/lib/python3.12/site-packages/langchain_core/load/serial  

  izable.py:113 in __init__                                                     

                                                                                

    110 │   # Remove default BaseModel init docstring.                          

    111 │   def __init__(self, *args: Any, **kwargs: Any) -> None:              

    112 │   │   """"""                                                          

  ❱ 113 │   │   super().__init__(*args, **kwargs)                               

    114 │                                                                       

    115 │   @classmethod                                                        

    116 │   def is_lc_serializable(cls) -> bool:                                

                                                                                

  /home/adminuser/venv/lib/python3.12/site-packages/pydantic/v1/main.py:341 in  

  __init__                                                                      

                                                                                

     338 │   │   # Uses something other than `self` the first arg to allow "se  

     339 │   │   values, fields_set, validation_error = validate_model(__pydan  

     340 │   │   if validation_error:                                           

  ❱  341 │   │   │   raise validation_error                                     

     342 │   │   try:                                                           

     343 │   │   │   object_setattr(__pydantic_self__, '__dict__', values)      

     344 │   │   except TypeError as e:                                         

────────────────────────────────────────────────────────────────────────────────

ValidationError: 1 validation error for ChatOpenAI

__root__

  Client.__init__() got an unexpected keyword argument 'proxies' 

(type=type_error)