Skip to content

Commit

Permalink
isort
Browse files Browse the repository at this point in the history
  • Loading branch information
aflament committed May 30, 2024
1 parent b1741a5 commit 1dfc55f
Show file tree
Hide file tree
Showing 60 changed files with 111 additions and 121 deletions.
10 changes: 3 additions & 7 deletions council/agent_tests/agent_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@

import time
from enum import Enum
from typing import List, Dict, Any, Sequence, Optional
import progressbar # type: ignore
from typing import Any, Dict, List, Optional, Sequence

import progressbar # type: ignore
from council.agents import Agent
from council.contexts import AgentContext, Budget, ScorerContext
from council.scorers import ScorerBase, ScorerException
from council.contexts import (
AgentContext,
Budget,
ScorerContext,
)


class AgentTestCaseOutcome(str, Enum):
Expand Down
1 change: 1 addition & 0 deletions council/agents/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from council.filters import BasicFilter, FilterBase
from council.runners import new_runner_executor
from council.skills import SkillBase

from .agent_result import AgentResult


Expand Down
1 change: 1 addition & 0 deletions council/agents/agent_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from council.chains import ChainBase
from council.contexts import AgentContext, ChainContext, ChatMessage, Monitored
from council.runners import RunnerExecutor

from .agent import Agent


Expand Down
2 changes: 1 addition & 1 deletion council/agents/agent_result.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from collections.abc import Sequence
from typing import List, Optional

from council.contexts import ScoredChatMessage, ChatMessage
from council.contexts import ChatMessage, ScoredChatMessage
from council.utils import Option


Expand Down
1 change: 1 addition & 0 deletions council/contexts/_chat_history.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import annotations

from ._message_list import MessageList


Expand Down
3 changes: 2 additions & 1 deletion council/contexts/_execution_context.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from __future__ import annotations

from typing import Optional

from ._monitorable import Monitorable
from ._execution_log import ExecutionLog
from ._execution_log_entry import ExecutionLogEntry
from ._monitorable import Monitorable
from ._monitored import Monitored


Expand Down
2 changes: 1 addition & 1 deletion council/contexts/_execution_log.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import json
from typing import Any, Dict, List, Optional

from ._monitorable import Monitorable
from ._execution_log_entry import ExecutionLogEntry
from ._monitorable import Monitorable


class ExecutionLog:
Expand Down
2 changes: 1 addition & 1 deletion council/contexts/_execution_log_entry.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from datetime import datetime, timezone
from typing import Any, Dict, List, Optional, Sequence, Tuple

from ._monitorable import Monitorable
from ._budget import Consumption
from ._chat_message import ChatMessage
from ._monitorable import Monitorable


class ExecutionLogEntry:
Expand Down
1 change: 1 addition & 0 deletions council/contexts/_llm_context.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import annotations

from typing import Optional

from ._agent_context_store import AgentContextStore
Expand Down
2 changes: 1 addition & 1 deletion council/contexts/_message_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from more_itertools import first
from typing_extensions import TypeGuard

from ._chat_message import ChatMessage, ChatMessageKind
from ..utils import Option
from ._chat_message import ChatMessage, ChatMessageKind


class MessageCollection(abc.ABC):
Expand Down
1 change: 1 addition & 0 deletions council/contexts/_monitor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import annotations

from typing import Any, Dict, List, Mapping


Expand Down
1 change: 1 addition & 0 deletions council/contexts/_monitorable.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import annotations

import json
from typing import Any, Dict, Iterable, List, TypeVar

Expand Down
1 change: 1 addition & 0 deletions council/contexts/_skill_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Any, Iterable

from council.utils import Option

from ._agent_context_store import AgentContextStore
from ._budget import Budget
from ._chain_context import ChainContext
Expand Down
3 changes: 2 additions & 1 deletion council/controllers/basic_controller.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from typing import List, Sequence

from council.contexts import AgentContext

from ..chains import ChainBase
from .controller_base import ControllerBase
from .execution_unit import ExecutionUnit
from ..chains import ChainBase


class BasicController(ControllerBase):
Expand Down
3 changes: 2 additions & 1 deletion council/controllers/controller_base.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from abc import ABC, abstractmethod
from typing import List, Sequence, Optional
from typing import List, Optional, Sequence

from council.chains import ChainBase
from council.contexts import AgentContext, Monitorable

from .execution_unit import ExecutionUnit


Expand Down
7 changes: 4 additions & 3 deletions council/controllers/llm_controller.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from typing import List, Optional, Sequence, Tuple
from typing_extensions import TypeGuard

from council.chains import ChainBase
from council.contexts import AgentContext, ChatMessage, ContextBase
from council.controllers import ControllerBase, ControllerException
from council.llm import LLMBase, LLMMessage, MonitoredLLM
from council.llm.llm_answer import LLMAnswer, LLMParsingException, llm_class_validator, llm_property
from council.utils import Option
from council.controllers import ControllerBase, ControllerException
from typing_extensions import TypeGuard

from .execution_unit import ExecutionUnit
from council.llm.llm_answer import llm_property, LLMAnswer, LLMParsingException, llm_class_validator


class Specialist:
Expand Down
7 changes: 2 additions & 5 deletions council/evaluators/basic_evaluator.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
from typing import List

from council.contexts import (
AgentContext,
ScoredChatMessage,
ChatMessage,
)
from council.contexts import AgentContext, ChatMessage, ScoredChatMessage

from .evaluator_base import EvaluatorBase


Expand Down
4 changes: 2 additions & 2 deletions council/evaluators/llm_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

from typing import List, Optional

from council.contexts import AgentContext, ChatMessage, ScoredChatMessage, ContextBase
from council.contexts import AgentContext, ChatMessage, ContextBase, ScoredChatMessage
from council.evaluators import EvaluatorBase, EvaluatorException
from council.llm import LLMBase, MonitoredLLM, llm_property, LLMAnswer, LLMMessage
from council.llm import LLMAnswer, LLMBase, LLMMessage, MonitoredLLM, llm_property
from council.llm.llm_answer import LLMParsingException, llm_class_validator
from council.utils import Option

Expand Down
4 changes: 2 additions & 2 deletions council/filters/llm_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

from typing import List, Optional

from council.contexts import AgentContext, ScoredChatMessage, ContextBase
from council.contexts import AgentContext, ContextBase, ScoredChatMessage
from council.filters import FilterBase, FilterException
from council.llm import LLMBase, MonitoredLLM, llm_property, LLMAnswer, LLMMessage
from council.llm import LLMAnswer, LLMBase, LLMMessage, MonitoredLLM, llm_property
from council.llm.llm_answer import LLMParsingException
from council.utils import Option

Expand Down
2 changes: 1 addition & 1 deletion council/llm/anthropic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import abc
from abc import ABC
from typing import Sequence, List
from typing import List, Sequence

from council.llm import LLMMessage

Expand Down
3 changes: 1 addition & 2 deletions council/llm/anthropic_completion_llm.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from typing import Sequence, List
from typing import List, Sequence

from anthropic import Anthropic
from anthropic._types import NOT_GIVEN

from council.llm import AnthropicLLMConfiguration, LLMMessage, LLMMessageRole
from council.llm.anthropic import AnthropicAPIClientWrapper

Expand Down
19 changes: 9 additions & 10 deletions council/llm/anthropic_llm.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
from __future__ import annotations

from typing import Any, Sequence, Optional, List
from typing import Any, List, Optional, Sequence

from anthropic import Anthropic, APITimeoutError, APIStatusError

from council.contexts import LLMContext, Consumption
from anthropic import Anthropic, APIStatusError, APITimeoutError
from council.contexts import Consumption, LLMContext
from council.llm import (
AnthropicLLMConfiguration,
LLMBase,
LLMMessage,
LLMResult,
LLMCallTimeoutException,
LLMCallException,
AnthropicLLMConfiguration,
LLMessageTokenCounterBase,
LLMCallTimeoutException,
LLMConfigObject,
LLMessageTokenCounterBase,
LLMMessage,
LLMProviders,
LLMResult,
)
from .anthropic import AnthropicAPIClientWrapper

from .anthropic import AnthropicAPIClientWrapper
from .anthropic_completion_llm import AnthropicCompletionLLM
from .anthropic_messages_llm import AnthropicMessagesLLM

Expand Down
4 changes: 2 additions & 2 deletions council/llm/anthropic_llm_configuration.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from __future__ import annotations

from typing import Optional, Any
from typing import Any, Optional

from council.llm import LLMConfigSpec
from council.utils import read_env_str, Parameter, read_env_int, greater_than_validator, prefix_validator
from council.llm.llm_configuration_base import _DEFAULT_TIMEOUT
from council.utils import Parameter, greater_than_validator, prefix_validator, read_env_int, read_env_str

_env_var_prefix = "ANTHROPIC_"

Expand Down
9 changes: 2 additions & 7 deletions council/llm/anthropic_messages_llm.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
from __future__ import annotations

