Created
April 13, 2025 21:50
-
-
Save fadur/7badc17c4c48b88fe81ebf47c9a0f25e to your computer and use it in GitHub Desktop.
Autogen - Example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from autogen import AssistantAgent, UserProxyAgent, tool | |
@tool | |
def get_time() -> str: | |
from datetime import datetime | |
return datetime.now().isoformat() | |
user_proxy = UserProxyAgent(name="user_proxy", human_input_mode="NEVER") | |
assistant = AssistantAgent( | |
name="assistant", | |
llm_config={"config_list": [{"model": "gpt-4", "api_key": "your-key"}]}, | |
code_execution_config={"work_dir": "coding"}, | |
) | |
user_proxy.initiate_chat( | |
assistant, | |
message="What time is it?", | |
tools=[get_time], | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment