Rename modules (#45)

This commit is contained in:
Jack Gerrits 2024-06-04 10:00:05 -04:00 committed by GitHub
parent 805707c89a
commit c0143069f4
46 changed files with 60 additions and 60 deletions

View File

@ -3,8 +3,8 @@
## Package layering
- `core` are the the foundational generic interfaces upon which all else is built. This module must not depend on any other module.
- `agent_components` are the building blocks for creating single agents
- `application_components` are implementations of core components that are used to compose an application
- `components` are the building blocks for creating single agents
- `application` are implementations of core components that are used to compose an application
- `chat` is the concrete implementation of multi-agent interactions. Most users will deal with this module.

View File

@ -15,7 +15,7 @@ pip install azure-identity
## Using the Model Client
```python
from agnext.agent_components.model_client import AzureOpenAI
from agnext.components.model_client import AzureOpenAI
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
# Create the token provider

View File

@ -18,7 +18,7 @@ agnext
:caption: Reference
:hidden:
reference/agnext.agent_components
reference/agnext.application_components
reference/agnext.components
reference/agnext.application
reference/agnext.chat
reference/agnext.core

View File

@ -1,8 +1,8 @@
import asyncio
from dataclasses import dataclass
from agnext.agent_components.type_routed_agent import TypeRoutedAgent, message_handler
from agnext.application_components import SingleThreadedAgentRuntime
from agnext.application import SingleThreadedAgentRuntime
from agnext.components.type_routed_agent import TypeRoutedAgent, message_handler
from agnext.core import Agent, AgentRuntime, CancellationToken

View File

@ -6,18 +6,18 @@ import os
from typing import Annotated, Callable
import openai
from agnext.agent_components.function_executor._impl.in_process_function_executor import (
InProcessFunctionExecutor,
)
from agnext.agent_components.model_client import OpenAI
from agnext.agent_components.types import SystemMessage
from agnext.application_components import (
from agnext.application import (
SingleThreadedAgentRuntime,
)
from agnext.chat.agents.chat_completion_agent import ChatCompletionAgent
from agnext.chat.agents.oai_assistant import OpenAIAssistantAgent
from agnext.chat.patterns.orchestrator_chat import OrchestratorChat
from agnext.chat.types import TextMessage
from agnext.components.function_executor._impl.in_process_function_executor import (
InProcessFunctionExecutor,
)
from agnext.components.model_client import OpenAI
from agnext.components.types import SystemMessage
from agnext.core import Agent, AgentRuntime
from agnext.core.intervention import DefaultInterventionHandler, DropMessage
from tavily import TavilyClient

View File

@ -1,3 +0,0 @@
"""
The :mod:`agnext.agent_components` module provides building blocks for creating single agents
"""

View File

@ -0,0 +1,7 @@
"""
The :mod:`agnext.application` module provides implementations of core components that are used to compose an application
"""
from ._single_threaded_agent_runtime import SingleThreadedAgentRuntime
__all__ = ["SingleThreadedAgentRuntime"]

View File

@ -14,7 +14,7 @@ class LLMCallEvent:
.. code-block:: python
from agnext.application_components.logging import LLMCallEvent, EVENT_LOGGER_NAME
from agnext.application.logging import LLMCallEvent, EVENT_LOGGER_NAME
logger = logging.getLogger(EVENT_LOGGER_NAME)
logger.info(LLMCallEvent(prompt_tokens=10, completion_tokens=20))

View File

@ -11,7 +11,7 @@ class LLMUsageTracker(logging.Handler):
.. code-block:: python
from agnext.application_components.logging import LLMUsageTracker, EVENT_LOGGER_NAME
from agnext.application.logging import LLMUsageTracker, EVENT_LOGGER_NAME
# Set up the logging configuration to use the custom handler
logger = logging.getLogger(EVENT_LOGGER_NAME)

View File

@ -1,7 +0,0 @@
"""
The :mod:`agnext.application_components` module provides implementations of core components that are used to compose an application
"""
from ._single_threaded_agent_runtime import SingleThreadedAgentRuntime
__all__ = ["SingleThreadedAgentRuntime"]

View File

@ -2,14 +2,6 @@ import asyncio
import json
from typing import Any, Coroutine, Dict, List, Mapping, Tuple
from agnext.agent_components.function_executor import FunctionExecutor
from agnext.agent_components.model_client import ModelClient
from agnext.agent_components.type_routed_agent import TypeRoutedAgent, message_handler
from agnext.agent_components.types import (
FunctionCall,
FunctionSignature,
SystemMessage,
)
from agnext.chat.agents.base import BaseChatAgent
from agnext.chat.types import (
FunctionCallMessage,
@ -22,6 +14,14 @@ from agnext.chat.types import (
TextMessage,
)
from agnext.chat.utils import convert_messages_to_llm_messages
from agnext.components.function_executor import FunctionExecutor
from agnext.components.model_client import ModelClient
from agnext.components.type_routed_agent import TypeRoutedAgent, message_handler
from agnext.components.types import (
FunctionCall,
FunctionSignature,
SystemMessage,
)
from agnext.core import AgentRuntime, CancellationToken

View File

@ -3,9 +3,9 @@ from typing import Any, List, Mapping
import openai
from openai.types.beta import AssistantResponseFormatParam
from agnext.agent_components.type_routed_agent import TypeRoutedAgent, message_handler
from agnext.chat.agents.base import BaseChatAgent
from agnext.chat.types import Reset, RespondNow, ResponseFormat, TextMessage
from agnext.components.type_routed_agent import TypeRoutedAgent, message_handler
from agnext.core import AgentRuntime, CancellationToken

View File

@ -1,6 +1,6 @@
from typing import Any, List, Protocol, Sequence
from ...agent_components.type_routed_agent import TypeRoutedAgent, message_handler
from ...components.type_routed_agent import TypeRoutedAgent, message_handler
from ...core import AgentRuntime, CancellationToken
from ..agents.base import BaseChatAgent
from ..types import Reset, RespondNow, TextMessage

View File

@ -1,7 +1,7 @@
import json
from typing import Any, Sequence, Tuple
from ...agent_components.type_routed_agent import TypeRoutedAgent, message_handler
from ...components.type_routed_agent import TypeRoutedAgent, message_handler
from ...core import AgentRuntime, CancellationToken
from ..agents.base import BaseChatAgent
from ..types import Reset, RespondNow, ResponseFormat, TextMessage

View File

@ -4,8 +4,8 @@ from dataclasses import dataclass, field
from enum import Enum
from typing import List, Union
from agnext.agent_components.image import Image
from agnext.agent_components.types import FunctionCall
from agnext.components.image import Image
from agnext.components.types import FunctionCall
@dataclass(kw_only=True)

View File

@ -2,17 +2,6 @@ from typing import List, Optional, Union
from typing_extensions import Literal
from agnext.agent_components.types import (
AssistantMessage,
LLMMessage,
UserMessage,
)
from agnext.agent_components.types import (
FunctionExecutionResult as FunctionExecutionResultType,
)
from agnext.agent_components.types import (
FunctionExecutionResultMessage as FunctionExecutionResultMessageType,
)
from agnext.chat.types import (
FunctionCallMessage,
FunctionExecutionResultMessage,
@ -20,6 +9,17 @@ from agnext.chat.types import (
MultiModalMessage,
TextMessage,
)
from agnext.components.types import (
AssistantMessage,
LLMMessage,
UserMessage,
)
from agnext.components.types import (
FunctionExecutionResult as FunctionExecutionResultType,
)
from agnext.components.types import (
FunctionExecutionResultMessage as FunctionExecutionResultMessageType,
)
def convert_content_message_to_assistant_message(

View File

@ -0,0 +1,3 @@
"""
The :mod:`agnext.components` module provides building blocks for creating single agents
"""

View File

@ -32,7 +32,7 @@ from openai.types.chat import (
)
from typing_extensions import Required, TypedDict, Unpack
from ...application_components.logging import EVENT_LOGGER_NAME, LLMCallEvent
from ...application.logging import EVENT_LOGGER_NAME, LLMCallEvent
# from ..._pydantic import type2schema
from ..image import Image

View File

@ -7,7 +7,7 @@ from pathlib import Path
import pytest
from agnext.agent_components.code_executor import LocalCommandLineCodeExecutor, CodeBlock
from agnext.components.code_executor import LocalCommandLineCodeExecutor, CodeBlock
UNIX_SHELLS = ["bash", "sh", "shell"]
WINDOWS_SHELLS = ["ps1", "pwsh", "powershell"]

View File

@ -5,11 +5,11 @@ import tempfile
import polars
import pytest
from agnext.agent_components.code_executor import (
from agnext.components.code_executor import (
CodeBlock,
LocalCommandLineCodeExecutor,
)
from agnext.agent_components.func_with_reqs import (
from agnext.components.func_with_reqs import (
FunctionWithRequirements,
with_requirements,
)

View File

@ -2,8 +2,8 @@ import asyncio
import pytest
from dataclasses import dataclass
from agnext.agent_components.type_routed_agent import TypeRoutedAgent, message_handler
from agnext.application_components import SingleThreadedAgentRuntime
from agnext.components.type_routed_agent import TypeRoutedAgent, message_handler
from agnext.application import SingleThreadedAgentRuntime
from agnext.core import Agent
from agnext.core import AgentRuntime
from agnext.core import CancellationToken

View File

@ -1,8 +1,8 @@
import pytest
from dataclasses import dataclass
from agnext.agent_components.type_routed_agent import TypeRoutedAgent, message_handler
from agnext.application_components import SingleThreadedAgentRuntime
from agnext.components.type_routed_agent import TypeRoutedAgent, message_handler
from agnext.application import SingleThreadedAgentRuntime
from agnext.core import Agent
from agnext.core import AgentRuntime
from agnext.core import CancellationToken

View File

@ -1,4 +1,4 @@
from agnext.application_components.logging import LLMUsageTracker, EVENT_LOGGER_NAME, LLMCallEvent
from agnext.application.logging import LLMUsageTracker, EVENT_LOGGER_NAME, LLMCallEvent
import logging

View File

@ -1,7 +1,7 @@
from typing import Any, Sequence
import pytest
from agnext.application_components import SingleThreadedAgentRuntime
from agnext.application import SingleThreadedAgentRuntime
from agnext.core import AgentRuntime
from agnext.core import BaseAgent
from agnext.core import CancellationToken

View File

@ -1,7 +1,7 @@
from typing import Any, Mapping, Sequence
import pytest
from agnext.application_components import SingleThreadedAgentRuntime
from agnext.application import SingleThreadedAgentRuntime
from agnext.core import AgentRuntime
from agnext.core import BaseAgent
from agnext.core import CancellationToken