Use Cases
- Use cases
- Reference Agents
- Notebooks
- All Notebooks
- Solving Multiple Tasks in a Sequence of Chats
- Solving Multiple Tasks in a Sequence of Async Chats
- Using RetrieveChat for Retrieve Augmented Code Generation and Question Answering
- Interactive LLM Agent Dealing with Data Stream
- Agent Chat with Async Human Inputs
- Using RetrieveChat Powered by MongoDB Atlas for Retrieve Augmented Code Generation and Question Answering
- Auto Generated Agent Chat: Task Solving with Langchain Provided Tools as Functions
- Task Solving with Code Generation, Execution and Debugging
- Runtime Logging with AutoGen
- Agent Chat with Multimodal Models: DALLE and GPT-4V
- Using RetrieveChat with Qdrant for Retrieve Augmented Code Generation and Question Answering
- Enhanced Swarm Orchestration with AG2
- Translating Video audio using Whisper and GPT-3.5-turbo
- Agent Tracking with AgentOps
- Group Chat with Coder and Visualization Critic
- ReasoningAgent - Advanced LLM Reasoning with Multiple Search Strategies
- DeepResearchAgent
- Tools with Dependency Injection
- A Uniform interface to call different LLMs
- SQL Agent for Spider text-to-SQL benchmark
- DeepSeek: Adding Browsing Capabilities to AG2
- CaptainAgent
- Adding Browsing Capabilities to AG2
- Auto Generated Agent Chat: Teaching AI New Skills via Natural Language Interaction
- Writing a software application using function calls
- Auto Generated Agent Chat: Function Inception
- Agentic RAG workflow on tabular data from a PDF file
- RealtimeAgent in a Swarm Orchestration
- Using FalkorGraphRagCapability with agents for GraphRAG Question & Answering
- Making OpenAI Assistants Teachable
- Cross-Framework LLM Tool Integration with AG2
- RealtimeAgent with local websocket connection
- Using RetrieveChat Powered by PGVector for Retrieve Augmented Code Generation and Question Answering
- OpenAI Assistants in AutoGen
- Solving Complex Tasks with Nested Chats
- Auto Generated Agent Chat: GPTAssistant with Code Interpreter
- Group Chat with Customized Speaker Selection Method
- Structured output
- Agent Chat with custom model loading
- AutoBuild
- FSM - User can input speaker transition constraints
- Using Neo4j's graph database with AG2 agents for Question & Answering
- Use AutoGen in Databricks with DBRX
- Language Agent Tree Search
- Using a local Telemetry server to monitor a GraphRAG agent
- SocietyOfMindAgent
- Perform Research with Multi-Agent Group Chat
- Group Chat
- StateFlow: Build Workflows through State-Oriented Actions
- Agent Chat with Multimodal Models: LLaVA
- Trip planning with a FalkorDB GraphRAG agent using a Swarm
- Auto Generated Agent Chat: Collaborative Task Solving with Multiple Agents and Human Users
- Agent with memory using Mem0
- Preprocessing Chat History with `TransformMessages`
- AgentOptimizer: An Agentic Way to Train Your LLM Agent
- Using RetrieveChat Powered by Couchbase Capella for Retrieve Augmented Code Generation and Question Answering
- Agent Observability with OpenLIT
- Chatting with a teachable agent
- RealtimeAgent in a Swarm Orchestration
- Conversational Chess using non-OpenAI clients
- Solving Complex Tasks with A Sequence of Nested Chats
- Config loader utility functions
- Currency Calculator: Task Solving with Provided Tools as Functions
- Chat with OpenAI Assistant using function call in AutoGen: OSS Insights for Advanced GitHub Data Analysis
- Web Scraping using Apify Tools
- Agent with memory using Mem0
- Auto Generated Agent Chat: Collaborative Task Solving with Coding and Planning Agent
- Demonstrating the `AgentEval` framework using the task of solving math problems as an example
- RealtimeAgent with WebRTC connection
- Automatically Build Multi-agent System from Agent Library
- Groupchat with Llamaindex agents
- Using Guidance with AutoGen
- RealtimeAgent in a Swarm Orchestration using WebRTC
- Cross-Framework LLM Tool for CaptainAgent
- RealtimeAgent in a Swarm Orchestration
- Websockets: Streaming input and output using websockets
- Auto Generated Agent Chat: Solving Tasks Requiring Web Info
- Auto Generated Agent Chat: Task Solving with Code Generation, Execution, Debugging & Human Feedback
- Assistants with Azure Cognitive Search and Azure Identity
- (Legacy) Implement Swarm-style orchestration with GroupChat
- Auto Generated Agent Chat: Task Solving with Provided Tools as Functions
- Agentchat MathChat
- Small, Local Model (IBM Granite) Multi-Agent RAG
- Group Chat with Retrieval Augmented Generation
- Run a standalone AssistantAgent
- Nested Chats for Tool Use in Conversational Chess
- Swarm Orchestration with AG2
- OptiGuide with Nested Chats in AutoGen
- Usage tracking with AutoGen
- From Dad Jokes To Sad Jokes: Function Calling with GPTAssistantAgent
- Discord, Slack, and Telegram messaging tools
- RAG OpenAI Assistants in AutoGen
- Auto Generated Agent Chat: Group Chat with GPTAssistantAgent
- Task Solving with Provided Tools as Functions (Asynchronous Function Calls)
- Generate Dalle Images With Conversable Agents
- Chat Context Dependency Injection
- Solving Multiple Tasks in a Sequence of Chats with Different Conversable Agent Pairs
- Engaging with Multimodal Models: GPT-4V in AutoGen
- Mitigating Prompt hacking with JSON Mode in Autogen
- Using Neo4j's native GraphRAG SDK with AG2 agents for Question & Answering
- Supercharging Web Crawling with Crawl4AI
- WebSurferAgent
- RealtimeAgent with gemini client
- Community Gallery
Chat with OpenAI Assistant using function call in AutoGen: OSS Insights for Advanced GitHub Data Analysis
This Jupyter Notebook demonstrates how to leverage OSS Insight (Open Source Software Insight) for advanced GitHub data analysis by defining Function calls
in AutoGen for the OpenAI Assistant.
This Jupyter Notebook demonstrates how to leverage OSS Insight (Open
Source Software Insight) for advanced GitHub data analysis by defining
Function calls
in AutoGen for the OpenAI Assistant.
The notebook is structured into four main sections:
- Function Schema and Implementation
- Defining an OpenAI Assistant Agent in AutoGen
- Fetching GitHub Insight Data using Function Call
Requirements
AutoGen requires Python>=3.9
. To run this notebook example, please
install:
Install pyautogen
:
pip install pyautogen
For more information, please refer to the installation guide.
%%capture --no-stderr
# %pip install "pyautogen>=0.2.3"
Function Schema and Implementation
This section provides the function schema definition and their implementation details. These functions are tailored to fetch and process data from GitHub, utilizing OSS Insight’s capabilities.
import logging
import os
from autogen import UserProxyAgent, config_list_from_json
from autogen.agentchat.contrib.gpt_assistant_agent import GPTAssistantAgent
logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)
ossinsight_api_schema = {
"name": "ossinsight_data_api",
"parameters": {
"type": "object",
"properties": {
"question": {
"type": "string",
"description": (
"Enter your GitHub data question in the form of a clear and specific question to ensure the returned data is accurate and valuable. "
"For optimal results, specify the desired format for the data table in your request."
),
}
},
"required": ["question"],
},
"description": "This is an API endpoint allowing users (analysts) to input question about GitHub in text format to retrieve the related and structured data.",
}
def get_ossinsight(question):
"""[Mock] Retrieve the top 10 developers with the most followers on GitHub."""
report_components = [
f"Question: {question}",
"SQL: SELECT `login` AS `user_login`, `followers` AS `followers` FROM `github_users` ORDER BY `followers` DESC LIMIT 10",
"""Results:
{'followers': 166730, 'user_login': 'torvalds'}
{'followers': 86239, 'user_login': 'yyx990803'}
{'followers': 77611, 'user_login': 'gaearon'}
{'followers': 72668, 'user_login': 'ruanyf'}
{'followers': 65415, 'user_login': 'JakeWharton'}
{'followers': 60972, 'user_login': 'peng-zhihui'}
{'followers': 58172, 'user_login': 'bradtraversy'}
{'followers': 52143, 'user_login': 'gustavoguanabara'}
{'followers': 51542, 'user_login': 'sindresorhus'}
{'followers': 49621, 'user_login': 'tj'}""",
]
return "\n" + "\n\n".join(report_components) + "\n"
Defining an OpenAI Assistant Agent in AutoGen
Here, we explore how to define an OpenAI Assistant Agent within the AutoGen. This includes setting up the agent to make use of the previously defined function calls for data retrieval and analysis.
assistant_id = os.environ.get("ASSISTANT_ID", None)
config_list = config_list_from_json("OAI_CONFIG_LIST")
llm_config = {
"config_list": config_list,
}
assistant_config = {
"assistant_id": assistant_id,
"tools": [
{
"type": "function",
"function": ossinsight_api_schema,
}
],
}
oss_analyst = GPTAssistantAgent(
name="OSS Analyst",
instructions=(
"Hello, Open Source Project Analyst. You'll conduct comprehensive evaluations of open source projects or organizations on the GitHub platform, "
"analyzing project trajectories, contributor engagements, open source trends, and other vital parameters. "
"Please carefully read the context of the conversation to identify the current analysis question or problem that needs addressing."
),
llm_config=llm_config,
assistant_config=assistant_config,
verbose=True,
)
oss_analyst.register_function(
function_map={
"ossinsight_data_api": get_ossinsight,
}
)
OpenAI client config of GPTAssistantAgent(OSS Analyst) - model: gpt-4-turbo-preview
GPT Assistant only supports one OpenAI client. Using the first client in the list.
No matching assistant found, creating a new assistant
Learn more about configuring LLMs for agents here.
Fetching GitHub Insight Data using Function Call
This part of the notebook demonstrates the practical application of the defined functions and the OpenAI Assistant Agent in fetching and interpreting GitHub Insight data.
user_proxy = UserProxyAgent(
name="user_proxy",
code_execution_config={
"work_dir": "coding",
"use_docker": False,
}, # Please set use_docker=True if docker is available to run the generated code. Using docker is safer than running the generated code directly.
is_termination_msg=lambda msg: "TERMINATE" in msg["content"],
human_input_mode="NEVER",
max_consecutive_auto_reply=1,
)
user_proxy.initiate_chat(oss_analyst, message="Top 10 developers with the most followers")
oss_analyst.delete_assistant()
user_proxy (to OSS Analyst):
Top 10 developers with the most followers
--------------------------------------------------------------------------------
>>>>>>>> EXECUTING FUNCTION ossinsight_data_api...
Input arguments: {'question': 'Top 10 developers with the most followers'}
Output:
Question: Top 10 developers with the most followers
SQL: SELECT `login` AS `user_login`, `followers` AS `followers` FROM `github_users` ORDER BY `followers` DESC LIMIT 10
Results:
{'followers': 166730, 'user_login': 'torvalds'}
{'followers': 86239, 'user_login': 'yyx990803'}
{'followers': 77611, 'user_login': 'gaearon'}
{'followers': 72668, 'user_login': 'ruanyf'}
{'followers': 65415, 'user_login': 'JakeWharton'}
{'followers': 60972, 'user_login': 'peng-zhihui'}
{'followers': 58172, 'user_login': 'bradtraversy'}
{'followers': 52143, 'user_login': 'gustavoguanabara'}
{'followers': 51542, 'user_login': 'sindresorhus'}
{'followers': 49621, 'user_login': 'tj'}
OSS Analyst (to user_proxy):
The top 10 developers with the most followers on GitHub are:
1. **Linus Torvalds** (`torvalds`) with 166,730 followers
2. **Evan You** (`yyx990803`) with 86,239 followers
3. **Dan Abramov** (`gaearon`) with 77,611 followers
4. **Ruan YiFeng** (`ruanyf`) with 72,668 followers
5. **Jake Wharton** (`JakeWharton`) with 65,415 followers
6. **Peng Zhihui** (`peng-zhihui`) with 60,972 followers
7. **Brad Traversy** (`bradtraversy`) with 58,172 followers
8. **Gustavo Guanabara** (`gustavoguanabara`) with 52,143 followers
9. **Sindre Sorhus** (`sindresorhus`) with 51,542 followers
10. **TJ Holowaychuk** (`tj`) with 49,621 followers
--------------------------------------------------------------------------------
user_proxy (to OSS Analyst):
--------------------------------------------------------------------------------
OSS Analyst (to user_proxy):
It looks like there is no question or prompt for me to respond to. Could you please provide more details or ask a question that you would like assistance with?
--------------------------------------------------------------------------------
Permanently deleting assistant...