#ImportError: please install openai and diskcache to use the autogen.oai subpackage.

6 messages · Page 1 of 1 (latest)

compact kayak
#

Just started getting this error today.

My setup:
Nextjs application with a Python Flask backend

Python Flask code:
from flask import Flask, request
from flask_cors import CORS
from autogen import AssistantAgent, UserProxyAgent, config_list_from_json
import os

app = Flask(name)
CORS(app)

@app.route("/api/autogen", methods=['POST'])
def autogen():
config_list = config_list_from_json(env_or_file="OAI_CONFIG_LIST")
assistant = AssistantAgent("assistant", llm_config={"config_list": config_list})
user_proxy = UserProxyAgent("user_proxy", code_execution_config={"work_dir": "agent_branch"})
message = request.json.get('message', "Convert user requirements to Python code.")
user_proxy.initiate_chat(assistant, message=message)
# This initiates an automated chat between the two agents to solve the task
return {"status": "success"}

limpid tapir
#

Were you able to successfully use flask with autogen before?

compact kayak
#

Yes, was working great until today :{

limpid tapir
#

What changed today? Did you rebuild the virtual environment, perhaps picking up a new version of some package?

compact kayak
#

Did reinstall pyautogen

limpid tapir
#

The reinstallation probably picked up a modified package that caused something to break. Which version of pyautogen are you currently using? Do you perform these installations in separate virtual environments? That would preserve the old packages for reference.