https://docs.amplify.aws/react/deploy-and-host/fullstack-branching/secrets-and-vars/
The available documentation is of limited help and isnt able to resolve the issue.
Once the required changes are made, the code should be able to intract with the Open AI API. is there a way to acieve the result without using the sandbox.