I have been trying to use langchain library's ChatOpenAI
, I pip installed langchain, and imported ChatOpenAI
I'm running my code on colab so I set my the openAI's api key as:
%env OPENAI_API_KEY= my_api_key
now when I try to initialize ChatOpenAI
as follows, it runs without error:
chat = ChatOpenAI(temperature=0.0,openai_organization='Personal')
chat
I get the following as the result:
ChatOpenAI(verbose=False, callbacks=None, callback_manager=None, client=<class 'openai.api_resources.chat_completion.ChatCompletion'>, model_name='gpt-3.5-turbo', temperature=0.0, model_kwargs={}, openai_api_key='my_api_key', openai_api_base='', openai_organization='Personal', openai_proxy='', request_timeout=None, max_retries=6, streaming=False, n=1, max_tokens=None)
But when I try to run it as :
customer_response = chat(customer_messages)
It throws the following error:
---------------------------------------------------------------------------
AuthenticationError Traceback (most recent call last)
<ipython-input-64-a39359b08f39> in <cell line: 1>()
----> 1 customer_response = chat(customer_messages)
17 frames
/usr/local/lib/python3.10/dist-packages/openai/api_requestor.py in _interpret_response_line(self, rbody, rcode, rheaders, stream)
761 stream_error = stream and "error" in resp.data
762 if stream_error or not 200 <= rcode < 300:
--> 763 raise self.handle_error_response(
764 rbody, rcode, resp.data, rheaders, stream_error=stream_error
765 )
AuthenticationError: <empty message>