microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
31.36k stars 4.57k forks source link

[Question] #2987

Open anoukbarnoud-doctolib opened 3 months ago

anoukbarnoud-doctolib commented 3 months ago

Describe the bug

Hello everyone, I am trying to test Autogen. I have a functioning API key, however I have this error when trying to initialize my project Error

image

Piece of code : `from dotenv import load_dotenv import os

load_dotenv() # This line brings all environment variables from .env into os.environ llm_config = {"model": "gpt-4", "api_key": os.environ["OPENAI_API_KEY"]}

assistant = AssistantAgent("assistant", llm_config=llm_config) user_proxy = UserProxyAgent("user_proxy", code_execution_config=False)`

Steps to reproduce

No response

Model Used

gpt-4

Expected Behavior

The API key has the correct format and it should work fine

Screenshots and logs

image

Additional Information

Hk669 commented 3 months ago

llm_config : List[Dict] https://microsoft.github.io/autogen/docs/topics/llm_configuration/

update required:

config_list = [
    {        
         "model": "gpt-4", 
        "api_key": os.environ["OPENAI_API_KEY"]
     }
 ]
llm_config = {"config_list" : config_list}

@anoukbarnoud-doctolib these above changes should work perfectly.