rawandahmad698 / PyChatGPT

⚡️ Python client for the unofficial ChatGPT API with auto token regeneration, conversation tracking, proxy support and more.
MIT License
4.22k stars 447 forks source link

[Feature Request] Make auth.json location configurable #111

Open veered opened 1 year ago

veered commented 1 year ago

Is your feature request related to a problem? Please describe. It would be helpful to make the location of auth.json (as used here) configurable.

Describe the solution you'd like Expanding the options passed to Chat to optionally include a auth_file_path should work.

Describe alternatives you've considered It also could be an environment variable.

Additional context This came up while Dockerizing a tool which uses this library. The auth.json isn't stored in the shared volume, and so it is not being persisted across container runs.

jag-ermeister commented 1 year ago

I had the same issue while trying to deploy this to an AWS Lambda function, which only has access to the filesystem at the /tmp directory. I ended up monkey patching the openai file's get_access_token, token_expired, and Auth.save_access_token functions to save it to and retrieve it from DynamoDB instead.