Skip to content

Forum in maintenance, we will back soon 🙂

Error while running...
 
Notifications
Clear all

Error while running blog_summarization.py

5 Posts
3 Users
3 Reactions
92 Views
(@google-shuvchowdhury)
Posts: 9
Eminent Member
Topic starter
 

I am getting error wile running the blog_summarization.py 

"Traceback (most recent call last):
File "d:\PromptEngineering\Hasan_Code\PE-Course-codes-main\blog_summarization.py", line 15, in <module>
response = llm.llm_generate_text(prompt, "OpenAI", selected_model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "d:\PromptEngineering\Hasan_Code\PE-Course-codes-main\llm.py", line 36, in llm_generate_text
generated_text = openai_generate(prompt, model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "d:\PromptEngineering\Hasan_Code\PE-Course-codes-main\llm.py", line 50, in openai_generate
completion = openai.chat.completions.create(
^^^^^^^^^^^
AttributeError: module 'openai' has no attribute 'chat'

 
Posted : 07/18/2024 8:58 pm
(@google-shuvchowdhury)
Posts: 9
Eminent Member
Topic starter
 

Issue is due to missing API Keys - LLM.py had missing API keys - Open API, NLP Cloud and Cohere 

 
Posted : 07/19/2024 7:37 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@google-shuvchowdhury you should be putting API keys into a file named .env.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 07/19/2024 10:54 pm
Hasan Aboul Hasan
(@admin)
Posts: 1251
Member Admin
 

@google-shuvchowdhury yeah, did you set the API keys?

 
Posted : 07/21/2024 9:57 am
(@google-shuvchowdhury)
Posts: 9
Eminent Member
Topic starter
 

Thanks @admin Hasan and @ssadvisor Earnie As I have mentioned - I have fixed the error. 

 
Posted : 07/22/2024 7:38 pm
Share: