Super learner
This user is a Super Learner. To become a Super Learner, you need to reach Level 8.
Last answered:

13 Sept 2024

Posted on:

07 Sept 2024

0

Getting an Error:

Build Chat Applications with OpenAI and LangChain

https://learn.365datascience.com/courses/preview/build-chat-applications-with-openai-and-langchain/

I
set up the .env file that contains the ‘OpenAI’ API key

04 The OpenAI API 03.ipynb
Build Chat Applications with OpenAI and LangChain

completion = client.chat.completions.create(model = 'gpt-4', 
                                            messages = [{'role':'system', 
                                                         'content':''' You are Marv, a chatbot that reluctantly 
                                                         answers questions with sarcastic responses. '''}, 
                                                        {'role':'user', 
                                                         'content':''' I've recently adopted a dog. 
                                                         Could you suggest some dog names? '''}])
OpenAI & LangchainOpenAI & Langchain
 
8 answers ( 0 marked as helpful)
Instructor
Posted on:

09 Sept 2024

0
Hey Frederick,
Thank you for reaching out!
Could you please provide a screenshot of your code and the error you are getting?
Kind regards,
365 Hristina
Super learner
This user is a Super Learner. To become a Super Learner, you need to reach Level 8.
Posted on:

09 Sept 2024

0
Instructor
Posted on:

11 Sept 2024

0
Hey again Frederick,
Have you ensured that you OpenAI API key is set up correctly? Do you have your API key displayed upon executing the command below?
 openai.api_key
If you can see your API key, could you please screenshot the rest of the error message?
Thank you!
Kind regards,
365 Hristina
Super learner
This user is a Super Learner. To become a Super Learner, you need to reach Level 8.
Posted on:

12 Sept 2024

0
Thank you for all of your help.
I will start at the begining starting with #3 Setting up the environment again.
Setting the API Key as the environmental variable
Clicked on the "Resources" button resulted in:
File not found
Done
Is this the result that I should be getting?