Hi everyone,
I’m new here and currently working on my first agent course. I’m trying to build my first agent, but I’m having some difficulties managing the API key.
I followed the steps outlined in this discussion (ysharma/ChatGPT4 · how to use openai api key?), but I’m still encountering an error.
I put this code at the top
| from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool | |
|---|---|
| import datetime | |
| import requests | |
| import pytz | |
| import yaml | |
| from tools.final_answer import FinalAnswerTool | |
| from openai import OpenAI | |
| import gradio as gr | |
| import os | |
| api_key = os.getenv(“OPENAI_API_KEY”) | |
| client = OpenAI(api_key=api_key) |
==================================================
runtime error
Exit code: 1. Reason: Traceback (most recent call last): File “/home/user/app/app.py”, line 7, in from openai import OpenAI ModuleNotFoundError: No module named ‘openai’
Container logs:
===== Application Startup at 2025-05-27 16:31:22 =====
Traceback (most recent call last):
File "/home/user/app/app.py", line 7, in <module>
from openai import OpenAI
ModuleNotFoundError: No module named 'openai'