from typing import Sequence, List, Iterable, Literal
from typing import Iterable, List, Literal, Sequence

from anthropic import Anthropic
from anthropic._types import NOT_GIVEN
from anthropic.types import MessageParam

from council.llm import (
LLMMessage,
LLMMessageRole,
AnthropicLLMConfiguration,
)
from council.llm import AnthropicLLMConfiguration, LLMMessage, LLMMessageRole
from council.llm.anthropic import AnthropicAPIClientWrapper


Expand Down
5 changes: 3 additions & 2 deletions council/llm/azure_llm.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from __future__ import annotations

from typing import Any, Optional

import httpx
from httpx import TimeoutException, HTTPStatusError
from httpx import HTTPStatusError, TimeoutException

from . import OpenAIChatCompletionsModel, LLMCallTimeoutException, LLMCallException
from . import LLMCallException, LLMCallTimeoutException, OpenAIChatCompletionsModel
from .azure_llm_configuration import AzureLLMConfiguration
from .llm_config_object import LLMConfigObject, LLMProviders

Expand Down
3 changes: 2 additions & 1 deletion council/llm/azure_llm_configuration.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from __future__ import annotations

from typing import Optional

from council.llm import LLMConfigurationBase
from council.llm.llm_config_object import LLMConfigSpec
from council.utils import Parameter, read_env_str, greater_than_validator, not_empty_validator
from council.llm.llm_configuration_base import _DEFAULT_TIMEOUT
from council.utils import Parameter, greater_than_validator, not_empty_validator, read_env_str

_env_var_prefix = "AZURE_"

Expand Down
1 change: 0 additions & 1 deletion council/llm/llm_answer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from typing import Any, Callable, Dict, List, Optional

import yaml

from council.utils import CodeParser


Expand Down
1 change: 0 additions & 1 deletion council/llm/llm_config_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import Any, Dict, Optional

import yaml

from council.utils import DataObject, DataObjectSpecBase
from council.utils.parameter import Undefined

Expand Down
10 changes: 5 additions & 5 deletions council/llm/openai_chat_completions_llm.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from __future__ import annotations

import httpx
from typing import Any, List, Optional, Protocol, Sequence

from typing import List, Any, Protocol, Sequence, Optional
import httpx
from council.contexts import Consumption, LLMContext

from . import LLMConfigurationBase
from .llm_message import LLMMessage, LLMessageTokenCounterBase
from .llm_exception import LLMCallException
from .llm_base import LLMBase, LLMResult
from council.contexts import LLMContext, Consumption
from .llm_exception import LLMCallException
from .llm_message import LLMessageTokenCounterBase, LLMMessage


class Provider(Protocol):
Expand Down
10 changes: 3 additions & 7 deletions council/llm/openai_llm.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
from __future__ import annotations

from typing import Any, Optional

import httpx
from httpx import TimeoutException, HTTPStatusError
from httpx import HTTPStatusError, TimeoutException

from . import (
OpenAIChatCompletionsModel,
OpenAITokenCounter,
LLMCallTimeoutException,
LLMCallException,
)
from . import LLMCallException, LLMCallTimeoutException, OpenAIChatCompletionsModel, OpenAITokenCounter
from .llm_config_object import LLMConfigObject, LLMProviders
from .openai_llm_configuration import OpenAILLMConfiguration

Expand Down
9 changes: 2 additions & 7 deletions council/llm/openai_llm_configuration.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
from __future__ import annotations

from typing import Any, Optional

from council.llm import LLMConfigurationBase
from council.llm.llm_config_object import LLMConfigSpec
from council.utils import (
read_env_str,
read_env_int,
Parameter,
greater_than_validator,
prefix_validator,
)
from council.llm.llm_configuration_base import _DEFAULT_TIMEOUT
from council.utils import Parameter, greater_than_validator, prefix_validator, read_env_int, read_env_str

_env_var_prefix = "OPENAI_"

Expand Down
7 changes: 4 additions & 3 deletions council/llm/openai_token_counter.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from __future__ import annotations
import logging
import tiktoken

import logging
from typing import List, Optional, Sequence

import tiktoken
from tiktoken import Encoding

from . import LLMMessage, LLMessageTokenCounterBase, LLMTokenLimitException
from . import LLMessageTokenCounterBase, LLMMessage, LLMTokenLimitException

logger = logging.getLogger(__name__)

Expand Down
Loading

0 comments on commit 1dfc55f

Please sign in to comment.