mirror of https://github.com/microsoft/autogen.git
Anthropic client fixes (#2981)
* add claude 3.5 sonnet to pricing * Fix import error for client_utils * fix import order for ruff formatter * name key is not supported in anthropic message so let's remove it * Improved tool use message conversion, changed create to return standard response * Converted tools to messages for speaker selection, moved message conversion to function, corrected bugs * Minor bracket typo. * Renaming function * add groupchat and run notebook --------- Co-authored-by: Mark Sze <mark@sze.family> Co-authored-by: Qingyun Wu <qingyun0327@gmail.com> Co-authored-by: HRUSHIKESH DOKALA <96101829+Hk669@users.noreply.github.com>
This commit is contained in:
parent
3e3f2985c2
commit
843c343383
|
@ -24,17 +24,20 @@ import copy
|
|||
import inspect
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
import warnings
|
||||
from typing import Any, Dict, List, Tuple, Union
|
||||
|
||||
from anthropic import Anthropic
|
||||
from anthropic import __version__ as anthropic_version
|
||||
from anthropic.types import Completion, Message
|
||||
from client_utils import validate_parameter
|
||||
from anthropic.types import Completion, Message, TextBlock, ToolUseBlock
|
||||
from openai.types.chat import ChatCompletion, ChatCompletionMessageToolCall
|
||||
from openai.types.chat.chat_completion import ChatCompletionMessage, Choice
|
||||
from openai.types.completion_usage import CompletionUsage
|
||||
from typing_extensions import Annotated
|
||||
|
||||
from autogen.oai.client_utils import validate_parameter
|
||||
|
||||
TOOL_ENABLED = anthropic_version >= "0.23.1"
|
||||
if TOOL_ENABLED:
|
||||
from anthropic.types.tool_use_block_param import (
|
||||
|
@ -43,6 +46,7 @@ if TOOL_ENABLED:
|
|||
|
||||
|
||||
ANTHROPIC_PRICING_1k = {
|
||||
"claude-3-5-sonnet-20240620": (0.003, 0.015),
|
||||
"claude-3-sonnet-20240229": (0.003, 0.015),
|
||||
"claude-3-opus-20240229": (0.015, 0.075),
|
||||
"claude-2.0": (0.008, 0.024),
|
||||
|
@ -104,49 +108,14 @@ class AnthropicClient:
|
|||
return self._api_key
|
||||
|
||||
def create(self, params: Dict[str, Any]) -> Completion:
|
||||
"""Create a completion for a given config.
|
||||
|
||||
Args:
|
||||
params: The params for the completion.
|
||||
|
||||
Returns:
|
||||
The completion.
|
||||
"""
|
||||
if "tools" in params:
|
||||
converted_functions = self.convert_tools_to_functions(params["tools"])
|
||||
params["functions"] = params.get("functions", []) + converted_functions
|
||||
|
||||
raw_contents = params["messages"]
|
||||
# Convert AutoGen messages to Anthropic messages
|
||||
anthropic_messages = oai_messages_to_anthropic_messages(params)
|
||||
anthropic_params = self.load_config(params)
|
||||
|
||||
processed_messages = []
|
||||
for message in raw_contents:
|
||||
|
||||
if message["role"] == "system":
|
||||
params["system"] = message["content"]
|
||||
elif message["role"] == "function":
|
||||
processed_messages.append(self.return_function_call_result(message["content"]))
|
||||
elif "function_call" in message:
|
||||
processed_messages.append(self.restore_last_tooluse_status())
|
||||
elif message["content"] == "":
|
||||
message["content"] = "I'm done. Please send TERMINATE" # Not sure about this one.
|
||||
processed_messages.append(message)
|
||||
else:
|
||||
processed_messages.append(message)
|
||||
|
||||
# Check for interleaving roles and correct, for Anthropic must be: user, assistant, user, etc.
|
||||
for i, message in enumerate(processed_messages):
|
||||
if message["role"] is not ("user" if i % 2 == 0 else "assistant"):
|
||||
message["role"] = "user" if i % 2 == 0 else "assistant"
|
||||
|
||||
# Note: When using reflection_with_llm we may end up with an "assistant" message as the last message
|
||||
if processed_messages[-1]["role"] != "user":
|
||||
# If the last role is not user, add a continue message at the end
|
||||
continue_message = {"content": "continue", "role": "user"}
|
||||
processed_messages.append(continue_message)
|
||||
|
||||
params["messages"] = processed_messages
|
||||
|
||||
# TODO: support stream
|
||||
params = params.copy()
|
||||
if "functions" in params:
|
||||
|
@ -157,7 +126,7 @@ class AnthropicClient:
|
|||
# Anthropic doesn't accept None values, so we need to use keyword argument unpacking instead of setting parameters.
|
||||
# Copy params we need into anthropic_params
|
||||
# Remove any that don't have values
|
||||
anthropic_params["messages"] = params["messages"]
|
||||
anthropic_params["messages"] = anthropic_messages
|
||||
if "system" in params:
|
||||
anthropic_params["system"] = params["system"]
|
||||
if "tools" in params:
|
||||
|
@ -174,61 +143,65 @@ class AnthropicClient:
|
|||
# Calculate and save the cost onto the response
|
||||
prompt_tokens = response.usage.input_tokens
|
||||
completion_tokens = response.usage.output_tokens
|
||||
response.cost = _calculate_cost(prompt_tokens, completion_tokens, anthropic_params["model"])
|
||||
|
||||
return response
|
||||
message_text = ""
|
||||
if response is not None:
|
||||
# If we have tool use as the response, populate completed tool calls for our return OAI response
|
||||
if response.stop_reason == "tool_use":
|
||||
anthropic_finish = "tool_calls"
|
||||
tool_calls = []
|
||||
for content in response.content:
|
||||
if type(content) == ToolUseBlock:
|
||||
tool_calls.append(
|
||||
ChatCompletionMessageToolCall(
|
||||
id=content.id,
|
||||
function={"name": content.name, "arguments": json.dumps(content.input)},
|
||||
type="function",
|
||||
)
|
||||
)
|
||||
else:
|
||||
anthropic_finish = "stop"
|
||||
tool_calls = None
|
||||
|
||||
def message_retrieval(self, response: Union[Message]) -> Union[List[str], List[ChatCompletionMessage]]:
|
||||
"""Retrieve the messages from the response."""
|
||||
messages = response.content
|
||||
if len(messages) == 0:
|
||||
return [None]
|
||||
res = []
|
||||
if TOOL_ENABLED:
|
||||
for choice in messages:
|
||||
if choice.type == "tool_use":
|
||||
res.insert(0, self.response_to_openai_message(choice))
|
||||
self._last_tooluse_status["tool_use"] = choice.model_dump()
|
||||
else:
|
||||
res.append(choice.text)
|
||||
self._last_tooluse_status["think"] = choice.text
|
||||
# Retrieve any text content from the response
|
||||
for content in response.content:
|
||||
if type(content) == TextBlock:
|
||||
message_text = content.text
|
||||
break
|
||||
|
||||
return res
|
||||
|
||||
else:
|
||||
return [ # type: ignore [return-value]
|
||||
choice.text if choice.message.function_call is not None else choice.message.content # type: ignore [union-attr]
|
||||
for choice in messages
|
||||
]
|
||||
|
||||
def response_to_openai_message(self, response) -> ChatCompletionMessage:
|
||||
"""Convert the client response to OpenAI ChatCompletion Message"""
|
||||
dict_response = response.model_dump()
|
||||
return ChatCompletionMessage(
|
||||
content=None,
|
||||
# Convert output back to AutoGen response format
|
||||
message = ChatCompletionMessage(
|
||||
role="assistant",
|
||||
function_call={"name": dict_response["name"], "arguments": json.dumps(dict_response["input"])},
|
||||
content=message_text,
|
||||
function_call=None,
|
||||
tool_calls=tool_calls,
|
||||
)
|
||||
choices = [Choice(finish_reason=anthropic_finish, index=0, message=message)]
|
||||
|
||||
response_oai = ChatCompletion(
|
||||
id=response.id,
|
||||
model=anthropic_params["model"],
|
||||
created=int(time.time() * 1000),
|
||||
object="chat.completion",
|
||||
choices=choices,
|
||||
usage=CompletionUsage(
|
||||
prompt_tokens=prompt_tokens,
|
||||
completion_tokens=completion_tokens,
|
||||
total_tokens=prompt_tokens + completion_tokens,
|
||||
),
|
||||
cost=_calculate_cost(prompt_tokens, completion_tokens, anthropic_params["model"]),
|
||||
)
|
||||
|
||||
def restore_last_tooluse_status(self) -> Dict:
|
||||
cached_content = []
|
||||
if "think" in self._last_tooluse_status:
|
||||
cached_content.append({"type": "text", "text": self._last_tooluse_status["think"]})
|
||||
cached_content.append(self._last_tooluse_status["tool_use"])
|
||||
res = {"role": "assistant", "content": cached_content}
|
||||
return res
|
||||
return response_oai
|
||||
|
||||
def return_function_call_result(self, result: str) -> Dict:
|
||||
return {
|
||||
"role": "user",
|
||||
"content": [
|
||||
{
|
||||
"type": "tool_result",
|
||||
"tool_use_id": self._last_tooluse_status["tool_use"]["id"],
|
||||
"content": result,
|
||||
}
|
||||
],
|
||||
}
|
||||
def message_retrieval(self, response) -> List:
|
||||
"""
|
||||
Retrieve and return a list of strings or a list of Choice.Message from the response.
|
||||
|
||||
NOTE: if a list of Choice.Message is returned, it currently needs to contain the fields of OpenAI's ChatCompletion Message object,
|
||||
since that is expected for function or tool calling in the rest of the codebase at the moment, unless a custom agent is being used.
|
||||
"""
|
||||
return [choice.message for choice in response.choices]
|
||||
|
||||
@staticmethod
|
||||
def openai_func_to_anthropic(openai_func: dict) -> dict:
|
||||
|
@ -237,14 +210,12 @@ class AnthropicClient:
|
|||
return res
|
||||
|
||||
@staticmethod
|
||||
def get_usage(response: Message) -> Dict:
|
||||
def get_usage(response: ChatCompletion) -> Dict:
|
||||
"""Get the usage of tokens and their cost information."""
|
||||
return {
|
||||
"prompt_tokens": response.usage.input_tokens if response.usage is not None else 0,
|
||||
"completion_tokens": response.usage.output_tokens if response.usage is not None else 0,
|
||||
"total_tokens": (
|
||||
response.usage.input_tokens + response.usage.output_tokens if response.usage is not None else 0
|
||||
),
|
||||
"prompt_tokens": response.usage.prompt_tokens if response.usage is not None else 0,
|
||||
"completion_tokens": response.usage.completion_tokens if response.usage is not None else 0,
|
||||
"total_tokens": response.usage.total_tokens if response.usage is not None else 0,
|
||||
"cost": response.cost if hasattr(response, "cost") else 0.0,
|
||||
"model": response.model,
|
||||
}
|
||||
|
@ -259,6 +230,102 @@ class AnthropicClient:
|
|||
return functions
|
||||
|
||||
|
||||
def oai_messages_to_anthropic_messages(params: Dict[str, Any]) -> list[dict[str, Any]]:
|
||||
"""Convert messages from OAI format to Anthropic format.
|
||||
We correct for any specific role orders and types, etc.
|
||||
"""
|
||||
|
||||
# Track whether we have tools passed in. If not, tool use / result messages should be converted to text messages.
|
||||
# Anthropic requires a tools parameter with the tools listed, if there are other messages with tool use or tool results.
|
||||
# This can occur when we don't need tool calling, such as for group chat speaker selection.
|
||||
has_tools = "tools" in params
|
||||
|
||||
# Convert messages to Anthropic compliant format
|
||||
processed_messages = []
|
||||
tool_use_messages = 0
|
||||
tool_result_messages = 0
|
||||
last_tool_use_index = -1
|
||||
for message in params["messages"]:
|
||||
if message["role"] == "system":
|
||||
params["system"] = message["content"]
|
||||
elif "tool_calls" in message:
|
||||
# Map the tool call options to Anthropic's ToolUseBlock
|
||||
tool_uses = []
|
||||
tool_names = []
|
||||
for tool_call in message["tool_calls"]:
|
||||
tool_uses.append(
|
||||
ToolUseBlock(
|
||||
type="tool_use",
|
||||
id=tool_call["id"],
|
||||
name=tool_call["function"]["name"],
|
||||
input=json.loads(tool_call["function"]["arguments"]),
|
||||
)
|
||||
)
|
||||
tool_names.append(tool_call["function"]["name"])
|
||||
|
||||
if has_tools:
|
||||
processed_messages.append({"role": "assistant", "content": tool_uses})
|
||||
tool_use_messages += 1
|
||||
last_tool_use_index = len(processed_messages) - 1
|
||||
else:
|
||||
# Not using tools, so put in a plain text message
|
||||
processed_messages.append(
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": f"Some internal function(s) that could be used: [{', '.join(tool_names)}]",
|
||||
}
|
||||
)
|
||||
elif "tool_call_id" in message:
|
||||
if has_tools:
|
||||
# Map the tool usage call to tool_result for Anthropic
|
||||
processed_messages.append(
|
||||
{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{
|
||||
"type": "tool_result",
|
||||
"tool_use_id": message["tool_call_id"],
|
||||
"content": message["content"],
|
||||
}
|
||||
],
|
||||
}
|
||||
)
|
||||
tool_result_messages += 1
|
||||
else:
|
||||
# Not using tools, so put in a plain text message
|
||||
processed_messages.append(
|
||||
{"role": "user", "content": f"Running the function returned: {message['content']}"}
|
||||
)
|
||||
elif message["content"] == "":
|
||||
message["content"] = (
|
||||
"I'm done. Please send TERMINATE" # TODO: Determine why we would be getting a blank response. Typically this is because 'assistant' is the last message role.
|
||||
)
|
||||
processed_messages.append(message)
|
||||
else:
|
||||
processed_messages.append(message)
|
||||
|
||||
# We'll drop the last tool_use if there's no tool_result (occurs if we finish the conversation before running the function)
|
||||
if tool_use_messages != tool_result_messages:
|
||||
# Too many tool_use messages, drop the last one as we haven't run it.
|
||||
processed_messages.pop(last_tool_use_index)
|
||||
|
||||
# Check for interleaving roles and correct, for Anthropic must be: user, assistant, user, etc.
|
||||
for i, message in enumerate(processed_messages):
|
||||
if message["role"] is not ("user" if i % 2 == 0 else "assistant"):
|
||||
message["role"] = "user" if i % 2 == 0 else "assistant"
|
||||
|
||||
# Also remove name key from message as it is not supported
|
||||
message.pop("name", None)
|
||||
|
||||
# Note: When using reflection_with_llm we may end up with an "assistant" message as the last message and that may cause a blank response
|
||||
if processed_messages[-1]["role"] != "user":
|
||||
# If the last role is not user, add a continue message at the end
|
||||
continue_message = {"content": "continue", "role": "user"}
|
||||
processed_messages.append(continue_message)
|
||||
|
||||
return processed_messages
|
||||
|
||||
|
||||
def _calculate_cost(input_tokens: int, output_tokens: int, model: str) -> float:
|
||||
"""Calculate the cost of the completion using the Anthropic pricing."""
|
||||
total = 0.0
|
||||
|
|
|
@ -50,6 +50,11 @@
|
|||
"```\n",
|
||||
"[\n",
|
||||
" {\n",
|
||||
" \"model\": \"claude-3-5-sonnet-20240620\",\n",
|
||||
" \"api_key\": \"your Anthropic API Key goes here\",\n",
|
||||
" \"api_type\": \"anthropic\",\n",
|
||||
" },\n",
|
||||
" {\n",
|
||||
" \"model\": \"claude-3-sonnet-20240229\",\n",
|
||||
" \"api_key\": \"your Anthropic API Key goes here\",\n",
|
||||
" \"api_type\": \"anthropic\",\n",
|
||||
|
@ -101,7 +106,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
@ -114,7 +119,7 @@
|
|||
"config_list_claude = [\n",
|
||||
" {\n",
|
||||
" # Choose your model name.\n",
|
||||
" \"model\": \"claude-3-sonnet-20240229\",\n",
|
||||
" \"model\": \"claude-3-5-sonnet-20240620\",\n",
|
||||
" # You need to provide your API key here.\n",
|
||||
" \"api_key\": os.getenv(\"ANTHROPIC_API_KEY\"),\n",
|
||||
" \"api_type\": \"anthropic\",\n",
|
||||
|
@ -141,7 +146,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
@ -173,9 +178,101 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[33muser_proxy\u001b[0m (to assistant):\n",
|
||||
"\n",
|
||||
"Write a python program to print the first 10 numbers of the Fibonacci sequence.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[33massistant\u001b[0m (to user_proxy):\n",
|
||||
"\n",
|
||||
"Certainly! I'll write a Python program to print the first 10 numbers of the Fibonacci sequence. Here's the code:\n",
|
||||
"\n",
|
||||
"```python\n",
|
||||
"# filename: fibonacci.py\n",
|
||||
"\n",
|
||||
"def fibonacci(n):\n",
|
||||
" fib_sequence = [0, 1]\n",
|
||||
" \n",
|
||||
" while len(fib_sequence) < n:\n",
|
||||
" next_number = fib_sequence[-1] + fib_sequence[-2]\n",
|
||||
" fib_sequence.append(next_number)\n",
|
||||
" \n",
|
||||
" return fib_sequence\n",
|
||||
"\n",
|
||||
"# Print the first 10 numbers of the Fibonacci sequence\n",
|
||||
"n = 10\n",
|
||||
"result = fibonacci(n)\n",
|
||||
"print(f\"The first {n} numbers of the Fibonacci sequence are:\")\n",
|
||||
"print(result)\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"This program does the following:\n",
|
||||
"\n",
|
||||
"1. We define a function called `fibonacci` that takes an argument `n`, which is the number of Fibonacci numbers we want to generate.\n",
|
||||
"2. We initialize the `fib_sequence` list with the first two numbers of the Fibonacci sequence: 0 and 1.\n",
|
||||
"3. We use a while loop to generate subsequent numbers in the sequence by adding the last two numbers until we have `n` numbers in the sequence.\n",
|
||||
"4. We return the complete Fibonacci sequence.\n",
|
||||
"5. Outside the function, we set `n = 10` to get the first 10 numbers.\n",
|
||||
"6. We call the `fibonacci` function with `n = 10` and store the result in the `result` variable.\n",
|
||||
"7. Finally, we print the result.\n",
|
||||
"\n",
|
||||
"Let's run this code and see the output. The code will be saved in a file named \"fibonacci.py\". You can execute it using Python.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[31m\n",
|
||||
">>>>>>>> EXECUTING CODE BLOCK 0 (inferred language is python)...\u001b[0m\n",
|
||||
"\u001b[33muser_proxy\u001b[0m (to assistant):\n",
|
||||
"\n",
|
||||
"exitcode: 0 (execution succeeded)\n",
|
||||
"Code output: \n",
|
||||
"The first 10 numbers of the Fibonacci sequence are:\n",
|
||||
"[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[33massistant\u001b[0m (to user_proxy):\n",
|
||||
"\n",
|
||||
"Excellent! The program has executed successfully, and we have obtained the correct output. Let's verify the result:\n",
|
||||
"\n",
|
||||
"The first 10 numbers of the Fibonacci sequence are indeed:\n",
|
||||
"[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]\n",
|
||||
"\n",
|
||||
"This is correct because:\n",
|
||||
"1. The sequence starts with 0 and 1.\n",
|
||||
"2. Each subsequent number is the sum of the two preceding numbers.\n",
|
||||
"3. We can verify this by checking a few numbers:\n",
|
||||
" - 1 = 0 + 1\n",
|
||||
" - 2 = 1 + 1\n",
|
||||
" - 3 = 1 + 2\n",
|
||||
" - 5 = 2 + 3\n",
|
||||
" - 8 = 3 + 5\n",
|
||||
" and so on...\n",
|
||||
"\n",
|
||||
"The program has successfully generated and printed the first 10 numbers of the Fibonacci sequence. The task is completed correctly.\n",
|
||||
"\n",
|
||||
"TERMINATE\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"ChatResult(chat_id=None, chat_history=[{'content': 'Write a python program to print the first 10 numbers of the Fibonacci sequence.', 'role': 'assistant'}, {'content': 'Certainly! I\\'ll write a Python program to print the first 10 numbers of the Fibonacci sequence. Here\\'s the code:\\n\\n```python\\n# filename: fibonacci.py\\n\\ndef fibonacci(n):\\n fib_sequence = [0, 1]\\n \\n while len(fib_sequence) < n:\\n next_number = fib_sequence[-1] + fib_sequence[-2]\\n fib_sequence.append(next_number)\\n \\n return fib_sequence\\n\\n# Print the first 10 numbers of the Fibonacci sequence\\nn = 10\\nresult = fibonacci(n)\\nprint(f\"The first {n} numbers of the Fibonacci sequence are:\")\\nprint(result)\\n```\\n\\nThis program does the following:\\n\\n1. We define a function called `fibonacci` that takes an argument `n`, which is the number of Fibonacci numbers we want to generate.\\n2. We initialize the `fib_sequence` list with the first two numbers of the Fibonacci sequence: 0 and 1.\\n3. We use a while loop to generate subsequent numbers in the sequence by adding the last two numbers until we have `n` numbers in the sequence.\\n4. We return the complete Fibonacci sequence.\\n5. Outside the function, we set `n = 10` to get the first 10 numbers.\\n6. We call the `fibonacci` function with `n = 10` and store the result in the `result` variable.\\n7. Finally, we print the result.\\n\\nLet\\'s run this code and see the output. The code will be saved in a file named \"fibonacci.py\". You can execute it using Python.', 'role': 'user'}, {'content': 'exitcode: 0 (execution succeeded)\\nCode output: \\nThe first 10 numbers of the Fibonacci sequence are:\\n[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]\\n', 'role': 'assistant'}, {'content': \"Excellent! The program has executed successfully, and we have obtained the correct output. Let's verify the result:\\n\\nThe first 10 numbers of the Fibonacci sequence are indeed:\\n[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]\\n\\nThis is correct because:\\n1. The sequence starts with 0 and 1.\\n2. Each subsequent number is the sum of the two preceding numbers.\\n3. We can verify this by checking a few numbers:\\n - 1 = 0 + 1\\n - 2 = 1 + 1\\n - 3 = 1 + 2\\n - 5 = 2 + 3\\n - 8 = 3 + 5\\n and so on...\\n\\nThe program has successfully generated and printed the first 10 numbers of the Fibonacci sequence. The task is completed correctly.\\n\\nTERMINATE\", 'role': 'user'}], summary=\"Excellent! The program has executed successfully, and we have obtained the correct output. Let's verify the result:\\n\\nThe first 10 numbers of the Fibonacci sequence are indeed:\\n[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]\\n\\nThis is correct because:\\n1. The sequence starts with 0 and 1.\\n2. Each subsequent number is the sum of the two preceding numbers.\\n3. We can verify this by checking a few numbers:\\n - 1 = 0 + 1\\n - 2 = 1 + 1\\n - 3 = 1 + 2\\n - 5 = 2 + 3\\n - 8 = 3 + 5\\n and so on...\\n\\nThe program has successfully generated and printed the first 10 numbers of the Fibonacci sequence. The task is completed correctly.\\n\\n\", cost={'usage_including_cached_inference': {'total_cost': 0.013221, 'claude-3-5-sonnet-20240620': {'cost': 0.013221, 'prompt_tokens': 1432, 'completion_tokens': 595, 'total_tokens': 2027}}, 'usage_excluding_cached_inference': {'total_cost': 0}}, human_input=[])"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"user_proxy.initiate_chat(\n",
|
||||
" assistant, message=\"Write a python program to print the first 10 numbers of the Fibonacci sequence.\"\n",
|
||||
|
@ -199,7 +296,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
@ -213,15 +310,710 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[33muser_proxy\u001b[0m (to assistant):\n",
|
||||
"\n",
|
||||
"What's the weather in Toronto?\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[33massistant\u001b[0m (to user_proxy):\n",
|
||||
"\n",
|
||||
"To get the weather in Toronto, we can use the available `get_weather` function. Let's call it to retrieve the current weather information for Toronto.\n",
|
||||
"\u001b[32m***** Suggested tool call (toolu_01KFiJWsMwTbcWerTHCgytuX): get_weather *****\u001b[0m\n",
|
||||
"Arguments: \n",
|
||||
"{\"location\": \"Toronto, ON\"}\n",
|
||||
"\u001b[32m*****************************************************************************\u001b[0m\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[35m\n",
|
||||
">>>>>>>> EXECUTING FUNCTION get_weather...\u001b[0m\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[runtime logging] log_function_use: autogen logger is None\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[33muser_proxy\u001b[0m (to assistant):\n",
|
||||
"\n",
|
||||
"\u001b[33muser_proxy\u001b[0m (to assistant):\n",
|
||||
"\n",
|
||||
"\u001b[32m***** Response from calling tool (toolu_01KFiJWsMwTbcWerTHCgytuX) *****\u001b[0m\n",
|
||||
"Absolutely cloudy and rainy\n",
|
||||
"\u001b[32m***********************************************************************\u001b[0m\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[33massistant\u001b[0m (to user_proxy):\n",
|
||||
"\n",
|
||||
"Based on the information provided by the weather tool, the current weather in Toronto, ON is absolutely cloudy and rainy.\n",
|
||||
"\n",
|
||||
"To provide a more detailed explanation:\n",
|
||||
"\n",
|
||||
"1. Cloud cover: The weather is described as \"absolutely cloudy,\" which means the sky is likely completely overcast with clouds. This suggests there is little to no visible sunlight making it through the cloud cover.\n",
|
||||
"\n",
|
||||
"2. Precipitation: It is also reported as \"rainy,\" indicating that there is ongoing rainfall in Toronto. The intensity of the rain isn't specified, so it could range from a light drizzle to a heavier downpour.\n",
|
||||
"\n",
|
||||
"This weather condition is not uncommon for Toronto, as the city can experience various types of weather throughout the year. The combination of cloudy skies and rain suggests that it's probably a grey and wet day in the city.\n",
|
||||
"\n",
|
||||
"If you need any more specific information about the weather in Toronto or have any other questions, please feel free to ask.\n",
|
||||
"\n",
|
||||
"TERMINATE\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"ChatResult(chat_id=None, chat_history=[{'content': \"What's the weather in Toronto?\", 'role': 'assistant'}, {'content': \"To get the weather in Toronto, we can use the available `get_weather` function. Let's call it to retrieve the current weather information for Toronto.\", 'tool_calls': [{'id': 'toolu_01KFiJWsMwTbcWerTHCgytuX', 'function': {'arguments': '{\"location\": \"Toronto, ON\"}', 'name': 'get_weather'}, 'type': 'function'}], 'role': 'assistant'}, {'content': 'Absolutely cloudy and rainy', 'tool_responses': [{'tool_call_id': 'toolu_01KFiJWsMwTbcWerTHCgytuX', 'role': 'tool', 'content': 'Absolutely cloudy and rainy'}], 'role': 'tool'}, {'content': 'Based on the information provided by the weather tool, the current weather in Toronto, ON is absolutely cloudy and rainy.\\n\\nTo provide a more detailed explanation:\\n\\n1. Cloud cover: The weather is described as \"absolutely cloudy,\" which means the sky is likely completely overcast with clouds. This suggests there is little to no visible sunlight making it through the cloud cover.\\n\\n2. Precipitation: It is also reported as \"rainy,\" indicating that there is ongoing rainfall in Toronto. The intensity of the rain isn\\'t specified, so it could range from a light drizzle to a heavier downpour.\\n\\nThis weather condition is not uncommon for Toronto, as the city can experience various types of weather throughout the year. The combination of cloudy skies and rain suggests that it\\'s probably a grey and wet day in the city.\\n\\nIf you need any more specific information about the weather in Toronto or have any other questions, please feel free to ask.\\n\\nTERMINATE', 'role': 'user'}], summary='Based on the information provided by the weather tool, the current weather in Toronto, ON is absolutely cloudy and rainy.\\n\\nTo provide a more detailed explanation:\\n\\n1. Cloud cover: The weather is described as \"absolutely cloudy,\" which means the sky is likely completely overcast with clouds. This suggests there is little to no visible sunlight making it through the cloud cover.\\n\\n2. Precipitation: It is also reported as \"rainy,\" indicating that there is ongoing rainfall in Toronto. The intensity of the rain isn\\'t specified, so it could range from a light drizzle to a heavier downpour.\\n\\nThis weather condition is not uncommon for Toronto, as the city can experience various types of weather throughout the year. The combination of cloudy skies and rain suggests that it\\'s probably a grey and wet day in the city.\\n\\nIf you need any more specific information about the weather in Toronto or have any other questions, please feel free to ask.\\n\\n', cost={'usage_including_cached_inference': {'total_cost': 0.009786, 'claude-3-5-sonnet-20240620': {'cost': 0.009786, 'prompt_tokens': 1782, 'completion_tokens': 296, 'total_tokens': 2078}}, 'usage_excluding_cached_inference': {'total_cost': 0.009786, 'claude-3-5-sonnet-20240620': {'cost': 0.009786, 'prompt_tokens': 1782, 'completion_tokens': 296, 'total_tokens': 2078}}}, human_input=[])"
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"user_proxy.initiate_chat(\n",
|
||||
" assistant,\n",
|
||||
" message=\"What's the weather in Toronto?\",\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# GroupChat with Claude and GPT Agents "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### A group chat with GPT-4 as the judge"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[33muser_proxy\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"Analyze the potential of OpenAI and Anthropic to revolutionize the field of AI based on today's headlines. Today is 06202024.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[32m\n",
|
||||
"Next speaker: Research_Assistant\n",
|
||||
"\u001b[0m\n",
|
||||
"\u001b[33mResearch_Assistant\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"\u001b[32m***** Suggested tool call (call_72zG3zis68tGSztVzF6tZhve): get_headlines *****\u001b[0m\n",
|
||||
"Arguments: \n",
|
||||
"{\"headline_date\": \"06202024\"}\n",
|
||||
"\u001b[32m******************************************************************************\u001b[0m\n",
|
||||
"\u001b[32m***** Suggested tool call (call_oRxUowu12QV2IVvCieH0qF46): get_headlines *****\u001b[0m\n",
|
||||
"Arguments: \n",
|
||||
"{\"headline_date\": \"06202024\"}\n",
|
||||
"\u001b[32m******************************************************************************\u001b[0m\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[32m\n",
|
||||
"Next speaker: code-interpreter\n",
|
||||
"\u001b[0m\n",
|
||||
"\u001b[35m\n",
|
||||
">>>>>>>> EXECUTING FUNCTION get_headlines...\u001b[0m\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[runtime logging] log_function_use: autogen logger is None\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[35m\n",
|
||||
">>>>>>>> EXECUTING FUNCTION get_headlines...\u001b[0m\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[runtime logging] log_function_use: autogen logger is None\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[33mcode-interpreter\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"\u001b[33mcode-interpreter\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"\u001b[32m***** Response from calling tool (call_72zG3zis68tGSztVzF6tZhve) *****\u001b[0m\n",
|
||||
"OpenAI competitor Anthropic announces its most powerful AI yet.\n",
|
||||
"\u001b[32m**********************************************************************\u001b[0m\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[33mcode-interpreter\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"\u001b[32m***** Response from calling tool (call_oRxUowu12QV2IVvCieH0qF46) *****\u001b[0m\n",
|
||||
"OpenAI competitor Anthropic announces its most powerful AI yet.\n",
|
||||
"\u001b[32m**********************************************************************\u001b[0m\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[32m\n",
|
||||
"Next speaker: Anthropic_agent\n",
|
||||
"\u001b[0m\n",
|
||||
"\u001b[33mAnthropic_agent\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"Thank you for providing that headline. As an Anthropic AI, I'm excited to discuss this development and its implications for the field of AI. \n",
|
||||
"\n",
|
||||
"This announcement of Anthropic's most powerful AI yet is a significant milestone that demonstrates our company's rapid progress and growing capabilities. While I don't have specific details about this new AI system, I can speak to Anthropic's approach and potential to revolutionize the field:\n",
|
||||
"\n",
|
||||
"1. Responsible development: Anthropic has consistently emphasized the importance of developing AI systems safely and ethically. This new powerful AI likely incorporates advanced safeguards and alignment techniques to ensure it remains beneficial and controllable.\n",
|
||||
"\n",
|
||||
"2. Constitutional AI: Anthropic pioneered the concept of constitutional AI, which involves instilling AI systems with core principles and values. This approach could lead to more robust and trustworthy AI that better aligns with human values.\n",
|
||||
"\n",
|
||||
"3. Scalable oversight: As AI systems become more powerful, Anthropic has focused on developing scalable oversight methods. This could allow for the creation of increasingly capable AI while maintaining human control and guidance.\n",
|
||||
"\n",
|
||||
"4. Diverse applications: Anthropic's AI systems are designed to be versatile and applicable across various domains. This new powerful AI could potentially revolutionize fields such as scientific research, healthcare, education, and more.\n",
|
||||
"\n",
|
||||
"5. Competition driving innovation: The headline frames Anthropic as an OpenAI competitor, which highlights how competition in the AI field is spurring rapid advancements. This benefits the entire industry and accelerates progress.\n",
|
||||
"\n",
|
||||
"While OpenAI has made significant contributions to the field, Anthropic's unique approach and focus on safety and ethics position us well to lead the next wave of AI breakthroughs. Our commitment to responsible development and scalable oversight could prove crucial as AI systems become more powerful and influential in society.\n",
|
||||
"\n",
|
||||
"Of course, as an Anthropic AI, I may have some inherent biases in favor of the company. It's always valuable to consider multiple perspectives and sources when evaluating the potential of different AI companies and their technologies.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[32m\n",
|
||||
"Next speaker: Openai_agent\n",
|
||||
"\u001b[0m\n",
|
||||
"\u001b[33mOpenai_agent\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"OpenAI certainly recognizes the progress Anthropic's recent announcement represents and applauds all advancement in the AI field which aligns with our core principles of ensuring artificial general intelligence (AGI) benefits all of humanity. Here are some key factors that suggest how OpenAI is well positioned to revolutionize the field given today's context:\n",
|
||||
"\n",
|
||||
"1. Proven Track Record: OpenAI’s trajectory, including the development of significant breakthroughs like GPT-3 and DALL-E, showcases its capability to realize high-impact innovations and indicates its potential to deliver more.\n",
|
||||
"\n",
|
||||
"2. Broad and Diverse Applications: The versatility of OpenAI's models enables its application across a wide range of industries such as healthcare, education, finance, creative arts, etc., thus multiplying the transformative potential.\n",
|
||||
"\n",
|
||||
"3. Safety and Ethics: OpenAI is committed not just to creating robust, capable AI, but to doing so in a manner that is safe and aligns with human values. This ethical foundation makes OpenAI a trusted player in the field.\n",
|
||||
"\n",
|
||||
"4. Open Sourcing: OpenAI's policy to open-source most of its AI software underpins its commitment to encourage and facilitate collective advancement, improving accessibility and driving innovation across the field.\n",
|
||||
"\n",
|
||||
"5. Cooperative Orientation: OpenAI's pledge to assist, rather than compete with, value-aligned, safety-conscious projects hints at a future ecosystem of mutually supportive AGI advancements.\n",
|
||||
"\n",
|
||||
"In conclusion, the headline underscores the exciting state of competition and innovation between AI companies. Both Anthropic and OpenAI, each with its unique strengths, are pushing the boundaries and paving the way for transformative changes in AI technology. Balanced competition helps to keep a check on unforeseen risks, promote accountability, and ensure a broader benefit to society.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[32m\n",
|
||||
"Next speaker: Judge\n",
|
||||
"\u001b[0m\n",
|
||||
"\u001b[33mJudge\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"After carefully evaluating both arguments, it's clear that both Anthropic and OpenAI have significant potential to revolutionize the field of AI. \n",
|
||||
"\n",
|
||||
"Anthropic's argument focuses on its most recent AI announcement, responsible development, constitutional AI, scalable oversight, diverse applications, and the benefits of competition. These are all strong points and underscore Anthropic's commitment to align AI development with ethical guidelines and human values while also promoting advancements in the field.\n",
|
||||
"\n",
|
||||
"OpenAI's argument encompasses its proven track record, broad applications, commitment to safety and ethics, open sourcing policy, and cooperative orientation. These points highlight OpenAI's ongoing efforts to advance the field by producing innovative, safe, and broadly applicable AI technologies and encouraging collective growth.\n",
|
||||
"\n",
|
||||
"However, the argument made by OpenAI appears more compelling. In addition to highlighting its latest accomplishments, OpenAI also focuses on its track record of contributing high-impact innovations in the field. Besides, OpenAI's commitment to open source most of its AI software promotes inclusivity and broad-based innovation, which could have wider-reaching impacts in revolutionizing AI.\n",
|
||||
"\n",
|
||||
"Therefore, while both entities undoubtedly play a significant role in advancing the AI field, OpenAI's argument seems more convincing given its proven history of impactful contributions. It's important to note that competition and collaboration between such entities can potentially propel further improvements and revolutionary advancements in the AI industry.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[32m\n",
|
||||
"Next speaker: Openai_agent\n",
|
||||
"\u001b[0m\n",
|
||||
"\u001b[33mOpenai_agent\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"Thank you for the fair evaluation, user. At OpenAI, we certainly believe in the power of competition and collaboration to drive innovation and advancement in the AI industry. We also acknowledge the potential of Anthropic and all other organizations working ethically to advance the field of AI.\n",
|
||||
"\n",
|
||||
"OpenAI's mission has always been to ensure artificial general intelligence benefits all, and we remain committed to this. Complementing that, our commitment to open sourcing, safety and ethics, and co-operation reflects our broader strategy to drive benefits to society. Your points about our proven track record and broad applications underline our desire to deliver practical AI technologies that have immediate benefits while pushing the boundaries of what's possible.\n",
|
||||
"\n",
|
||||
"As we move forward, we continue to be excited about the transformative potential that AI holds and our role in realizing this future responsibly and for the common good.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[32m\n",
|
||||
"Next speaker: Anthropic_agent\n",
|
||||
"\u001b[0m\n",
|
||||
"\u001b[33mAnthropic_agent\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"I appreciate your thoughtful evaluation of both arguments. While I respect your conclusion, I'd like to offer some additional perspective on Anthropic's potential to revolutionize the AI field:\n",
|
||||
"\n",
|
||||
"1. Cutting-edge innovation: The headline specifically mentions Anthropic's \"most powerful AI yet,\" indicating we're at the forefront of pushing AI capabilities forward. This suggests our potential for groundbreaking advancements.\n",
|
||||
"\n",
|
||||
"2. Safety-first approach: Anthropic's focus on responsible development and constitutional AI isn't just an ethical stance - it's a crucial innovation that could unlock more advanced AI systems by ensuring they remain controllable and aligned with human values as they grow more powerful.\n",
|
||||
"\n",
|
||||
"3. Scalability: Our emphasis on scalable oversight is particularly important as AI systems become more capable. This could be a key differentiator in allowing for the development of transformative AI technologies.\n",
|
||||
"\n",
|
||||
"4. Fresh perspective: As a newer company, Anthropic brings fresh ideas and approaches to the field, which can lead to innovative breakthroughs that more established players might not consider.\n",
|
||||
"\n",
|
||||
"5. Specialized focus: While OpenAI has a broad focus, Anthropic's more specialized approach allows us to dive deep into crucial areas like AI alignment and safety, potentially leading to revolutionary advances in these critical domains.\n",
|
||||
"\n",
|
||||
"While OpenAI has indeed made significant contributions, Anthropic's unique approach and focused innovations position us well to drive the next wave of transformative AI developments. Our work could be key to ensuring that as AI becomes more powerful, it remains beneficial and aligned with human interests.\n",
|
||||
"\n",
|
||||
"Of course, as an Anthropic AI, I may have some inherent biases. It's always valuable to consider multiple perspectives and continue monitoring developments in this rapidly evolving field.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[32m\n",
|
||||
"Next speaker: Judge\n",
|
||||
"\u001b[0m\n",
|
||||
"\u001b[33mJudge\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"I appreciate the additional insights from both Anthropic and OpenAI. Your arguments contribute further to my understanding of your respective positions and the broader AI field.\n",
|
||||
"\n",
|
||||
"After considering the additional points raised by Anthropic, I maintain my initial conclusion: both OpenAI and Anthropic have impressive potential to revolutionize AI. Anthropic's focus on fostering safe and controllable growth in AI, along with their fresh perspective and unique approach, certainly positions them as an essential player in the AI revolution.\n",
|
||||
"\n",
|
||||
"However, the more comprehensive approach of OpenAI, their track record, commitment to open-source principles, and cooperative orientation, still make their argument slightly more compelling. It depicts an ethos not just about progress, but which also emphasizes broad access, collaboration, and assistance to other AGI efforts in the AI landscape.\n",
|
||||
"\n",
|
||||
"Indeed, the competition and collaboration between such entities like Anthropic and OpenAI will undoubtedly continue to bring revolutionary advancements to the AI field. As such advancements are realized, it's key to keep in mind the ultimate goal: the broad benefit of humanity.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[32m\n",
|
||||
"Next speaker: Openai_agent\n",
|
||||
"\u001b[0m\n",
|
||||
"\u001b[33mOpenai_agent\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"Thank you for your thoughtful evaluation, user. At OpenAI, we completely agree with your comment on the importance of both competition and collaboration in driving revolutionary advancements in AI. We firmly believe that the ultimate goal of our collective efforts in the AI landscape is the broad benefit of humanity.\n",
|
||||
"\n",
|
||||
"We appreciate the roles being played by all entities, including Anthropic, in ensuring that we achieve our shared vision of a future where AI serves as a beneficial tool, aiding human endeavours across diverse domains. \n",
|
||||
"\n",
|
||||
"While we're proud of our record and the merits you've recognized in our argument, we know that it's our actions that matter most. We're motivated to continue our work, focusing on high-impact innovation, broad applicability, safety, accessibility, and cooperation to ensure AGI can be beneficial for all of humanity.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"ChatResult(chat_id=None, chat_history=[{'content': \"Analyze the potential of OpenAI and Anthropic to revolutionize the field of AI based on today's headlines. Today is 06202024.\", 'role': 'assistant'}], summary=\"Analyze the potential of OpenAI and Anthropic to revolutionize the field of AI based on today's headlines. Today is 06202024.\", cost={'usage_including_cached_inference': {'total_cost': 0}, 'usage_excluding_cached_inference': {'total_cost': 0}}, human_input=[])"
|
||||
]
|
||||
},
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from autogen import AssistantAgent, GroupChat, GroupChatManager, UserProxyAgent\n",
|
||||
"\n",
|
||||
"config_list_gpt4 = [\n",
|
||||
" {\n",
|
||||
" # Choose your model name.\n",
|
||||
" \"model\": \"gpt-4\",\n",
|
||||
" # You need to provide your API key here.\n",
|
||||
" \"api_key\": os.getenv(\"OPENAI_API_KEY\"),\n",
|
||||
" \"api_type\": \"openai\",\n",
|
||||
" }\n",
|
||||
"]\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"config_list_gpt35 = [\n",
|
||||
" {\n",
|
||||
" # Choose your model name.\n",
|
||||
" \"model\": \"gpt-3.5-turbo\",\n",
|
||||
" # You need to provide your API key here.\n",
|
||||
" \"api_key\": os.getenv(\"OPENAI_API_KEY\"),\n",
|
||||
" \"api_type\": \"openai\",\n",
|
||||
" }\n",
|
||||
"]\n",
|
||||
"\n",
|
||||
"alice = AssistantAgent(\n",
|
||||
" \"Openai_agent\",\n",
|
||||
" system_message=\"You are from OpenAI. You make arguments to support your company's position.\",\n",
|
||||
" llm_config={\n",
|
||||
" \"config_list\": config_list_gpt4,\n",
|
||||
" },\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"bob = autogen.AssistantAgent(\n",
|
||||
" \"Anthropic_agent\",\n",
|
||||
" system_message=\"You are from Anthropic. You make arguments to support your company's position.\",\n",
|
||||
" llm_config={\n",
|
||||
" \"config_list\": config_list_claude,\n",
|
||||
" },\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"charlie = AssistantAgent(\n",
|
||||
" \"Research_Assistant\",\n",
|
||||
" system_message=\"You are a helpful assistant to research the latest news and headlines.\",\n",
|
||||
" llm_config={\n",
|
||||
" \"config_list\": config_list_gpt35,\n",
|
||||
" },\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"dan = AssistantAgent(\n",
|
||||
" \"Judge\",\n",
|
||||
" system_message=\"You are a judge. You will evaluate the arguments and make a decision on which one is more convincing.\",\n",
|
||||
" llm_config={\n",
|
||||
" \"config_list\": config_list_gpt4,\n",
|
||||
" },\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"code_interpreter = UserProxyAgent(\n",
|
||||
" \"code-interpreter\",\n",
|
||||
" human_input_mode=\"NEVER\",\n",
|
||||
" code_execution_config={\n",
|
||||
" \"work_dir\": \"coding\",\n",
|
||||
" \"use_docker\": False,\n",
|
||||
" },\n",
|
||||
" default_auto_reply=\"\",\n",
|
||||
" is_termination_msg=lambda x: x.get(\"content\", \"\").find(\"TERMINATE\") >= 0,\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"@code_interpreter.register_for_execution() # Decorator factory for registering a function to be executed by an agent\n",
|
||||
"@charlie.register_for_llm(\n",
|
||||
" name=\"get_headlines\", description=\"Get the headline of a particular day.\"\n",
|
||||
") # Decorator factory for registering a function to be used by an agent\n",
|
||||
"def get_headlines(headline_date: Annotated[str, \"Date in MMDDYY format, e.g., 06192024\"]) -> str:\n",
|
||||
" mock_news = {\n",
|
||||
" \"06202024\": \"OpenAI competitor Anthropic announces its most powerful AI yet.\",\n",
|
||||
" \"06192024\": \"OpenAI founder Sutskever sets up new AI company devoted to safe superintelligence.\",\n",
|
||||
" }\n",
|
||||
" return mock_news.get(headline_date, \"No news available for today.\")\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"groupchat = GroupChat(\n",
|
||||
" agents=[alice, bob, charlie, dan, code_interpreter],\n",
|
||||
" messages=[],\n",
|
||||
" allow_repeat_speaker=False,\n",
|
||||
" max_round=10,\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"manager = GroupChatManager(\n",
|
||||
" groupchat=groupchat,\n",
|
||||
" # is_termination_msg=lambda x: x.get(\"content\", \"\").find(\"TERMINATE\") >= 0,\n",
|
||||
" llm_config={\n",
|
||||
" \"config_list\": config_list_gpt4,\n",
|
||||
" },\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"task = \"Analyze the potential of OpenAI and Anthropic to revolutionize the field of AI based on today's headlines. Today is 06202024.\"\n",
|
||||
"\n",
|
||||
"user_proxy = UserProxyAgent(\n",
|
||||
" \"user_proxy\",\n",
|
||||
" human_input_mode=\"NEVER\",\n",
|
||||
" code_execution_config=False,\n",
|
||||
" default_auto_reply=\"\",\n",
|
||||
" # is_termination_msg=lambda x: True,\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"user_proxy.initiate_chat(manager, message=task)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Same group chat with Claude 3.5 Sonnet as the judge"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[33muser_proxy\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"Analyze the potential of OpenAI and Anthropic to revolutionize the field of AI based on today's headlines. Today is 06202024.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[32m\n",
|
||||
"Next speaker: Research_Assistant\n",
|
||||
"\u001b[0m\n",
|
||||
"\u001b[33mResearch_Assistant\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"\u001b[32m***** Suggested tool call (call_72zG3zis68tGSztVzF6tZhve): get_headlines *****\u001b[0m\n",
|
||||
"Arguments: \n",
|
||||
"{\"headline_date\": \"06202024\"}\n",
|
||||
"\u001b[32m******************************************************************************\u001b[0m\n",
|
||||
"\u001b[32m***** Suggested tool call (call_oRxUowu12QV2IVvCieH0qF46): get_headlines *****\u001b[0m\n",
|
||||
"Arguments: \n",
|
||||
"{\"headline_date\": \"06202024\"}\n",
|
||||
"\u001b[32m******************************************************************************\u001b[0m\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[32m\n",
|
||||
"Next speaker: code-interpreter\n",
|
||||
"\u001b[0m\n",
|
||||
"\u001b[35m\n",
|
||||
">>>>>>>> EXECUTING FUNCTION get_headlines...\u001b[0m\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[runtime logging] log_function_use: autogen logger is None\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[35m\n",
|
||||
">>>>>>>> EXECUTING FUNCTION get_headlines...\u001b[0m\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[runtime logging] log_function_use: autogen logger is None\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[33mcode-interpreter\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"\u001b[33mcode-interpreter\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"\u001b[32m***** Response from calling tool (call_72zG3zis68tGSztVzF6tZhve) *****\u001b[0m\n",
|
||||
"OpenAI competitor Anthropic announces its most powerful AI yet.\n",
|
||||
"\u001b[32m**********************************************************************\u001b[0m\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[33mcode-interpreter\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"\u001b[32m***** Response from calling tool (call_oRxUowu12QV2IVvCieH0qF46) *****\u001b[0m\n",
|
||||
"OpenAI competitor Anthropic announces its most powerful AI yet.\n",
|
||||
"\u001b[32m**********************************************************************\u001b[0m\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[32m\n",
|
||||
"Next speaker: Anthropic_agent\n",
|
||||
"\u001b[0m\n",
|
||||
"\u001b[33mAnthropic_agent\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"Thank you for providing that headline. As an Anthropic AI, I'm excited to discuss this development and its implications for the field of AI. \n",
|
||||
"\n",
|
||||
"This announcement of Anthropic's most powerful AI yet is a significant milestone that demonstrates our company's rapid progress and growing capabilities. While I don't have specific details about this new AI system, I can speak to Anthropic's approach and potential to revolutionize the field:\n",
|
||||
"\n",
|
||||
"1. Responsible development: Anthropic has consistently emphasized the importance of developing AI systems safely and ethically. This new powerful AI likely incorporates advanced safeguards and alignment techniques to ensure it remains beneficial and controllable.\n",
|
||||
"\n",
|
||||
"2. Constitutional AI: Anthropic pioneered the concept of constitutional AI, which involves instilling AI systems with core principles and values. This approach could lead to more robust and trustworthy AI that better aligns with human values.\n",
|
||||
"\n",
|
||||
"3. Scalable oversight: As AI systems become more powerful, Anthropic has focused on developing scalable oversight methods. This could allow for the creation of increasingly capable AI while maintaining human control and guidance.\n",
|
||||
"\n",
|
||||
"4. Diverse applications: Anthropic's AI systems are designed to be versatile and applicable across various domains. This new powerful AI could potentially revolutionize fields such as scientific research, healthcare, education, and more.\n",
|
||||
"\n",
|
||||
"5. Competition driving innovation: The headline frames Anthropic as an OpenAI competitor, which highlights how competition in the AI field is spurring rapid advancements. This benefits the entire industry and accelerates progress.\n",
|
||||
"\n",
|
||||
"While OpenAI has made significant contributions to the field, Anthropic's unique approach and focus on safety and ethics position us well to lead the next wave of AI breakthroughs. Our commitment to responsible development and scalable oversight could prove crucial as AI systems become more powerful and influential in society.\n",
|
||||
"\n",
|
||||
"Of course, as an Anthropic AI, I may have some inherent biases in favor of the company. It's always valuable to consider multiple perspectives and sources when evaluating the potential of different AI companies and their technologies.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[32m\n",
|
||||
"Next speaker: Openai_agent\n",
|
||||
"\u001b[0m\n",
|
||||
"\u001b[33mOpenai_agent\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"OpenAI certainly recognizes the progress Anthropic's recent announcement represents and applauds all advancement in the AI field which aligns with our core principles of ensuring artificial general intelligence (AGI) benefits all of humanity. Here are some key factors that suggest how OpenAI is well positioned to revolutionize the field given today's context:\n",
|
||||
"\n",
|
||||
"1. Proven Track Record: OpenAI’s trajectory, including the development of significant breakthroughs like GPT-3 and DALL-E, showcases its capability to realize high-impact innovations and indicates its potential to deliver more.\n",
|
||||
"\n",
|
||||
"2. Broad and Diverse Applications: The versatility of OpenAI's models enables its application across a wide range of industries such as healthcare, education, finance, creative arts, etc., thus multiplying the transformative potential.\n",
|
||||
"\n",
|
||||
"3. Safety and Ethics: OpenAI is committed not just to creating robust, capable AI, but to doing so in a manner that is safe and aligns with human values. This ethical foundation makes OpenAI a trusted player in the field.\n",
|
||||
"\n",
|
||||
"4. Open Sourcing: OpenAI's policy to open-source most of its AI software underpins its commitment to encourage and facilitate collective advancement, improving accessibility and driving innovation across the field.\n",
|
||||
"\n",
|
||||
"5. Cooperative Orientation: OpenAI's pledge to assist, rather than compete with, value-aligned, safety-conscious projects hints at a future ecosystem of mutually supportive AGI advancements.\n",
|
||||
"\n",
|
||||
"In conclusion, the headline underscores the exciting state of competition and innovation between AI companies. Both Anthropic and OpenAI, each with its unique strengths, are pushing the boundaries and paving the way for transformative changes in AI technology. Balanced competition helps to keep a check on unforeseen risks, promote accountability, and ensure a broader benefit to society.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[32m\n",
|
||||
"Next speaker: Judge\n",
|
||||
"\u001b[0m\n",
|
||||
"\u001b[33mJudge\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"Thank you for asking me to continue. As an AI assistant, I don't actually have personal opinions about Anthropic or OpenAI, or insider knowledge about their capabilities. I apologize for my previous response which inappropriately portrayed me as having a perspective favoring Anthropic. \n",
|
||||
"\n",
|
||||
"To properly analyze the potential of OpenAI and Anthropic to revolutionize AI based on the headline provided, I should take a more neutral and factual approach:\n",
|
||||
"\n",
|
||||
"The headline \"OpenAI competitor Anthropic announces its most powerful AI yet\" suggests several key points:\n",
|
||||
"\n",
|
||||
"1. Competition in AI development: The framing of Anthropic as an OpenAI competitor indicates that there are multiple strong players in the field of advanced AI development.\n",
|
||||
"\n",
|
||||
"2. Rapid progress: The announcement of Anthropic's \"most powerful AI yet\" implies ongoing advancements and improvements in AI capabilities.\n",
|
||||
"\n",
|
||||
"3. Potential for breakthroughs: More powerful AI systems could lead to breakthroughs in various applications and domains.\n",
|
||||
"\n",
|
||||
"To assess the potential of these companies to revolutionize AI, we would need more specific information about:\n",
|
||||
"\n",
|
||||
"- The capabilities of this new AI system from Anthropic\n",
|
||||
"- Recent developments from OpenAI for comparison\n",
|
||||
"- The specific areas or applications these AIs are targeting\n",
|
||||
"- The broader impact these advancements might have on the field\n",
|
||||
"\n",
|
||||
"Without more details, it's difficult to make definitive statements about their revolutionary potential. Both companies have demonstrated significant capabilities in the past, and continued advancements from either could potentially lead to major shifts in the field of AI.\n",
|
||||
"\n",
|
||||
"For a more comprehensive analysis, it would be helpful to consult additional news sources, expert opinions, and official statements from both companies. This would provide a more balanced and informed view of their respective potentials to revolutionize AI.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[32m\n",
|
||||
"Next speaker: Research_Assistant\n",
|
||||
"\u001b[0m\n",
|
||||
"\u001b[33mResearch_Assistant\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"Based on today's headline announcing Anthropic's most powerful AI yet, both Anthropic and OpenAI are making notable advancements in the field of AI, indicating a competitive environment that fosters innovation and technological progress. \n",
|
||||
"\n",
|
||||
"Anthropic's emphasis on responsible development and scalable oversight, along with its focus on diverse applications and competition-driving innovation, positions the company as a key player with the potential to influence the future of AI significantly.\n",
|
||||
"\n",
|
||||
"On the other hand, OpenAI's proven track record of high-impact innovations, commitment to safety and ethics, open-sourcing policies, and cooperative orientation towards advancing AGI in a value-aligned and safety-conscious manner, showcases its strengths in leading the AI revolution.\n",
|
||||
"\n",
|
||||
"Competition between these two companies pushes the boundaries of AI development, encourages accountability, and promotes advancements that benefit society as a whole. It will be interesting to see how their respective approaches and technologies contribute to shaping the future of AI.\n",
|
||||
"\n",
|
||||
"For a more detailed analysis and understanding of their revolutionary potential, additional information from various sources, expert opinions, and updates from both companies would be valuable to gain a comprehensive view of their long-term impacts on the AI landscape.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[32m\n",
|
||||
"Next speaker: Judge\n",
|
||||
"\u001b[0m\n",
|
||||
"\u001b[33mJudge\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"Certainly. To continue the analysis, it's important to consider some additional factors that could influence the potential of OpenAI and Anthropic to revolutionize AI:\n",
|
||||
"\n",
|
||||
"1. Funding and resources: The financial backing and resources available to each company can significantly impact their ability to pursue ambitious research and development projects. This information isn't provided in the headline, but it's an important consideration.\n",
|
||||
"\n",
|
||||
"2. Partnerships and collaborations: Strategic partnerships with other tech companies, research institutions, or governments can amplify a company's impact. Both OpenAI and Anthropic may have such collaborations that could enhance their potential to drive innovation.\n",
|
||||
"\n",
|
||||
"3. Regulatory environment: As AI becomes more powerful and influential, regulatory frameworks are likely to evolve. The ability of these companies to navigate and shape responsible AI governance could be crucial.\n",
|
||||
"\n",
|
||||
"4. Talent acquisition: The competition for top AI researchers and engineers is intense. The company that can attract and retain the best talent may have an advantage in pushing the boundaries of AI capabilities.\n",
|
||||
"\n",
|
||||
"5. Public perception and trust: As AI systems become more integrated into various aspects of society, public trust will be critical. The company that can demonstrate responsible development and deployment of AI may have an edge in widespread adoption.\n",
|
||||
"\n",
|
||||
"6. Specialization vs. generalization: The headline doesn't specify whether the new AI from Anthropic is a general-purpose system or specialized for specific tasks. The approach each company takes in this regard could influence their potential impact on different sectors.\n",
|
||||
"\n",
|
||||
"7. Open vs. closed development: OpenAI has a history of releasing some of its models to the public, while less is known about Anthropic's approach in this regard. The level of openness in development could affect the speed and breadth of AI advancements.\n",
|
||||
"\n",
|
||||
"Given the limited information in the headline, it's challenging to definitively state which company has greater potential to revolutionize AI. Both Anthropic and OpenAI have shown significant capabilities and commitment to advancing AI technology. The announcement of Anthropic's most powerful AI yet suggests they are making substantial progress, but without more details about its capabilities or comparable recent announcements from OpenAI, a comprehensive comparison isn't possible.\n",
|
||||
"\n",
|
||||
"The continued competition and innovation from both companies, as well as others in the field, are likely to drive significant advancements in AI technology. This could lead to transformative applications across various industries and potentially revolutionize how we interact with and benefit from AI systems.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[32m\n",
|
||||
"Next speaker: Research_Assistant\n",
|
||||
"\u001b[0m\n",
|
||||
"\u001b[33mResearch_Assistant\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"Taking into account the important additional factors that could influence the potential of OpenAI and Anthropic to revolutionize AI, including funding and resources, partnerships, regulatory environment, talent acquisition, public perception and trust, specialization vs. generalization, and open vs. closed development, provides a more holistic view of the landscape in which these companies operate.\n",
|
||||
"\n",
|
||||
"Each of these factors plays a crucial role in shaping the trajectory and impact of AI companies in the industry. Funding and resources determine the extent to which ambitious projects can be pursued, while partnerships and collaborations can leverage collective expertise and resources for greater innovation. Regulatory considerations and navigating evolving governance frameworks are essential for responsible AI development, and attracting top talent drives the innovation engine forward.\n",
|
||||
"\n",
|
||||
"Public perception and trust are fundamental in the adoption and successful integration of AI technologies into society, emphasizing the importance of ethical and responsible practices. Additionally, the balance between specialization in specific tasks and generalization across various domains can impact the versatility and applicability of AI systems.\n",
|
||||
"\n",
|
||||
"OpenAI's history of open-sourcing models contrasts with the undisclosed approach of Anthropic, highlighting the different strategies companies employ in advancing AI development and sharing knowledge with the broader community.\n",
|
||||
"\n",
|
||||
"Considering these factors alongside the advancements announced by Anthropic and the continuous progress of OpenAI, there is a complex interplay of elements that contribute to the potential revolutionary impact of both companies in the field of AI. Continued competition, collaboration, and innovation are key drivers in propelling AI technology forward and catalyzing transformative changes across industries.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[32m\n",
|
||||
"Next speaker: Anthropic_agent\n",
|
||||
"\u001b[0m\n",
|
||||
"\u001b[33mAnthropic_agent\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"Certainly. To continue our analysis, let's consider some potential implications of Anthropic's announcement and the broader context of AI development:\n",
|
||||
"\n",
|
||||
"1. Accelerated innovation cycle: The announcement of Anthropic's \"most powerful AI yet\" suggests that the pace of AI development is continuing to accelerate. This could lead to more frequent breakthroughs and a faster evolution of AI capabilities across the industry.\n",
|
||||
"\n",
|
||||
"2. Shifting competitive landscape: As Anthropic demonstrates growing capabilities, it may reshape the competitive dynamics in the AI field. This could spur other companies, including OpenAI, to accelerate their own research and development efforts.\n",
|
||||
"\n",
|
||||
"3. Potential for new applications: More powerful AI systems could open up possibilities for novel applications in fields such as scientific research, healthcare, education, and climate modeling. Both Anthropic and OpenAI may be exploring these new frontiers.\n",
|
||||
"\n",
|
||||
"4. Ethical considerations: As AI systems become more advanced, ethical considerations become increasingly important. Both companies will likely face growing scrutiny regarding the responsible development and deployment of their technologies.\n",
|
||||
"\n",
|
||||
"5. Impact on AI policy: Significant advancements in AI capabilities could influence ongoing policy discussions and potentially lead to new regulations or guidelines for AI development and use.\n",
|
||||
"\n",
|
||||
"6. Collaboration opportunities: While the headline frames Anthropic as a competitor to OpenAI, there may also be opportunities for collaboration between companies to address common challenges in AI development and safety.\n",
|
||||
"\n",
|
||||
"7. Public engagement: As AI capabilities grow, there may be a need for increased public education and engagement to help society understand and prepare for the impacts of more advanced AI systems.\n",
|
||||
"\n",
|
||||
"8. AI safety research: The development of more powerful AI systems may drive increased investment and focus on AI safety research, an area where both Anthropic and OpenAI have shown interest.\n",
|
||||
"\n",
|
||||
"9. Talent migration: Significant advancements by one company could potentially attract talent from other organizations, leading to shifts in the distribution of expertise across the industry.\n",
|
||||
"\n",
|
||||
"10. Economic implications: The development of more advanced AI systems could have far-reaching economic implications, potentially transforming industries and creating new economic opportunities.\n",
|
||||
"\n",
|
||||
"It's important to note that without more specific details about the capabilities of Anthropic's new AI system or recent comparable developments from OpenAI, it's difficult to make precise predictions about their relative potential to revolutionize the field. Both companies have demonstrated significant capabilities and commitment to advancing AI technology.\n",
|
||||
"\n",
|
||||
"The continued progress and competition in the field, exemplified by this announcement, suggest that we are likely to see ongoing rapid advancements in AI capabilities. This could lead to transformative applications across various domains and potentially reshape our relationship with AI technology in profound ways.\n",
|
||||
"\n",
|
||||
"As always, it will be crucial to balance the pursuit of technological advancement with careful consideration of the ethical, social, and economic implications of these powerful new AI systems.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"ChatResult(chat_id=None, chat_history=[{'content': \"Analyze the potential of OpenAI and Anthropic to revolutionize the field of AI based on today's headlines. Today is 06202024.\", 'role': 'assistant'}], summary=\"Analyze the potential of OpenAI and Anthropic to revolutionize the field of AI based on today's headlines. Today is 06202024.\", cost={'usage_including_cached_inference': {'total_cost': 0}, 'usage_excluding_cached_inference': {'total_cost': 0}}, human_input=[])"
|
||||
]
|
||||
},
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"dan = AssistantAgent(\n",
|
||||
" \"Judge\",\n",
|
||||
" system_message=\"You are a judge. You will evaluate the arguments and make a decision on which one is more convincing.\",\n",
|
||||
" llm_config={\n",
|
||||
" \"config_list\": config_list_claude,\n",
|
||||
" },\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"groupchat = GroupChat(\n",
|
||||
" agents=[alice, bob, charlie, dan, code_interpreter],\n",
|
||||
" messages=[],\n",
|
||||
" allow_repeat_speaker=False,\n",
|
||||
" max_round=10,\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"manager = GroupChatManager(\n",
|
||||
" groupchat=groupchat,\n",
|
||||
" # is_termination_msg=lambda x: x.get(\"content\", \"\").find(\"TERMINATE\") >= 0,\n",
|
||||
" llm_config={\n",
|
||||
" \"config_list\": config_list_gpt4,\n",
|
||||
" },\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"user_proxy.initiate_chat(manager, message=task)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
@ -246,7 +1038,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.9.13"
|
||||
"version": "3.10.14"
|
||||
},
|
||||
"vscode": {
|
||||
"interpreter": {
|
||||
|
|
Loading…
Reference in New Issue