| Author | SHA1 | Message | Date |
|---|---|---|---|
|
|
13ce8bc9aa | add isort to pre-commit | 2 years ago |
|
|
939c9a68a5 | Sort import with isort | 2 years ago |
| @@ -22,12 +22,17 @@ repos: | |||||
| - id: trailing-whitespace | - id: trailing-whitespace | ||||
| - id: end-of-file-fixer | - id: end-of-file-fixer | ||||
| - id: no-commit-to-branch | - id: no-commit-to-branch | ||||
| - repo: https://github.com/pycqa/isort | |||||
| rev: 5.13.2 | |||||
| hooks: | |||||
| - id: isort | |||||
| name: isort (python) | |||||
| - repo: https://github.com/psf/black | - repo: https://github.com/psf/black | ||||
| rev: 24.3.0 | rev: 24.3.0 | ||||
| hooks: | hooks: | ||||
| - id: black | - id: black | ||||
| - repo: https://github.com/charliermarsh/ruff-pre-commit | - repo: https://github.com/charliermarsh/ruff-pre-commit | ||||
| rev: v0.3.3 | |||||
| rev: v0.3.4 | |||||
| hooks: | hooks: | ||||
| - id: ruff | - id: ruff | ||||
| args: ["--fix"] | args: ["--fix"] | ||||
| @@ -1,10 +1,10 @@ | |||||
| import logging | import logging | ||||
| from .version import __version__ | |||||
| from .oai import * | |||||
| from .agentchat import * | from .agentchat import * | ||||
| from .exception_utils import * | |||||
| from .code_utils import DEFAULT_MODEL, FAST_MODEL | from .code_utils import DEFAULT_MODEL, FAST_MODEL | ||||
| from .exception_utils import * | |||||
| from .oai import * | |||||
| from .version import __version__ | |||||
| # Set the root logger. | # Set the root logger. | ||||
| logger = logging.getLogger(__name__) | logger = logging.getLogger(__name__) | ||||
| @@ -1,9 +1,9 @@ | |||||
| from .agent import Agent | from .agent import Agent | ||||
| from .assistant_agent import AssistantAgent | from .assistant_agent import AssistantAgent | ||||
| from .chat import ChatResult, initiate_chats | |||||
| from .conversable_agent import ConversableAgent, register_function | from .conversable_agent import ConversableAgent, register_function | ||||
| from .groupchat import GroupChat, GroupChatManager | from .groupchat import GroupChat, GroupChatManager | ||||
| from .user_proxy_agent import UserProxyAgent | from .user_proxy_agent import UserProxyAgent | ||||
| from .chat import initiate_chats, ChatResult | |||||
| from .utils import gather_usage_summary | from .utils import gather_usage_summary | ||||
| __all__ = ( | __all__ = ( | ||||
| @@ -1,7 +1,8 @@ | |||||
| from typing import Callable, Dict, Literal, Optional, Union | from typing import Callable, Dict, Literal, Optional, Union | ||||
| from autogen.runtime_logging import log_new_agent, logging_enabled | |||||
| from .conversable_agent import ConversableAgent | from .conversable_agent import ConversableAgent | ||||
| from autogen.runtime_logging import logging_enabled, log_new_agent | |||||
| class AssistantAgent(ConversableAgent): | class AssistantAgent(ConversableAgent): | ||||
| @@ -1,14 +1,14 @@ | |||||
| import asyncio | import asyncio | ||||
| from functools import partial | |||||
| import logging | |||||
| from collections import defaultdict, abc | |||||
| from typing import Dict, List, Any, Set, Tuple | |||||
| from dataclasses import dataclass | |||||
| from .utils import consolidate_chat_info | |||||
| import datetime | import datetime | ||||
| import logging | |||||
| import warnings | import warnings | ||||
| from ..formatting_utils import colored | |||||
| from collections import abc, defaultdict | |||||
| from dataclasses import dataclass | |||||
| from functools import partial | |||||
| from typing import Any, Dict, List, Set, Tuple | |||||
| from ..formatting_utils import colored | |||||
| from .utils import consolidate_chat_info | |||||
| logger = logging.getLogger(__name__) | logger = logging.getLogger(__name__) | ||||
| Prerequisite = Tuple[int, int] | Prerequisite = Tuple[int, int] | ||||
| @@ -1,10 +1,11 @@ | |||||
| import autogen | |||||
| import time | |||||
| import subprocess as sp | |||||
| import socket | |||||
| import json | |||||
| import hashlib | import hashlib | ||||
| from typing import Optional, List, Dict, Tuple | |||||
| import json | |||||
| import socket | |||||
| import subprocess as sp | |||||
| import time | |||||
| from typing import Dict, List, Optional, Tuple | |||||
| import autogen | |||||
| def _config_check(config: Dict): | def _config_check(config: Dict): | ||||
| @@ -1,9 +1,10 @@ | |||||
| import sys | import sys | ||||
| from termcolor import colored | |||||
| from typing import Dict, Optional, List | |||||
| from autogen import ConversableAgent | |||||
| from autogen import token_count_utils | |||||
| from typing import Dict, List, Optional | |||||
| import tiktoken | import tiktoken | ||||
| from termcolor import colored | |||||
| from autogen import ConversableAgent, token_count_utils | |||||
| class TransformChatHistory: | class TransformChatHistory: | ||||
| @@ -5,10 +5,10 @@ from openai import OpenAI | |||||
| from PIL.Image import Image | from PIL.Image import Image | ||||
| from autogen import Agent, ConversableAgent, code_utils | from autogen import Agent, ConversableAgent, code_utils | ||||
| from autogen.cache import Cache | |||||
| from autogen.agentchat.contrib import img_utils | from autogen.agentchat.contrib import img_utils | ||||
| from autogen.agentchat.contrib.capabilities.agent_capability import AgentCapability | from autogen.agentchat.contrib.capabilities.agent_capability import AgentCapability | ||||
| from autogen.agentchat.contrib.text_analyzer_agent import TextAnalyzerAgent | from autogen.agentchat.contrib.text_analyzer_agent import TextAnalyzerAgent | ||||
| from autogen.cache import Cache | |||||
| SYSTEM_MESSAGE = "You've been given the special ability to generate images." | SYSTEM_MESSAGE = "You've been given the special ability to generate images." | ||||
| DESCRIPTION_MESSAGE = "This agent has the ability to generate images." | DESCRIPTION_MESSAGE = "This agent has the ability to generate images." | ||||
| @@ -1,11 +1,14 @@ | |||||
| import os | import os | ||||
| import pickle | |||||
| from typing import Dict, Optional, Union | from typing import Dict, Optional, Union | ||||
| import chromadb | import chromadb | ||||
| from chromadb.config import Settings | from chromadb.config import Settings | ||||
| import pickle | |||||
| from autogen.agentchat.assistant_agent import ConversableAgent | from autogen.agentchat.assistant_agent import ConversableAgent | ||||
| from autogen.agentchat.contrib.capabilities.agent_capability import AgentCapability | from autogen.agentchat.contrib.capabilities.agent_capability import AgentCapability | ||||
| from autogen.agentchat.contrib.text_analyzer_agent import TextAnalyzerAgent | from autogen.agentchat.contrib.text_analyzer_agent import TextAnalyzerAgent | ||||
| from ....formatting_utils import colored | from ....formatting_utils import colored | ||||
| @@ -1,10 +1,10 @@ | |||||
| from typing import Callable, Dict, Optional, Union, Tuple, List, Any | |||||
| from autogen import OpenAIWrapper | |||||
| from autogen import Agent, ConversableAgent | |||||
| import copy | |||||
| import asyncio | import asyncio | ||||
| import logging | |||||
| import copy | |||||
| import inspect | import inspect | ||||
| import logging | |||||
| from typing import Any, Callable, Dict, List, Optional, Tuple, Union | |||||
| from autogen import Agent, ConversableAgent, OpenAIWrapper | |||||
| from autogen.token_count_utils import count_token, get_max_token_limit, num_tokens_from_functions | from autogen.token_count_utils import count_token, get_max_token_limit, num_tokens_from_functions | ||||
| from ...formatting_utils import colored | from ...formatting_utils import colored | ||||
| @@ -1,16 +1,16 @@ | |||||
| from collections import defaultdict | |||||
| import openai | |||||
| import copy | |||||
| import json | import json | ||||
| import time | |||||
| import logging | import logging | ||||
| import copy | |||||
| import time | |||||
| from collections import defaultdict | |||||
| from typing import Any, Dict, List, Optional, Tuple, Union | |||||
| import openai | |||||
| from autogen import OpenAIWrapper | from autogen import OpenAIWrapper | ||||
| from autogen.oai.openai_utils import retrieve_assistants_by_name | |||||
| from autogen.agentchat.agent import Agent | from autogen.agentchat.agent import Agent | ||||
| from autogen.agentchat.assistant_agent import ConversableAgent | |||||
| from autogen.agentchat.assistant_agent import AssistantAgent | |||||
| from typing import Dict, Optional, Union, List, Tuple, Any | |||||
| from autogen.agentchat.assistant_agent import AssistantAgent, ConversableAgent | |||||
| from autogen.oai.openai_utils import retrieve_assistants_by_name | |||||
| logger = logging.getLogger(__name__) | logger = logging.getLogger(__name__) | ||||
| @@ -1,6 +1,7 @@ | |||||
| import json | import json | ||||
| import logging | import logging | ||||
| from typing import List, Optional, Tuple | from typing import List, Optional, Tuple | ||||
| import replicate | import replicate | ||||
| import requests | import requests | ||||
| @@ -8,8 +9,8 @@ from autogen.agentchat.agent import Agent | |||||
| from autogen.agentchat.contrib.img_utils import get_image_data, llava_formatter | from autogen.agentchat.contrib.img_utils import get_image_data, llava_formatter | ||||
| from autogen.agentchat.contrib.multimodal_conversable_agent import MultimodalConversableAgent | from autogen.agentchat.contrib.multimodal_conversable_agent import MultimodalConversableAgent | ||||
| from autogen.code_utils import content_str | from autogen.code_utils import content_str | ||||
| from ...formatting_utils import colored | |||||
| from ...formatting_utils import colored | |||||
| logger = logging.getLogger(__name__) | logger = logging.getLogger(__name__) | ||||
| @@ -1,15 +1,15 @@ | |||||
| import re | |||||
| import os | import os | ||||
| from pydantic import BaseModel, Extra, root_validator | |||||
| from typing import Any, Callable, Dict, List, Optional, Union, Tuple | |||||
| import re | |||||
| from time import sleep | from time import sleep | ||||
| from typing import Any, Callable, Dict, List, Optional, Tuple, Union | |||||
| from pydantic import BaseModel, Extra, root_validator | |||||
| from autogen._pydantic import PYDANTIC_V1 | from autogen._pydantic import PYDANTIC_V1 | ||||
| from autogen.agentchat import Agent, UserProxyAgent | from autogen.agentchat import Agent, UserProxyAgent | ||||
| from autogen.code_utils import UNKNOWN, extract_code, execute_code, infer_lang | |||||
| from autogen.code_utils import UNKNOWN, execute_code, extract_code, infer_lang | |||||
| from autogen.math_utils import get_answer | from autogen.math_utils import get_answer | ||||
| PROMPTS = { | PROMPTS = { | ||||
| # default | # default | ||||
| "default": """Let's use Python to solve a math problem. | "default": """Let's use Python to solve a math problem. | ||||
| @@ -3,15 +3,11 @@ from typing import Dict, List, Optional, Tuple, Union | |||||
| from autogen import OpenAIWrapper | from autogen import OpenAIWrapper | ||||
| from autogen.agentchat import Agent, ConversableAgent | from autogen.agentchat import Agent, ConversableAgent | ||||
| from autogen.agentchat.contrib.img_utils import ( | |||||
| gpt4v_formatter, | |||||
| message_formatter_pil_to_b64, | |||||
| ) | |||||
| from autogen.agentchat.contrib.img_utils import gpt4v_formatter, message_formatter_pil_to_b64 | |||||
| from autogen.code_utils import content_str | from autogen.code_utils import content_str | ||||
| from ..._pydantic import model_dump | from ..._pydantic import model_dump | ||||
| DEFAULT_LMM_SYS_MSG = """You are a helpful AI assistant.""" | DEFAULT_LMM_SYS_MSG = """You are a helpful AI assistant.""" | ||||
| DEFAULT_MODEL = "gpt-4-vision-preview" | DEFAULT_MODEL = "gpt-4-vision-preview" | ||||
| @@ -1,15 +1,15 @@ | |||||
| import logging | |||||
| from typing import Callable, Dict, List, Optional | from typing import Callable, Dict, List, Optional | ||||
| from autogen.agentchat.contrib.retrieve_user_proxy_agent import RetrieveUserProxyAgent | from autogen.agentchat.contrib.retrieve_user_proxy_agent import RetrieveUserProxyAgent | ||||
| from autogen.retrieve_utils import get_files_from_dir, split_files_to_chunks, TEXT_FORMATS | |||||
| import logging | |||||
| from autogen.retrieve_utils import TEXT_FORMATS, get_files_from_dir, split_files_to_chunks | |||||
| logger = logging.getLogger(__name__) | logger = logging.getLogger(__name__) | ||||
| try: | try: | ||||
| import fastembed | |||||
| from qdrant_client import QdrantClient, models | from qdrant_client import QdrantClient, models | ||||
| from qdrant_client.fastembed_common import QueryResponse | from qdrant_client.fastembed_common import QueryResponse | ||||
| import fastembed | |||||
| except ImportError as e: | except ImportError as e: | ||||
| logging.fatal("Failed to import qdrant_client with fastembed. Try running 'pip install qdrant_client[fastembed]'") | logging.fatal("Failed to import qdrant_client with fastembed. Try running 'pip install qdrant_client[fastembed]'") | ||||
| raise e | raise e | ||||
| @@ -1,6 +1,7 @@ | |||||
| from typing import Any, Dict, List, Optional, Tuple, Union | |||||
| from autogen.agentchat.agent import Agent | from autogen.agentchat.agent import Agent | ||||
| from autogen.agentchat.assistant_agent import AssistantAgent | from autogen.agentchat.assistant_agent import AssistantAgent | ||||
| from typing import Dict, Optional, Union, List, Tuple, Any | |||||
| class RetrieveAssistantAgent(AssistantAgent): | class RetrieveAssistantAgent(AssistantAgent): | ||||
| @@ -1,19 +1,20 @@ | |||||
| import re | import re | ||||
| from typing import Callable, Dict, Optional, Union, List, Tuple, Any | |||||
| from typing import Any, Callable, Dict, List, Optional, Tuple, Union | |||||
| from IPython import get_ipython | from IPython import get_ipython | ||||
| try: | try: | ||||
| import chromadb | import chromadb | ||||
| except ImportError: | except ImportError: | ||||
| raise ImportError("Please install dependencies first. `pip install pyautogen[retrievechat]`") | raise ImportError("Please install dependencies first. `pip install pyautogen[retrievechat]`") | ||||
| from autogen.agentchat.agent import Agent | |||||
| from autogen import logger | |||||
| from autogen.agentchat import UserProxyAgent | from autogen.agentchat import UserProxyAgent | ||||
| from autogen.retrieve_utils import create_vector_db_from_dir, query_vector_db, TEXT_FORMATS | |||||
| from autogen.token_count_utils import count_token | |||||
| from autogen.agentchat.agent import Agent | |||||
| from autogen.code_utils import extract_code | from autogen.code_utils import extract_code | ||||
| from autogen import logger | |||||
| from ...formatting_utils import colored | |||||
| from autogen.retrieve_utils import TEXT_FORMATS, create_vector_db_from_dir, query_vector_db | |||||
| from autogen.token_count_utils import count_token | |||||
| from ...formatting_utils import colored | |||||
| PROMPT_DEFAULT = """You're a retrieve augmented chatbot. You answer user's questions based on your own knowledge and the | PROMPT_DEFAULT = """You're a retrieve augmented chatbot. You answer user's questions based on your own knowledge and the | ||||
| context provided by the user. You should follow the following steps to answer a question: | context provided by the user. You should follow the following steps to answer a question: | ||||
| @@ -1,10 +1,11 @@ | |||||
| # ruff: noqa: E722 | # ruff: noqa: E722 | ||||
| import copy | |||||
| import json | import json | ||||
| import traceback | import traceback | ||||
| import copy | |||||
| from dataclasses import dataclass | from dataclasses import dataclass | ||||
| from typing import Dict, List, Optional, Union, Callable, Literal, Tuple | |||||
| from autogen import Agent, ConversableAgent, GroupChatManager, GroupChat, OpenAIWrapper | |||||
| from typing import Callable, Dict, List, Literal, Optional, Tuple, Union | |||||
| from autogen import Agent, ConversableAgent, GroupChat, GroupChatManager, OpenAIWrapper | |||||
| class SocietyOfMindAgent(ConversableAgent): | class SocietyOfMindAgent(ConversableAgent): | ||||
| @@ -1,7 +1,8 @@ | |||||
| from typing import Any, Callable, Dict, List, Optional, Tuple, Union | |||||
| from autogen import oai | from autogen import oai | ||||
| from autogen.agentchat.agent import Agent | from autogen.agentchat.agent import Agent | ||||
| from autogen.agentchat.assistant_agent import ConversableAgent | from autogen.agentchat.assistant_agent import ConversableAgent | ||||
| from typing import Callable, Dict, Optional, Union, List, Tuple, Any | |||||
| system_message = """You are an expert in text analysis. | system_message = """You are an expert in text analysis. | ||||
| The user will give you TEXT to analyze. | The user will give you TEXT to analyze. | ||||
| @@ -1,16 +1,18 @@ | |||||
| import json | |||||
| import copy | import copy | ||||
| import json | |||||
| import logging | import logging | ||||
| import re | import re | ||||
| from dataclasses import dataclass | from dataclasses import dataclass | ||||
| from typing import Any, Dict, List, Optional, Union, Callable, Literal, Tuple | |||||
| from datetime import datetime | |||||
| from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, Union | |||||
| from typing_extensions import Annotated | from typing_extensions import Annotated | ||||
| from ... import Agent, ConversableAgent, AssistantAgent, UserProxyAgent, GroupChatManager, GroupChat, OpenAIWrapper | |||||
| from ... import Agent, AssistantAgent, ConversableAgent, GroupChat, GroupChatManager, OpenAIWrapper, UserProxyAgent | |||||
| from ...browser_utils import SimpleTextBrowser | from ...browser_utils import SimpleTextBrowser | ||||
| from ...code_utils import content_str | from ...code_utils import content_str | ||||
| from datetime import datetime | |||||
| from ...token_count_utils import count_token, get_max_token_limit | |||||
| from ...oai.openai_utils import filter_config | from ...oai.openai_utils import filter_config | ||||
| from ...token_count_utils import count_token, get_max_token_limit | |||||
| logger = logging.getLogger(__name__) | logger = logging.getLogger(__name__) | ||||
| @@ -1,7 +1,7 @@ | |||||
| from typing import Callable, Dict, List, Literal, Optional, Union | from typing import Callable, Dict, List, Literal, Optional, Union | ||||
| from ..runtime_logging import log_new_agent, logging_enabled | |||||
| from .conversable_agent import ConversableAgent | from .conversable_agent import ConversableAgent | ||||
| from ..runtime_logging import logging_enabled, log_new_agent | |||||
| class UserProxyAgent(ConversableAgent): | class UserProxyAgent(ConversableAgent): | ||||
| @@ -1,4 +1,5 @@ | |||||
| from typing import Any, List, Dict, Tuple, Callable | |||||
| from typing import Any, Callable, Dict, List, Tuple | |||||
| from .agent import Agent | from .agent import Agent | ||||
| @@ -1,14 +1,15 @@ | |||||
| import io | |||||
| import json | import json | ||||
| import mimetypes | |||||
| import os | import os | ||||
| import requests | |||||
| import re | import re | ||||
| import markdownify | |||||
| import io | |||||
| import uuid | import uuid | ||||
| import mimetypes | |||||
| from typing import Any, Dict, List, Optional, Tuple, Union | |||||
| from urllib.parse import urljoin, urlparse | from urllib.parse import urljoin, urlparse | ||||
| import markdownify | |||||
| import requests | |||||
| from bs4 import BeautifulSoup | from bs4 import BeautifulSoup | ||||
| from typing import Any, Dict, List, Optional, Union, Tuple | |||||
| # Optional PDF support | # Optional PDF support | ||||
| IS_PDF_CAPABLE = False | IS_PDF_CAPABLE = False | ||||
| @@ -1,7 +1,7 @@ | |||||
| import sys | |||||
| from abc import ABC, abstractmethod | from abc import ABC, abstractmethod | ||||
| from types import TracebackType | from types import TracebackType | ||||
| from typing import Any, Optional, Type | from typing import Any, Optional, Type | ||||
| import sys | |||||
| if sys.version_info >= (3, 11): | if sys.version_info >= (3, 11): | ||||
| from typing import Self | from typing import Self | ||||
| @@ -1,13 +1,12 @@ | |||||
| from __future__ import annotations | from __future__ import annotations | ||||
| import sys | |||||
| from types import TracebackType | from types import TracebackType | ||||
| from typing import Dict, Any, Optional, Type, Union | |||||
| from typing import Any, Dict, Optional, Type, Union | |||||
| from .abstract_cache_base import AbstractCache | from .abstract_cache_base import AbstractCache | ||||
| from .cache_factory import CacheFactory | from .cache_factory import CacheFactory | ||||
| import sys | |||||
| if sys.version_info >= (3, 11): | if sys.version_info >= (3, 11): | ||||
| from typing import Self | from typing import Self | ||||
| else: | else: | ||||
| @@ -1,9 +1,9 @@ | |||||
| import logging | |||||
| from typing import Optional, Union | from typing import Optional, Union | ||||
| from .abstract_cache_base import AbstractCache | from .abstract_cache_base import AbstractCache | ||||
| from .disk_cache import DiskCache | from .disk_cache import DiskCache | ||||
| import logging | |||||
| class CacheFactory: | class CacheFactory: | ||||
| @staticmethod | @staticmethod | ||||
| @@ -1,8 +1,10 @@ | |||||
| import sys | |||||
| from types import TracebackType | from types import TracebackType | ||||
| from typing import Any, Optional, Type, Union | from typing import Any, Optional, Type, Union | ||||
| import diskcache | import diskcache | ||||
| from .abstract_cache_base import AbstractCache | from .abstract_cache_base import AbstractCache | ||||
| import sys | |||||
| if sys.version_info >= (3, 11): | if sys.version_info >= (3, 11): | ||||
| from typing import Self | from typing import Self | ||||
| @@ -1,8 +1,10 @@ | |||||
| import pickle | import pickle | ||||
| import sys | |||||
| from types import TracebackType | from types import TracebackType | ||||
| from typing import Any, Optional, Type, Union | from typing import Any, Optional, Type, Union | ||||
| import redis | import redis | ||||
| import sys | |||||
| from .abstract_cache_base import AbstractCache | from .abstract_cache_base import AbstractCache | ||||
| if sys.version_info >= (3, 11): | if sys.version_info >= (3, 11): | ||||
| @@ -10,10 +10,10 @@ from concurrent.futures import ThreadPoolExecutor, TimeoutError | |||||
| from hashlib import md5 | from hashlib import md5 | ||||
| from typing import Any, Callable, Dict, List, Optional, Tuple, Union | from typing import Any, Callable, Dict, List, Optional, Tuple, Union | ||||
| from autogen import oai | |||||
| import docker | import docker | ||||
| from autogen import oai | |||||
| from .types import UserMessageImageContentPart, UserMessageTextContentPart | from .types import UserMessageImageContentPart, UserMessageTextContentPart | ||||
| SENTINEL = object() | SENTINEL = object() | ||||
| @@ -1,8 +1,8 @@ | |||||
| from .base import CodeBlock, CodeExecutor, CodeExtractor, CodeResult | from .base import CodeBlock, CodeExecutor, CodeExtractor, CodeResult | ||||
| from .docker_commandline_code_executor import DockerCommandLineCodeExecutor | |||||
| from .factory import CodeExecutorFactory | from .factory import CodeExecutorFactory | ||||
| from .markdown_code_extractor import MarkdownCodeExtractor | |||||
| from .local_commandline_code_executor import LocalCommandLineCodeExecutor | from .local_commandline_code_executor import LocalCommandLineCodeExecutor | ||||
| from .docker_commandline_code_executor import DockerCommandLineCodeExecutor | |||||
| from .markdown_code_extractor import MarkdownCodeExtractor | |||||
| __all__ = ( | __all__ = ( | ||||
| "CodeBlock", | "CodeBlock", | ||||
| @@ -1,4 +1,5 @@ | |||||
| from __future__ import annotations | from __future__ import annotations | ||||
| from typing import Any, List, Literal, Mapping, Optional, Protocol, TypedDict, Union, runtime_checkable | from typing import Any, List, Literal, Mapping, Optional, Protocol, TypedDict, Union, runtime_checkable | ||||
| from pydantic import BaseModel, Field | from pydantic import BaseModel, Field | ||||
| @@ -1,22 +1,22 @@ | |||||
| from __future__ import annotations | from __future__ import annotations | ||||
| import atexit | import atexit | ||||
| from hashlib import md5 | |||||
| import logging | import logging | ||||
| import sys | |||||
| import uuid | |||||
| from hashlib import md5 | |||||
| from pathlib import Path | from pathlib import Path | ||||
| from time import sleep | from time import sleep | ||||
| from types import TracebackType | from types import TracebackType | ||||
| import uuid | |||||
| from typing import Any, List, Optional, Type, Union | from typing import Any, List, Optional, Type, Union | ||||
| import docker | import docker | ||||
| from docker.errors import ImageNotFound | from docker.errors import ImageNotFound | ||||
| from .utils import _get_file_name_from_content, silence_pip | |||||
| from .base import CommandLineCodeResult | |||||
| from ..code_utils import TIMEOUT_MSG, _cmd | from ..code_utils import TIMEOUT_MSG, _cmd | ||||
| from .base import CodeBlock, CodeExecutor, CodeExtractor | |||||
| from .base import CodeBlock, CodeExecutor, CodeExtractor, CommandLineCodeResult | |||||
| from .markdown_code_extractor import MarkdownCodeExtractor | from .markdown_code_extractor import MarkdownCodeExtractor | ||||
| import sys | |||||
| from .utils import _get_file_name_from_content, silence_pip | |||||
| if sys.version_info >= (3, 11): | if sys.version_info >= (3, 11): | ||||
| from typing import Self | from typing import Self | ||||
| @@ -1,4 +1,4 @@ | |||||
| from .base import CodeExecutor, CodeExecutionConfig | |||||
| from .base import CodeExecutionConfig, CodeExecutor | |||||
| __all__ = ("CodeExecutorFactory",) | __all__ = ("CodeExecutorFactory",) | ||||
| @@ -1,9 +1,9 @@ | |||||
| from .base import JupyterConnectable, JupyterConnectionInfo | from .base import JupyterConnectable, JupyterConnectionInfo | ||||
| from .jupyter_client import JupyterClient | |||||
| from .local_jupyter_server import LocalJupyterServer | |||||
| from .docker_jupyter_server import DockerJupyterServer | from .docker_jupyter_server import DockerJupyterServer | ||||
| from .embedded_ipython_code_executor import EmbeddedIPythonCodeExecutor | from .embedded_ipython_code_executor import EmbeddedIPythonCodeExecutor | ||||
| from .jupyter_client import JupyterClient | |||||
| from .jupyter_code_executor import JupyterCodeExecutor | from .jupyter_code_executor import JupyterCodeExecutor | ||||
| from .local_jupyter_server import LocalJupyterServer | |||||
| __all__ = [ | __all__ = [ | ||||
| "JupyterConnectable", | "JupyterConnectable", | ||||
| @@ -1,15 +1,16 @@ | |||||
| from __future__ import annotations | from __future__ import annotations | ||||
| from pathlib import Path | |||||
| import atexit | |||||
| import io | |||||
| import logging | |||||
| import secrets | |||||
| import sys | import sys | ||||
| from types import TracebackType | |||||
| import uuid | import uuid | ||||
| from pathlib import Path | |||||
| from types import TracebackType | |||||
| from typing import Dict, Optional, Type, Union | from typing import Dict, Optional, Type, Union | ||||
| import docker | import docker | ||||
| import secrets | |||||
| import io | |||||
| import atexit | |||||
| import logging | |||||
| from ..docker_commandline_code_executor import _wait_for_ready | from ..docker_commandline_code_executor import _wait_for_ready | ||||
| @@ -18,9 +19,8 @@ if sys.version_info >= (3, 11): | |||||
| else: | else: | ||||
| from typing_extensions import Self | from typing_extensions import Self | ||||
| from .jupyter_client import JupyterClient | |||||
| from .base import JupyterConnectable, JupyterConnectionInfo | from .base import JupyterConnectable, JupyterConnectionInfo | ||||
| from .jupyter_client import JupyterClient | |||||
| class DockerJupyterServer(JupyterConnectable): | class DockerJupyterServer(JupyterConnectable): | ||||
| @@ -1,9 +1,9 @@ | |||||
| import base64 | import base64 | ||||
| import json | import json | ||||
| import os | import os | ||||
| from pathlib import Path | |||||
| import re | import re | ||||
| import uuid | import uuid | ||||
| from pathlib import Path | |||||
| from queue import Empty | from queue import Empty | ||||
| from typing import Any, ClassVar, List | from typing import Any, ClassVar, List | ||||
| @@ -1,22 +1,22 @@ | |||||
| from __future__ import annotations | from __future__ import annotations | ||||
| import sys | |||||
| from dataclasses import dataclass | from dataclasses import dataclass | ||||
| from types import TracebackType | from types import TracebackType | ||||
| from typing import Any, Dict, List, Optional, Type, cast | from typing import Any, Dict, List, Optional, Type, cast | ||||
| import sys | |||||
| if sys.version_info >= (3, 11): | if sys.version_info >= (3, 11): | ||||
| from typing import Self | from typing import Self | ||||
| else: | else: | ||||
| from typing_extensions import Self | from typing_extensions import Self | ||||
| import datetime | |||||
| import json | import json | ||||
| import uuid | import uuid | ||||
| import datetime | |||||
| import requests | |||||
| from requests.adapters import HTTPAdapter, Retry | |||||
| import requests | |||||
| import websocket | import websocket | ||||
| from requests.adapters import HTTPAdapter, Retry | |||||
| from websocket import WebSocket | from websocket import WebSocket | ||||
| from .base import JupyterConnectionInfo | from .base import JupyterConnectionInfo | ||||
| @@ -1,12 +1,12 @@ | |||||
| import base64 | import base64 | ||||
| import json | import json | ||||
| import os | import os | ||||
| from pathlib import Path | |||||
| import re | import re | ||||
| from types import TracebackType | |||||
| import sys | |||||
| import uuid | import uuid | ||||
| from pathlib import Path | |||||
| from types import TracebackType | |||||
| from typing import Any, ClassVar, List, Optional, Type, Union | from typing import Any, ClassVar, List, Optional, Type, Union | ||||
| import sys | |||||
| from autogen.coding.utils import silence_pip | from autogen.coding.utils import silence_pip | ||||
| @@ -15,7 +15,6 @@ if sys.version_info >= (3, 11): | |||||
| else: | else: | ||||
| from typing_extensions import Self | from typing_extensions import Self | ||||
| from ...agentchat.agent import LLMAgent | from ...agentchat.agent import LLMAgent | ||||
| from ..base import CodeBlock, CodeExecutor, CodeExtractor, IPythonCodeResult | from ..base import CodeBlock, CodeExecutor, CodeExtractor, IPythonCodeResult | ||||
| from ..markdown_code_extractor import MarkdownCodeExtractor | from ..markdown_code_extractor import MarkdownCodeExtractor | ||||
| @@ -1,14 +1,14 @@ | |||||
| from __future__ import annotations | from __future__ import annotations | ||||
| from types import TracebackType | |||||
| from typing import Optional, Type, Union, cast | |||||
| import subprocess | |||||
| import signal | |||||
| import sys | |||||
| import atexit | |||||
| import json | import json | ||||
| import secrets | import secrets | ||||
| import signal | |||||
| import socket | import socket | ||||
| import atexit | |||||
| import subprocess | |||||
| import sys | |||||
| from types import TracebackType | |||||
| from typing import Optional, Type, Union, cast | |||||
| if sys.version_info >= (3, 11): | if sys.version_info >= (3, 11): | ||||
| from typing import Self | from typing import Self | ||||
| @@ -1,21 +1,19 @@ | |||||
| from hashlib import md5 | |||||
| import os | import os | ||||
| from pathlib import Path | |||||
| import re | import re | ||||
| import subprocess | |||||
| import sys | import sys | ||||
| import uuid | import uuid | ||||
| import warnings | import warnings | ||||
| from hashlib import md5 | |||||
| from pathlib import Path | |||||
| from typing import ClassVar, List, Union | from typing import ClassVar, List, Union | ||||
| from ..agentchat.agent import LLMAgent | from ..agentchat.agent import LLMAgent | ||||
| from ..code_utils import TIMEOUT_MSG, WIN32, _cmd, execute_code | from ..code_utils import TIMEOUT_MSG, WIN32, _cmd, execute_code | ||||
| from .base import CodeBlock, CodeExecutor, CodeExtractor, CommandLineCodeResult | from .base import CodeBlock, CodeExecutor, CodeExtractor, CommandLineCodeResult | ||||
| from .markdown_code_extractor import MarkdownCodeExtractor | from .markdown_code_extractor import MarkdownCodeExtractor | ||||
| from .utils import _get_file_name_from_content, silence_pip | from .utils import _get_file_name_from_content, silence_pip | ||||
| import subprocess | |||||
| __all__ = ("LocalCommandLineCodeExecutor",) | __all__ = ("LocalCommandLineCodeExecutor",) | ||||
| @@ -2,8 +2,8 @@ import re | |||||
| from typing import Any, Dict, List, Optional, Union | from typing import Any, Dict, List, Optional, Union | ||||
| from ..code_utils import CODE_BLOCK_PATTERN, UNKNOWN, content_str, infer_lang | from ..code_utils import CODE_BLOCK_PATTERN, UNKNOWN, content_str, infer_lang | ||||
| from .base import CodeBlock, CodeExtractor | |||||
| from ..types import UserMessageImageContentPart, UserMessageTextContentPart | from ..types import UserMessageImageContentPart, UserMessageTextContentPart | ||||
| from .base import CodeBlock, CodeExtractor | |||||
| __all__ = ("MarkdownCodeExtractor",) | __all__ = ("MarkdownCodeExtractor",) | ||||
| @@ -1,5 +1,5 @@ | |||||
| from typing import Dict, List | |||||
| import logging | import logging | ||||
| from typing import Dict, List | |||||
| from autogen.agentchat.groupchat import Agent | from autogen.agentchat.groupchat import Agent | ||||
| @@ -115,8 +115,8 @@ def visualize_speaker_transitions_dict(speaker_transitions_dict: dict, agents: L | |||||
| Visualize the speaker_transitions_dict using networkx. | Visualize the speaker_transitions_dict using networkx. | ||||
| """ | """ | ||||
| try: | try: | ||||
| import networkx as nx | |||||
| import matplotlib.pyplot as plt | import matplotlib.pyplot as plt | ||||
| import networkx as nx | |||||
| except ImportError as e: | except ImportError as e: | ||||
| logging.fatal("Failed to import networkx or matplotlib. Try running 'pip install autogen[graphs]'") | logging.fatal("Failed to import networkx or matplotlib. Try running 'pip install autogen[graphs]'") | ||||
| raise e | raise e | ||||
| @@ -1,11 +1,11 @@ | |||||
| from __future__ import annotations | from __future__ import annotations | ||||
| from abc import ABC, abstractmethod | |||||
| from typing import Any, Dict, List, TYPE_CHECKING, Union | |||||
| import sqlite3 | import sqlite3 | ||||
| import uuid | import uuid | ||||
| from abc import ABC, abstractmethod | |||||
| from typing import TYPE_CHECKING, Any, Dict, List, Union | |||||
| from openai import OpenAI, AzureOpenAI | |||||
| from openai import AzureOpenAI, OpenAI | |||||
| from openai.types.chat import ChatCompletion | from openai.types.chat import ChatCompletion | ||||
| if TYPE_CHECKING: | if TYPE_CHECKING: | ||||
| @@ -1,4 +1,5 @@ | |||||
| from typing import Any, Dict, Optional | from typing import Any, Dict, Optional | ||||
| from autogen.logger.base_logger import BaseLogger | from autogen.logger.base_logger import BaseLogger | ||||
| from autogen.logger.sqlite_logger import SqliteLogger | from autogen.logger.sqlite_logger import SqliteLogger | ||||
| @@ -6,16 +6,16 @@ import os | |||||
| import sqlite3 | import sqlite3 | ||||
| import threading | import threading | ||||
| import uuid | import uuid | ||||
| from typing import TYPE_CHECKING, Any, Dict, List, Tuple, Union | |||||
| from openai import AzureOpenAI, OpenAI | |||||
| from openai.types.chat import ChatCompletion | |||||
| from autogen.logger.base_logger import BaseLogger | from autogen.logger.base_logger import BaseLogger | ||||
| from autogen.logger.logger_utils import get_current_ts, to_dict | from autogen.logger.logger_utils import get_current_ts, to_dict | ||||
| from openai import OpenAI, AzureOpenAI | |||||
| from openai.types.chat import ChatCompletion | |||||
| from typing import Any, Dict, List, TYPE_CHECKING, Tuple, Union | |||||
| from .base_logger import LLMConfig | from .base_logger import LLMConfig | ||||
| if TYPE_CHECKING: | if TYPE_CHECKING: | ||||
| from autogen import ConversableAgent, OpenAIWrapper | from autogen import ConversableAgent, OpenAIWrapper | ||||
| @@ -1,5 +1,6 @@ | |||||
| from typing import Optional | from typing import Optional | ||||
| from autogen import oai, DEFAULT_MODEL | |||||
| from autogen import DEFAULT_MODEL, oai | |||||
| _MATH_PROMPT = "{problem} Solve the problem carefully. Simplify your answer as much as possible. Put the final answer in \\boxed{{}}." | _MATH_PROMPT = "{problem} Solve the problem carefully. Simplify your answer as much as possible. Put the final answer in \\boxed{{}}." | ||||
| _MATH_CONFIG = { | _MATH_CONFIG = { | ||||
| @@ -1,15 +1,15 @@ | |||||
| from autogen.oai.client import OpenAIWrapper, ModelClient | |||||
| from autogen.oai.completion import Completion, ChatCompletion | |||||
| from autogen.cache.cache import Cache | |||||
| from autogen.oai.client import ModelClient, OpenAIWrapper | |||||
| from autogen.oai.completion import ChatCompletion, Completion | |||||
| from autogen.oai.openai_utils import ( | from autogen.oai.openai_utils import ( | ||||
| get_config_list, | |||||
| config_list_from_dotenv, | |||||
| config_list_from_json, | |||||
| config_list_from_models, | |||||
| config_list_gpt4_gpt35, | config_list_gpt4_gpt35, | ||||
| config_list_openai_aoai, | config_list_openai_aoai, | ||||
| config_list_from_models, | |||||
| config_list_from_json, | |||||
| config_list_from_dotenv, | |||||
| filter_config, | filter_config, | ||||
| get_config_list, | |||||
| ) | ) | ||||
| from autogen.cache.cache import Cache | |||||
| __all__ = [ | __all__ = [ | ||||
| "OpenAIWrapper", | "OpenAIWrapper", | ||||
| @@ -1,21 +1,19 @@ | |||||
| from __future__ import annotations | from __future__ import annotations | ||||
| import sys | |||||
| from typing import Any, List, Optional, Dict, Callable, Tuple, Union | |||||
| import logging | |||||
| import inspect | import inspect | ||||
| import logging | |||||
| import sys | |||||
| import uuid | import uuid | ||||
| from flaml.automl.logger import logger_formatter | |||||
| from typing import Any, Callable, Dict, List, Optional, Protocol, Tuple, Union | |||||
| from flaml.automl.logger import logger_formatter | |||||
| from pydantic import BaseModel | from pydantic import BaseModel | ||||
| from typing import Protocol | |||||
| from autogen.cache.cache import Cache | from autogen.cache.cache import Cache | ||||
| from autogen.oai.openai_utils import get_key, is_valid_api_key, OAI_PRICE1K | |||||
| from autogen.token_count_utils import count_token | |||||
| from autogen.runtime_logging import logging_enabled, log_chat_completion, log_new_client, log_new_wrapper | |||||
| from autogen.logger.logger_utils import get_current_ts | from autogen.logger.logger_utils import get_current_ts | ||||
| from autogen.oai.openai_utils import OAI_PRICE1K, get_key, is_valid_api_key | |||||
| from autogen.runtime_logging import log_chat_completion, log_new_client, log_new_wrapper, logging_enabled | |||||
| from autogen.token_count_utils import count_token | |||||
| TOOL_ENABLED = False | TOOL_ENABLED = False | ||||
| try: | try: | ||||
| @@ -26,14 +24,15 @@ except ImportError: | |||||
| AzureOpenAI = object | AzureOpenAI = object | ||||
| else: | else: | ||||
| # raises exception if openai>=1 is installed and something is wrong with imports | # raises exception if openai>=1 is installed and something is wrong with imports | ||||
| from openai import OpenAI, AzureOpenAI, APIError, APITimeoutError, __version__ as OPENAIVERSION | |||||
| from openai import APIError, APITimeoutError, AzureOpenAI, OpenAI | |||||
| from openai import __version__ as OPENAIVERSION | |||||
| from openai.resources import Completions | from openai.resources import Completions | ||||
| from openai.types.chat import ChatCompletion | from openai.types.chat import ChatCompletion | ||||
| from openai.types.chat.chat_completion import ChatCompletionMessage, Choice # type: ignore [attr-defined] | from openai.types.chat.chat_completion import ChatCompletionMessage, Choice # type: ignore [attr-defined] | ||||
| from openai.types.chat.chat_completion_chunk import ( | from openai.types.chat.chat_completion_chunk import ( | ||||
| ChoiceDeltaFunctionCall, | |||||
| ChoiceDeltaToolCall, | ChoiceDeltaToolCall, | ||||
| ChoiceDeltaToolCallFunction, | ChoiceDeltaToolCallFunction, | ||||
| ChoiceDeltaFunctionCall, | |||||
| ) | ) | ||||
| from openai.types.completion import Completion | from openai.types.completion import Completion | ||||
| from openai.types.completion_usage import CompletionUsage | from openai.types.completion_usage import CompletionUsage | ||||
| @@ -1,28 +1,24 @@ | |||||
| from time import sleep | |||||
| import logging | import logging | ||||
| import time | |||||
| from typing import List, Optional, Dict, Callable, Union | |||||
| import sys | |||||
| import shutil | import shutil | ||||
| import sys | |||||
| import time | |||||
| from collections import defaultdict | |||||
| from time import sleep | |||||
| from typing import Callable, Dict, List, Optional, Union | |||||
| import numpy as np | import numpy as np | ||||
| from flaml import tune, BlendSearch | |||||
| from flaml.tune.space import is_constant | |||||
| from flaml import BlendSearch, tune | |||||
| from flaml.automl.logger import logger_formatter | from flaml.automl.logger import logger_formatter | ||||
| from flaml.tune.space import is_constant | |||||
| from .openai_utils import get_key | from .openai_utils import get_key | ||||
| from collections import defaultdict | |||||
| try: | try: | ||||
| import diskcache | |||||
| import openai | import openai | ||||
| from openai import ( | |||||
| RateLimitError, | |||||
| APIError, | |||||
| BadRequestError, | |||||
| APIConnectionError, | |||||
| Timeout, | |||||
| AuthenticationError, | |||||
| ) | |||||
| from openai import APIConnectionError, APIError, AuthenticationError, BadRequestError | |||||
| from openai import Completion as openai_Completion | from openai import Completion as openai_Completion | ||||
| import diskcache | |||||
| from openai import RateLimitError, Timeout | |||||
| ERROR = None | ERROR = None | ||||
| assert openai.__version__ < "1" | assert openai.__version__ < "1" | ||||
| @@ -7,7 +7,6 @@ from pathlib import Path | |||||
| from typing import Any, Dict, List, Optional, Set, Union | from typing import Any, Dict, List, Optional, Set, Union | ||||
| from dotenv import find_dotenv, load_dotenv | from dotenv import find_dotenv, load_dotenv | ||||
| from openai import OpenAI | from openai import OpenAI | ||||
| from openai.types.beta.assistant import Assistant | from openai.types.beta.assistant import Assistant | ||||
| @@ -1,18 +1,22 @@ | |||||
| from typing import List, Union, Callable | |||||
| import glob | |||||
| import os | import os | ||||
| import requests | |||||
| from typing import Callable, List, Union | |||||
| from urllib.parse import urlparse | from urllib.parse import urlparse | ||||
| import glob | |||||
| import chromadb | import chromadb | ||||
| import requests | |||||
| if chromadb.__version__ < "0.4.15": | if chromadb.__version__ < "0.4.15": | ||||
| from chromadb.api import API | from chromadb.api import API | ||||
| else: | else: | ||||
| from chromadb.api import ClientAPI as API | from chromadb.api import ClientAPI as API | ||||
| from chromadb.api.types import QueryResult | |||||
| import chromadb.utils.embedding_functions as ef | |||||
| import logging | import logging | ||||
| import chromadb.utils.embedding_functions as ef | |||||
| import pypdf | import pypdf | ||||
| from chromadb.api.types import QueryResult | |||||
| from autogen.token_count_utils import count_token | from autogen.token_count_utils import count_token | ||||
| try: | try: | ||||
| @@ -1,16 +1,16 @@ | |||||
| from __future__ import annotations | from __future__ import annotations | ||||
| from autogen.logger.logger_factory import LoggerFactory | |||||
| from autogen.logger.base_logger import LLMConfig | |||||
| import logging | import logging | ||||
| import sqlite3 | import sqlite3 | ||||
| from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union | |||||
| import uuid | import uuid | ||||
| from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union | |||||
| from openai import OpenAI, AzureOpenAI | |||||
| from openai import AzureOpenAI, OpenAI | |||||
| from openai.types.chat import ChatCompletion | from openai.types.chat import ChatCompletion | ||||
| from autogen.logger.base_logger import LLMConfig | |||||
| from autogen.logger.logger_factory import LoggerFactory | |||||
| if TYPE_CHECKING: | if TYPE_CHECKING: | ||||
| from autogen import ConversableAgent, OpenAIWrapper | from autogen import ConversableAgent, OpenAIWrapper | ||||
| @@ -1,9 +1,9 @@ | |||||
| from typing import List, Union, Dict | |||||
| import logging | |||||
| import json | import json | ||||
| import tiktoken | |||||
| import logging | |||||
| import re | import re | ||||
| from typing import Dict, List, Union | |||||
| import tiktoken | |||||
| logger = logging.getLogger(__name__) | logger = logging.getLogger(__name__) | ||||
| @@ -99,3 +99,8 @@ warn_unused_ignores = true | |||||
| disallow_incomplete_defs = true | disallow_incomplete_defs = true | ||||
| disallow_untyped_decorators = true | disallow_untyped_decorators = true | ||||
| disallow_any_unimported = true | disallow_any_unimported = true | ||||
| [tool.isort] | |||||
| profile = "black" | |||||
| line_length = 120 | |||||
| @@ -1,11 +1,10 @@ | |||||
| import os | |||||
| import logging | import logging | ||||
| import logging.handlers | import logging.handlers | ||||
| import os | |||||
| import discord | import discord | ||||
| from discord.ext import commands | |||||
| from agent_utils import solve_task | from agent_utils import solve_task | ||||
| from discord.ext import commands | |||||
| logger = logging.getLogger("anny") | logger = logging.getLogger("anny") | ||||
| logger.setLevel(logging.INFO) | logger.setLevel(logging.INFO) | ||||
| @@ -1,4 +1,4 @@ | |||||
| from .chatmanager import * | from .chatmanager import * | ||||
| from .workflowmanager import * | |||||
| from .datamodel import * | from .datamodel import * | ||||
| from .version import __version__ | from .version import __version__ | ||||
| from .workflowmanager import * | |||||
| @@ -1,12 +1,14 @@ | |||||
| import asyncio | import asyncio | ||||
| from datetime import datetime | |||||
| import json | import json | ||||
| from queue import Queue | |||||
| import time | |||||
| from typing import Any, List, Dict, Optional, Tuple | |||||
| import os | import os | ||||
| from fastapi import WebSocket, WebSocketDisconnect | |||||
| import time | |||||
| from datetime import datetime | |||||
| from queue import Queue | |||||
| from typing import Any, Dict, List, Optional, Tuple | |||||
| import websockets | import websockets | ||||
| from fastapi import WebSocket, WebSocketDisconnect | |||||
| from .datamodel import AgentWorkFlowConfig, Message, SocketMessage | from .datamodel import AgentWorkFlowConfig, Message, SocketMessage | ||||
| from .utils import extract_successful_code_blocks, get_modified_files, summarize_chat_history | from .utils import extract_successful_code_blocks, get_modified_files, summarize_chat_history | ||||
| from .workflowmanager import AutoGenWorkFlowManager | from .workflowmanager import AutoGenWorkFlowManager | ||||
| @@ -1,10 +1,11 @@ | |||||
| import os | import os | ||||
| from typing_extensions import Annotated | |||||
| import typer | import typer | ||||
| import uvicorn | import uvicorn | ||||
| from typing_extensions import Annotated | |||||
| from .version import VERSION | |||||
| from .utils.dbutils import DBManager | from .utils.dbutils import DBManager | ||||
| from .version import VERSION | |||||
| app = typer.Typer() | app = typer.Typer() | ||||
| @@ -1,8 +1,9 @@ | |||||
| import uuid | import uuid | ||||
| from dataclasses import asdict, field | |||||
| from datetime import datetime | from datetime import datetime | ||||
| from typing import Any, Callable, Dict, List, Literal, Optional, Union | from typing import Any, Callable, Dict, List, Literal, Optional, Union | ||||
| from pydantic.dataclasses import dataclass | from pydantic.dataclasses import dataclass | ||||
| from dataclasses import asdict, field | |||||
| @dataclass | @dataclass | ||||
| @@ -1,13 +1,13 @@ | |||||
| import json | import json | ||||
| import logging | import logging | ||||
| import os | |||||
| import sqlite3 | import sqlite3 | ||||
| import threading | import threading | ||||
| import os | |||||
| from typing import Any, List, Dict, Optional, Tuple | |||||
| from typing import Any, Dict, List, Optional, Tuple | |||||
| from ..datamodel import AgentFlowSpec, AgentWorkFlowConfig, Gallery, Message, Model, Session, Skill | from ..datamodel import AgentFlowSpec, AgentWorkFlowConfig, Gallery, Message, Model, Session, Skill | ||||
| from ..version import __version__ as __db_version__ | from ..version import __version__ as __db_version__ | ||||
| VERSION_TABLE_SQL = """ | VERSION_TABLE_SQL = """ | ||||
| CREATE TABLE IF NOT EXISTS version ( | CREATE TABLE IF NOT EXISTS version ( | ||||
| @@ -1,14 +1,17 @@ | |||||
| import base64 | import base64 | ||||
| import hashlib | import hashlib | ||||
| from typing import List, Dict, Tuple, Union | |||||
| import os | import os | ||||
| import re | |||||
| import shutil | import shutil | ||||
| from pathlib import Path | from pathlib import Path | ||||
| import re | |||||
| from typing import Dict, List, Tuple, Union | |||||
| from dotenv import load_dotenv | |||||
| import autogen | import autogen | ||||
| from autogen.oai.client import OpenAIWrapper | from autogen.oai.client import OpenAIWrapper | ||||
| from ..datamodel import AgentConfig, AgentFlowSpec, AgentWorkFlowConfig, LLMConfig, Model, Skill | from ..datamodel import AgentConfig, AgentFlowSpec, AgentWorkFlowConfig, LLMConfig, Model, Skill | ||||
| from dotenv import load_dotenv | |||||
| from ..version import APP_NAME | from ..version import APP_NAME | ||||
| @@ -1,26 +1,20 @@ | |||||
| import asyncio | import asyncio | ||||
| from contextlib import asynccontextmanager | |||||
| import json | import json | ||||
| import os | import os | ||||
| import queue | import queue | ||||
| import threading | import threading | ||||
| import traceback | import traceback | ||||
| from fastapi import FastAPI, WebSocket, WebSocketDisconnect | |||||
| from contextlib import asynccontextmanager | |||||
| from fastapi import FastAPI, HTTPException, WebSocket, WebSocketDisconnect | |||||
| from fastapi.middleware.cors import CORSMiddleware | from fastapi.middleware.cors import CORSMiddleware | ||||
| from fastapi.staticfiles import StaticFiles | from fastapi.staticfiles import StaticFiles | ||||
| from fastapi import HTTPException | |||||
| from openai import OpenAIError | from openai import OpenAIError | ||||
| from ..version import VERSION, APP_NAME | |||||
| from ..datamodel import ( | |||||
| DBWebRequestModel, | |||||
| DeleteMessageWebRequestModel, | |||||
| Message, | |||||
| Session, | |||||
| ) | |||||
| from ..utils import md5_hash, init_app_folders, DBManager, dbutils, test_model | |||||
| from ..chatmanager import AutoGenChatManager, WebSocketConnectionManager | from ..chatmanager import AutoGenChatManager, WebSocketConnectionManager | ||||
| from ..datamodel import DBWebRequestModel, DeleteMessageWebRequestModel, Message, Session | |||||
| from ..utils import DBManager, dbutils, init_app_folders, md5_hash, test_model | |||||
| from ..version import APP_NAME, VERSION | |||||
| managers = {"chat": None} # manage calls to autogen | managers = {"chat": None} # manage calls to autogen | ||||
| # Create thread-safe queue for messages between api thread and autogen threads | # Create thread-safe queue for messages between api thread and autogen threads | ||||
| @@ -1,12 +1,13 @@ | |||||
| import os | import os | ||||
| from typing import List, Optional, Union, Dict | |||||
| from datetime import datetime | |||||
| from typing import Dict, List, Optional, Union | |||||
| from requests import Session | from requests import Session | ||||
| import autogen | import autogen | ||||
| from .datamodel import AgentConfig, AgentFlowSpec, AgentWorkFlowConfig, Message, SocketMessage | from .datamodel import AgentConfig, AgentFlowSpec, AgentWorkFlowConfig, Message, SocketMessage | ||||
| from .utils import get_skills_from_prompt, clear_folder, sanitize_model | |||||
| from datetime import datetime | |||||
| from .utils import clear_folder, get_skills_from_prompt, sanitize_model | |||||
| class AutoGenWorkFlowManager: | class AutoGenWorkFlowManager: | ||||
| @@ -1,9 +1,11 @@ | |||||
| import zmq | |||||
| import threading | import threading | ||||
| import traceback | |||||
| import time | import time | ||||
| from .DebugLog import Debug, Info | |||||
| import traceback | |||||
| import zmq | |||||
| from .Config import xpub_url | from .Config import xpub_url | ||||
| from .DebugLog import Debug, Info | |||||
| class Actor: | class Actor: | ||||
| @@ -1,11 +1,13 @@ | |||||
| # Agent_Sender takes a zmq context, Topic and creates a | # Agent_Sender takes a zmq context, Topic and creates a | ||||
| # socket that can publish to that topic. It exposes this functionality | # socket that can publish to that topic. It exposes this functionality | ||||
| # using send_msg method | # using send_msg method | ||||
| import zmq | |||||
| import time | import time | ||||
| import uuid | import uuid | ||||
| import zmq | |||||
| from .Config import xpub_url, xsub_url | |||||
| from .DebugLog import Debug, Error | from .DebugLog import Debug, Error | ||||
| from .Config import xsub_url, xpub_url | |||||
| class ActorConnector: | class ActorConnector: | ||||
| @@ -1,8 +1,9 @@ | |||||
| import threading | |||||
| import time | import time | ||||
| import zmq | import zmq | ||||
| import threading | |||||
| from autogencap.Config import xpub_url, xsub_url | |||||
| from autogencap.DebugLog import Debug, Info, Warn | from autogencap.DebugLog import Debug, Info, Warn | ||||
| from autogencap.Config import xsub_url, xpub_url | |||||
| class Broker: | class Broker: | ||||
| @@ -1,6 +1,7 @@ | |||||
| import threading | |||||
| import datetime | import datetime | ||||
| from autogencap.Config import LOG_LEVEL, IGNORED_LOG_CONTEXTS | |||||
| import threading | |||||
| from autogencap.Config import IGNORED_LOG_CONTEXTS, LOG_LEVEL | |||||
| from termcolor import colored | from termcolor import colored | ||||
| # Define log levels as constants | # Define log levels as constants | ||||
| @@ -1,13 +1,14 @@ | |||||
| from autogencap.Constants import Directory_Svc_Topic | |||||
| from autogencap.Config import xpub_url, xsub_url | |||||
| from autogencap.DebugLog import Debug, Info, Error | |||||
| from autogencap.ActorConnector import ActorConnector | |||||
| from autogencap.Actor import Actor | |||||
| from autogencap.proto.CAP_pb2 import ActorRegistration, ActorInfo, ActorLookup, ActorLookupResponse, Ping, Pong | |||||
| import zmq | |||||
| import threading | import threading | ||||
| import time | import time | ||||
| import zmq | |||||
| from autogencap.Actor import Actor | |||||
| from autogencap.ActorConnector import ActorConnector | |||||
| from autogencap.Config import xpub_url, xsub_url | |||||
| from autogencap.Constants import Directory_Svc_Topic | |||||
| from autogencap.DebugLog import Debug, Error, Info | |||||
| from autogencap.proto.CAP_pb2 import ActorInfo, ActorLookup, ActorLookupResponse, ActorRegistration, Ping, Pong | |||||
| # TODO (Future DirectorySv PR) use actor description, network_id, other properties to make directory | # TODO (Future DirectorySv PR) use actor description, network_id, other properties to make directory | ||||
| # service more generic and powerful | # service more generic and powerful | ||||
| @@ -1,12 +1,14 @@ | |||||
| import time | |||||
| import zmq | import zmq | ||||
| from .DebugLog import Debug, Warn | |||||
| from .Actor import Actor | |||||
| from .ActorConnector import ActorConnector | from .ActorConnector import ActorConnector | ||||
| from .Broker import Broker | from .Broker import Broker | ||||
| from .DirectorySvc import DirectorySvc | |||||
| from .Constants import Termination_Topic | from .Constants import Termination_Topic | ||||
| from .Actor import Actor | |||||
| from .DebugLog import Debug, Warn | |||||
| from .DirectorySvc import DirectorySvc | |||||
| from .proto.CAP_pb2 import ActorInfo | from .proto.CAP_pb2 import ActorInfo | ||||
| import time | |||||
| # TODO: remove time import | # TODO: remove time import | ||||
| @@ -1,8 +1,10 @@ | |||||
| import time | import time | ||||
| from typing import Callable, Dict, List, Optional, Union | from typing import Callable, Dict, List, Optional, Union | ||||
| from autogen import Agent, ConversableAgent | from autogen import Agent, ConversableAgent | ||||
| from .AutoGenConnector import AutoGenConnector | |||||
| from ..LocalActorNetwork import LocalActorNetwork | from ..LocalActorNetwork import LocalActorNetwork | ||||
| from .AutoGenConnector import AutoGenConnector | |||||
| class AG2CAP(ConversableAgent): | class AG2CAP(ConversableAgent): | ||||
| @@ -1,5 +1,7 @@ | |||||
| from typing import Dict, Optional, Union | from typing import Dict, Optional, Union | ||||
| from autogen import Agent | from autogen import Agent | ||||
| from ..ActorConnector import ActorConnector | from ..ActorConnector import ActorConnector | ||||
| from ..proto.Autogen_pb2 import GenReplyReq, GenReplyResp, PrepChat, ReceiveReq, Terminate | from ..proto.Autogen_pb2 import GenReplyReq, GenReplyResp, PrepChat, ReceiveReq, Terminate | ||||
| @@ -1,11 +1,13 @@ | |||||
| from enum import Enum | from enum import Enum | ||||
| from typing import Optional | from typing import Optional | ||||
| from autogen import ConversableAgent | |||||
| from ..DebugLog import Debug, Error, Info, Warn, shorten | from ..DebugLog import Debug, Error, Info, Warn, shorten | ||||
| from ..LocalActorNetwork import LocalActorNetwork | from ..LocalActorNetwork import LocalActorNetwork | ||||
| from ..proto.Autogen_pb2 import GenReplyReq, GenReplyResp, PrepChat, ReceiveReq, Terminate | from ..proto.Autogen_pb2 import GenReplyReq, GenReplyResp, PrepChat, ReceiveReq, Terminate | ||||
| from .AGActor import AGActor | |||||
| from .AG2CAP import AG2CAP | from .AG2CAP import AG2CAP | ||||
| from autogen import ConversableAgent | |||||
| from .AGActor import AGActor | |||||
| class CAP2AG(AGActor): | class CAP2AG(AGActor): | ||||
| @@ -1,8 +1,10 @@ | |||||
| from autogen import Agent, AssistantAgent, GroupChat | |||||
| from typing import List | |||||
| from autogencap.ag_adapter.AG2CAP import AG2CAP | from autogencap.ag_adapter.AG2CAP import AG2CAP | ||||
| from autogencap.ag_adapter.CAP2AG import CAP2AG | from autogencap.ag_adapter.CAP2AG import CAP2AG | ||||
| from autogencap.LocalActorNetwork import LocalActorNetwork | from autogencap.LocalActorNetwork import LocalActorNetwork | ||||
| from typing import List | |||||
| from autogen import Agent, AssistantAgent, GroupChat | |||||
| class CAPGroupChat(GroupChat): | class CAPGroupChat(GroupChat): | ||||
| @@ -1,9 +1,11 @@ | |||||
| from autogen import GroupChatManager | |||||
| import time | |||||
| from autogencap.ActorConnector import ActorConnector | from autogencap.ActorConnector import ActorConnector | ||||
| from autogencap.LocalActorNetwork import LocalActorNetwork | |||||
| from autogencap.ag_adapter.CAP2AG import CAP2AG | from autogencap.ag_adapter.CAP2AG import CAP2AG | ||||
| from autogencap.ag_adapter.CAPGroupChat import CAPGroupChat | from autogencap.ag_adapter.CAPGroupChat import CAPGroupChat | ||||
| import time | |||||
| from autogencap.LocalActorNetwork import LocalActorNetwork | |||||
| from autogen import GroupChatManager | |||||
| class CAPGroupChatManager: | class CAPGroupChatManager: | ||||
| @@ -1,7 +1,11 @@ | |||||
| from google.protobuf.internal import containers as _containers | |||||
| from typing import ClassVar as _ClassVar | |||||
| from typing import Mapping as _Mapping | |||||
| from typing import Optional as _Optional | |||||
| from typing import Union as _Union | |||||
| from google.protobuf import descriptor as _descriptor | from google.protobuf import descriptor as _descriptor | ||||
| from google.protobuf import message as _message | from google.protobuf import message as _message | ||||
| from typing import ClassVar as _ClassVar, Mapping as _Mapping, Optional as _Optional, Union as _Union | |||||
| from google.protobuf.internal import containers as _containers | |||||
| DESCRIPTOR: _descriptor.FileDescriptor | DESCRIPTOR: _descriptor.FileDescriptor | ||||
| @@ -1,13 +1,12 @@ | |||||
| from google.protobuf.internal import containers as _containers | |||||
| from typing import ClassVar as _ClassVar | |||||
| from typing import Iterable as _Iterable | |||||
| from typing import Mapping as _Mapping | |||||
| from typing import Optional as _Optional | |||||
| from typing import Union as _Union | |||||
| from google.protobuf import descriptor as _descriptor | from google.protobuf import descriptor as _descriptor | ||||
| from google.protobuf import message as _message | from google.protobuf import message as _message | ||||
| from typing import ( | |||||
| ClassVar as _ClassVar, | |||||
| Iterable as _Iterable, | |||||
| Mapping as _Mapping, | |||||
| Optional as _Optional, | |||||
| Union as _Union, | |||||
| ) | |||||
| from google.protobuf.internal import containers as _containers | |||||
| DESCRIPTOR: _descriptor.FileDescriptor | DESCRIPTOR: _descriptor.FileDescriptor | ||||
| @@ -1,4 +1,4 @@ | |||||
| from setuptools import setup, find_packages | |||||
| from setuptools import find_packages, setup | |||||
| setup( | setup( | ||||
| name="autogencap", | name="autogencap", | ||||
| @@ -3,16 +3,17 @@ Demo App | |||||
| """ | """ | ||||
| import argparse | import argparse | ||||
| import _paths | import _paths | ||||
| from autogencap.Config import LOG_LEVEL, IGNORED_LOG_CONTEXTS | |||||
| import autogencap.DebugLog as DebugLog | import autogencap.DebugLog as DebugLog | ||||
| from SimpleActorDemo import simple_actor_demo | |||||
| from AGDemo import ag_demo | from AGDemo import ag_demo | ||||
| from AGGroupChatDemo import ag_groupchat_demo | from AGGroupChatDemo import ag_groupchat_demo | ||||
| from autogencap.Config import IGNORED_LOG_CONTEXTS, LOG_LEVEL | |||||
| from CAPAutGenGroupDemo import cap_ag_group_demo | from CAPAutGenGroupDemo import cap_ag_group_demo | ||||
| from CAPAutoGenPairDemo import cap_ag_pair_demo | from CAPAutoGenPairDemo import cap_ag_pair_demo | ||||
| from ComplexActorDemo import complex_actor_demo | from ComplexActorDemo import complex_actor_demo | ||||
| from RemoteAGDemo import remote_ag_demo | from RemoteAGDemo import remote_ag_demo | ||||
| from SimpleActorDemo import simple_actor_demo | |||||
| #################################################################################################### | #################################################################################################### | ||||
| @@ -4,10 +4,10 @@ Each agent represents a different role and knows how to connect to external syst | |||||
| to retrieve information. | to retrieve information. | ||||
| """ | """ | ||||
| from autogencap.Actor import Actor | |||||
| from autogencap.ActorConnector import ActorConnector | |||||
| from autogencap.DebugLog import Debug, Info, shorten | from autogencap.DebugLog import Debug, Info, shorten | ||||
| from autogencap.LocalActorNetwork import LocalActorNetwork | from autogencap.LocalActorNetwork import LocalActorNetwork | ||||
| from autogencap.ActorConnector import ActorConnector | |||||
| from autogencap.Actor import Actor | |||||
| class GreeterAgent(Actor): | class GreeterAgent(Actor): | ||||
| @@ -1,8 +1,9 @@ | |||||
| from autogen import AssistantAgent, UserProxyAgent, config_list_from_json | |||||
| from autogencap.DebugLog import Info | |||||
| from autogencap.LocalActorNetwork import LocalActorNetwork | |||||
| from autogencap.ag_adapter.CAPGroupChat import CAPGroupChat | from autogencap.ag_adapter.CAPGroupChat import CAPGroupChat | ||||
| from autogencap.ag_adapter.CAPGroupChatManager import CAPGroupChatManager | from autogencap.ag_adapter.CAPGroupChatManager import CAPGroupChatManager | ||||
| from autogencap.DebugLog import Info | |||||
| from autogencap.LocalActorNetwork import LocalActorNetwork | |||||
| from autogen import AssistantAgent, UserProxyAgent, config_list_from_json | |||||
| def cap_ag_group_demo(): | def cap_ag_group_demo(): | ||||
| @@ -1,9 +1,11 @@ | |||||
| import time | import time | ||||
| from autogen import AssistantAgent, UserProxyAgent, config_list_from_json | |||||
| from autogencap.DebugLog import Info | |||||
| from autogencap.ag_adapter.CAPPair import CAPPair | from autogencap.ag_adapter.CAPPair import CAPPair | ||||
| from autogencap.DebugLog import Info | |||||
| from autogencap.LocalActorNetwork import LocalActorNetwork | from autogencap.LocalActorNetwork import LocalActorNetwork | ||||
| from autogen import AssistantAgent, UserProxyAgent, config_list_from_json | |||||
| def cap_ag_pair_demo(): | def cap_ag_pair_demo(): | ||||
| config_list = config_list_from_json(env_or_file="OAI_CONFIG_LIST") | config_list = config_list_from_json(env_or_file="OAI_CONFIG_LIST") | ||||
| @@ -1,7 +1,8 @@ | |||||
| import time | import time | ||||
| from termcolor import colored | |||||
| from autogencap.LocalActorNetwork import LocalActorNetwork | |||||
| from AppAgents import FidelityAgent, FinancialPlannerAgent, PersonalAssistant, QuantAgent, RiskManager | from AppAgents import FidelityAgent, FinancialPlannerAgent, PersonalAssistant, QuantAgent, RiskManager | ||||
| from autogencap.LocalActorNetwork import LocalActorNetwork | |||||
| from termcolor import colored | |||||
| def complex_actor_demo(): | def complex_actor_demo(): | ||||
| @@ -1,4 +1,5 @@ | |||||
| import time | import time | ||||
| from AppAgents import GreeterAgent | from AppAgents import GreeterAgent | ||||
| from autogencap.LocalActorNetwork import LocalActorNetwork | from autogencap.LocalActorNetwork import LocalActorNetwork | ||||
| @@ -1,7 +1,7 @@ | |||||
| # Add autogencap to system path in case autogencap is not pip installed | # Add autogencap to system path in case autogencap is not pip installed | ||||
| # Since this library has not been published to PyPi, it is not easy to install using pip | # Since this library has not been published to PyPi, it is not easy to install using pip | ||||
| import sys | |||||
| import os | import os | ||||
| import sys | |||||
| absparent = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) | absparent = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) | ||||
| sys.path.append(absparent) | sys.path.append(absparent) | ||||
| @@ -1,9 +1,11 @@ | |||||
| import time | import time | ||||
| import _paths | import _paths | ||||
| from autogen import AssistantAgent, config_list_from_json | |||||
| from autogencap.ag_adapter.CAP2AG import CAP2AG | |||||
| from autogencap.DebugLog import Info | from autogencap.DebugLog import Info | ||||
| from autogencap.LocalActorNetwork import LocalActorNetwork | from autogencap.LocalActorNetwork import LocalActorNetwork | ||||
| from autogencap.ag_adapter.CAP2AG import CAP2AG | |||||
| from autogen import AssistantAgent, config_list_from_json | |||||
| # Starts the Broker and the Assistant. The UserProxy is started separately. | # Starts the Broker and the Assistant. The UserProxy is started separately. | ||||
| @@ -1,10 +1,12 @@ | |||||
| import time | import time | ||||
| import _paths | import _paths | ||||
| from autogen import UserProxyAgent, config_list_from_json | |||||
| from autogencap.DebugLog import Info | |||||
| from autogencap.LocalActorNetwork import LocalActorNetwork | |||||
| from autogencap.ag_adapter.CAP2AG import CAP2AG | from autogencap.ag_adapter.CAP2AG import CAP2AG | ||||
| from autogencap.Config import IGNORED_LOG_CONTEXTS | from autogencap.Config import IGNORED_LOG_CONTEXTS | ||||
| from autogencap.DebugLog import Info | |||||
| from autogencap.LocalActorNetwork import LocalActorNetwork | |||||
| from autogen import UserProxyAgent, config_list_from_json | |||||
| # Starts the Broker and the Assistant. The UserProxy is started separately. | # Starts the Broker and the Assistant. The UserProxy is started separately. | ||||
| @@ -1,7 +1,7 @@ | |||||
| # Add autogencap to system path in case autogencap is not pip installed | # Add autogencap to system path in case autogencap is not pip installed | ||||
| # Since this library has not been published to PyPi, it is not easy to install using pip | # Since this library has not been published to PyPi, it is not easy to install using pip | ||||
| import sys | |||||
| import os | import os | ||||
| import sys | |||||
| absparent = os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")) | absparent = os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")) | ||||
| sys.path.append(absparent) | sys.path.append(absparent) | ||||
| @@ -1,4 +1,4 @@ | |||||
| from autogen import UserProxyAgent, ConversableAgent, config_list_from_json | |||||
| from autogen import ConversableAgent, UserProxyAgent, config_list_from_json | |||||
| def main(): | def main(): | ||||
| @@ -1,8 +1,9 @@ | |||||
| import sys | import sys | ||||
| from .version import __version__ | |||||
| from .run_cmd import run_cli | |||||
| from .clone_cmd import clone_cli | from .clone_cmd import clone_cli | ||||
| from .run_cmd import run_cli | |||||
| from .tabulate_cmd import tabulate_cli | from .tabulate_cmd import tabulate_cli | ||||
| from .version import __version__ | |||||
| def main(args=None): | def main(args=None): | ||||
| @@ -1,7 +1,9 @@ | |||||
| import os | |||||
| import json | |||||
| import argparse | import argparse | ||||
| import json | |||||
| import os | |||||
| import requests | import requests | ||||
| from .load_module import load_module | from .load_module import load_module | ||||
| # Figure out where everything is | # Figure out where everything is | ||||
| @@ -1,6 +1,6 @@ | |||||
| import importlib.util | |||||
| import os | import os | ||||
| import sys | import sys | ||||
| import importlib.util | |||||
| def load_module(module_path): | def load_module(module_path): | ||||
| @@ -1,16 +1,19 @@ | |||||
| import os | |||||
| import argparse | |||||
| import errno | import errno | ||||
| import json | |||||
| import os | |||||
| import pathlib | |||||
| import random | |||||
| import shutil | import shutil | ||||
| import subprocess | import subprocess | ||||
| import json | |||||
| import sys | import sys | ||||
| import time | import time | ||||
| import pathlib | |||||
| import argparse | |||||
| import docker | import docker | ||||
| import random | |||||
| from autogen import config_list_from_json | from autogen import config_list_from_json | ||||
| from autogen.oai.openai_utils import filter_config | from autogen.oai.openai_utils import filter_config | ||||
| from .version import __version__ | from .version import __version__ | ||||
| # Figure out where everything is | # Figure out where everything is | ||||
| @@ -1,7 +1,9 @@ | |||||
| import argparse | |||||
| import os | import os | ||||
| import sys | import sys | ||||
| import argparse | |||||
| import tabulate as tb | import tabulate as tb | ||||
| from .load_module import load_module | from .load_module import load_module | ||||
| # Figure out where everything is | # Figure out where everything is | ||||
| @@ -1,8 +1,10 @@ | |||||
| from pkg_resources import packaging | |||||
| from datetime import datetime | |||||
| import json | |||||
| import os | import os | ||||
| from datetime import datetime | |||||
| from pkg_resources import packaging | |||||
| import autogen | import autogen | ||||
| import json | |||||
| AUTOGEN_VERSION = packaging.version.parse(autogen.__version__) | AUTOGEN_VERSION = packaging.version.parse(autogen.__version__) | ||||
| @@ -1,5 +1,6 @@ | |||||
| import os | import os | ||||
| import sys | import sys | ||||
| from autogenbench.tabulate_cmd import default_tabulate | from autogenbench.tabulate_cmd import default_tabulate | ||||
| @@ -3,12 +3,13 @@ | |||||
| # (default: ../scenarios/human_eval_two_agents_gpt4.jsonl and ./scenarios/human_eval_two_agents_gpt35.jsonl) | # (default: ../scenarios/human_eval_two_agents_gpt4.jsonl and ./scenarios/human_eval_two_agents_gpt35.jsonl) | ||||
| # | # | ||||
| import base64 | |||||
| import glob | |||||
| import json | import json | ||||
| import os | import os | ||||
| import sys | |||||
| import glob | |||||
| import base64 | |||||
| import re | import re | ||||
| import sys | |||||
| from huggingface_hub import snapshot_download | from huggingface_hub import snapshot_download | ||||
| SCRIPT_PATH = os.path.realpath(__file__) | SCRIPT_PATH = os.path.realpath(__file__) | ||||
| @@ -2,11 +2,11 @@ | |||||
| # ruff: noqa: F821 | # ruff: noqa: F821 | ||||
| import glob | import glob | ||||
| import json | |||||
| import os | import os | ||||
| import shutil | |||||
| import subprocess | import subprocess | ||||
| import sys | import sys | ||||
| import shutil | |||||
| import json | |||||
| def scoring(content: str, should_contain: list, should_not_contain: list): | def scoring(content: str, should_contain: list, should_not_contain: list): | ||||
| @@ -2,9 +2,11 @@ | |||||
| # ruff: noqa: E722 | # ruff: noqa: E722 | ||||
| import traceback | import traceback | ||||
| from autogen import AssistantAgent, UserProxyAgent, config_list_from_json | |||||
| import testbed_utils | import testbed_utils | ||||
| from autogen import AssistantAgent, UserProxyAgent, config_list_from_json | |||||
| # Assistant agent can call check.py to check if all the unit tests have passed | # Assistant agent can call check.py to check if all the unit tests have passed | ||||
| testbed_utils.init() | testbed_utils.init() | ||||
| @@ -1,8 +1,10 @@ | |||||
| import os | |||||
| import json | import json | ||||
| import autogen | |||||
| import os | |||||
| import testbed_utils | import testbed_utils | ||||
| import autogen | |||||
| testbed_utils.init() | testbed_utils.init() | ||||
| ############################## | ############################## | ||||
| @@ -1,8 +1,10 @@ | |||||
| import os | |||||
| import json | import json | ||||
| import autogen | |||||
| import os | |||||
| import testbed_utils | import testbed_utils | ||||
| import autogen | |||||
| testbed_utils.init() | testbed_utils.init() | ||||
| ############################## | ############################## | ||||