microsoft / FLAML

A fast library for AutoML and tuning. Join our Discord: https://discord.gg/Cppx2vSPVP.
https://microsoft.github.io/FLAML/
MIT License
3.76k stars 495 forks source link

please install flaml[openai] option to use the flaml.autogen.oai subpackage. #1243

Open tianyalangzi opened 8 months ago

tianyalangzi commented 8 months ago

My code always has this error, but shows that flaml has been installed, even if I reinstall it using the python virtual environment it still has the same error! my code : from flaml import autogen from import get_user_taskinfo from import user_context

def autogentask(task: str):

from flaml import autogen

user_data = user_context.get() user_path = user_data["user_path"]

create an AssistantAgent instance named "assistant"

assistant = autogen.AssistantAgent(name="assistant")

create a UserProxyAgent instance named "user_proxy"

user = autogen.UserProxyAgent( name="user assistant", human_input_mode="NEVER", # in this mode, the agent will never solicit human input but always auto reply max_consecutive_auto_reply=5, code_execution_config={"work_dir": user_path}, system_message="You are a helpful AI Assistant,You will do your best to complete the user's task in the least number of steps while maintaining quality", )

the assistant receives a message from the user, which contains the task description

user.initiate_chat( assistant, message=task, )

sonichi commented 8 months ago

The autogen part has spined off to https://github.com/microsoft/autogen. Please install the new package.