diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d2323ee..aca8536 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: - name: Run tests run: make test env: - ENV: CI + AWE_ENV: CI format-fix: runs-on: ubuntu-latest diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index 19e3549..d5019c5 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -100,7 +100,7 @@ jobs: if: steps.version.outputs.skipped != 'true' run: make test env: - ENV: CI + AWE_ENV: CI - name: Run linting if: steps.version.outputs.skipped != 'true' diff --git a/README.md b/README.md index 73870a1..30083fa 100644 --- a/README.md +++ b/README.md @@ -36,10 +36,28 @@ uv run ruff check --select I Copy `.env.example` to `.env` and adjust the values: ```env -ENV=DEV -LOG_LEVEL=INFO +# Environment setting (DEV, STAGING, PROD, CI) +AWE_ENV=DEV + +# Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL) +AWE_LOG_LEVEL=INFO + +# Optional: LLM Provider configuration +# Options: openai, togetherai, deepseek +AWE_LLM_PROVIDER=openai + +# Optional: LLM Model to use +# Example: gpt-4, gpt-3.5-turbo, etc. +AWE_LLM_MODEL=gpt-4 ``` +### Configuration Options + +- **`AWE_ENV`**: Application environment (default: `DEV`) +- **`AWE_LOG_LEVEL`**: Logging verbosity level (default: `INFO`) +- **`AWE_LLM_PROVIDER`**: Optional LLM provider selection. If not set, must be specified when creating agents +- **`AWE_LLM_MODEL`**: Optional default model to use. If not set, must be specified when creating agents + ## New Features To develop a new feature: diff --git a/src/aiwebexplorer/agent_factory.py b/src/aiwebexplorer/agent_factory.py index 832af8f..bc48d7d 100644 --- a/src/aiwebexplorer/agent_factory.py +++ b/src/aiwebexplorer/agent_factory.py @@ -8,6 +8,8 @@ from aiwebexplorer.interfaces import IAgent +from .config import config + T = TypeVar("T") ModelProvider = Literal[ @@ -81,9 +83,9 @@ def get_agent( name: str, instructions: list[str], *, - model_id: str | None = None, + model_id: str | None = config.AWE_LLM_MODEL, api_key: str | None = None, - provider: ModelProvider | None = None, + provider: ModelProvider | None = config.AWE_LLM_PROVIDER, model_id_map: ModelIdMap | None = None, **kwargs: Any, ) -> IAgent[Any]: diff --git a/src/aiwebexplorer/agents.py b/src/aiwebexplorer/agents.py index e72b5a2..18e0b2e 100644 --- a/src/aiwebexplorer/agents.py +++ b/src/aiwebexplorer/agents.py @@ -10,7 +10,7 @@ class AgentsIds: ... model_id_map = { "togetherai": "openai/gpt-oss-20b", "deepseek": "chat", - "openai": "gpt4o", + "openai": "gpt-4", } evaluate_request_agent = get_agent_dep()( diff --git a/src/aiwebexplorer/config.py b/src/aiwebexplorer/config.py index 0984907..df10747 100644 --- a/src/aiwebexplorer/config.py +++ b/src/aiwebexplorer/config.py @@ -1,4 +1,5 @@ from enum import StrEnum +from typing import Literal from pydantic_settings import BaseSettings, SettingsConfigDict @@ -15,8 +16,10 @@ class Environment(StrEnum): class Config(BaseSettings): """Application settings.""" - ENV: Environment = Environment.DEV - LOG_LEVEL: str = "INFO" # Allowed: DEBUG, INFO, WARNING, ERROR, CRITICAL + AWE_ENV: Environment = Environment.DEV + AWE_LOG_LEVEL: str = "INFO" # Allowed: DEBUG, INFO, WARNING, ERROR, CRITICAL + AWE_LLM_PROVIDER: Literal["openai", "togetherai", "deepseek"] | None = None + AWE_LLM_MODEL: str | None = None model_config = SettingsConfigDict(env_file=".env", env_prefix="", extra="ignore") diff --git a/src/aiwebexplorer/dependencies.py b/src/aiwebexplorer/dependencies.py index 462c3a5..c9cf0c1 100644 --- a/src/aiwebexplorer/dependencies.py +++ b/src/aiwebexplorer/dependencies.py @@ -13,7 +13,7 @@ def get_agent_dep() -> Callable[..., IAgent[Any]]: Returns: Callable that returns either a real agent or a mock agent based on environment. """ - if config.ENV == Environment.CI: + if config.AWE_ENV == Environment.CI: # Return a function that creates a mock agent for CI environment def mock_agent_factory(*args: Any, **kwargs: Any) -> IAgent[Any]: mock_agent = Mock(spec=IAgent[Any])