mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-09 15:17:59 -05:00
Moved from `autogpt` to `forge`:
- `autogpt.config` -> `forge.config`
- `autogpt.processing` -> `forge.content_processing`
- `autogpt.file_storage` -> `forge.file_storage`
- `autogpt.logs` -> `forge.logging`
- `autogpt.speech` -> `forge.speech`
- `autogpt.agents.(base|components|protocols)` -> `forge.agent.*`
- `autogpt.command_decorator` -> `forge.command.decorator`
- `autogpt.models.(command|command_parameter)` -> `forge.command.(command|parameter)`
- `autogpt.(commands|components|features)` -> `forge.components`
- `autogpt.core.utils.json_utils` -> `forge.json.parsing`
- `autogpt.prompts.utils` -> `forge.llm.prompting.utils`
- `autogpt.core.prompting.(base|schema|utils)` -> `forge.llm.prompting.*`
- `autogpt.core.resource.model_providers` -> `forge.llm.providers`
- `autogpt.llm.providers.openai` + `autogpt.core.resource.model_providers.utils`
-> `forge.llm.providers.utils`
- `autogpt.models.action_history:Action*` -> `forge.models.action`
- `autogpt.core.configuration.schema` -> `forge.models.config`
- `autogpt.core.utils.json_schema` -> `forge.models.json_schema`
- `autogpt.core.resource.schema` -> `forge.models.providers`
- `autogpt.models.utils` -> `forge.models.utils`
- `forge.sdk.(errors|utils)` + `autogpt.utils.(exceptions|file_operations_utils|validators)`
-> `forge.utils.(exceptions|file_operations|url_validator)`
- `autogpt.utils.utils` -> `forge.utils.const` + `forge.utils.yaml_validator`
Moved within `forge`:
- forge/prompts/* -> forge/llm/prompting/*
The rest are mostly import updates, and some sporadic removals and necessary updates (for example to fix circular deps):
- Changed `CommandOutput = Any` to remove coupling with `ContextItem` (no longer needed)
- Removed unused `Singleton` class
- Reluctantly moved `speech` to forge due to coupling (tts needs to be changed into component)
- Moved `function_specs_from_commands` and `core/resource/model_providers` to `llm/providers` (resources were a `core` thing and are no longer relevant)
- Keep tests in `autogpt` to reduce changes in this PR
- Removed unused memory-related code from tests
- Removed duplicated classes: `FancyConsoleFormatter`, `BelowLevelFilter`
- `prompt_settings.yaml` is in both `autogpt` and `forge` because for some reason doesn't work when placed in just one dir (need to be taken care of)
- Removed `config` param from `clean_input`, it wasn't used and caused circular dependency
- Renamed `BaseAgentActionProposal` to `ActionProposal`
- Updated `pyproject.toml` in `forge` and `autogpt`
- Moved `Action*` models from `forge/components/action_history/model.py` to `forge/models/action.py` as those are relevant to the entire agent and not just `EventHistoryComponent` + to reduce coupling
- Renamed `DEFAULT_ASK_COMMAND` to `ASK_COMMAND` and `DEFAULT_FINISH_COMMAND` to `FINISH_COMMAND`
- Renamed `AutoGptFormatter` to `ForgeFormatter` and moved to `forge`
Includes changes from PR https://github.com/Significant-Gravitas/AutoGPT/pull/7148
---------
Co-authored-by: Reinier van der Leer <pwuts@agpt.co>
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
import numpy
|
|
import pytest
|
|
from forge.config.config import Config
|
|
from forge.llm.providers import OPEN_AI_EMBEDDING_MODELS
|
|
from pytest_mock import MockerFixture
|
|
|
|
import autogpt.memory.vector.memory_item as vector_memory_item
|
|
import autogpt.memory.vector.providers.base as memory_provider_base
|
|
from autogpt.memory.vector import get_memory
|
|
from autogpt.memory.vector.utils import Embedding
|
|
|
|
|
|
@pytest.fixture
|
|
def embedding_dimension(config: Config):
|
|
return OPEN_AI_EMBEDDING_MODELS[config.embedding_model].embedding_dimensions
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_embedding(embedding_dimension: int) -> Embedding:
|
|
return numpy.full((1, embedding_dimension), 0.0255, numpy.float32)[0]
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_get_embedding(mocker: MockerFixture, mock_embedding: Embedding):
|
|
mocker.patch.object(
|
|
vector_memory_item,
|
|
"get_embedding",
|
|
return_value=mock_embedding,
|
|
)
|
|
mocker.patch.object(
|
|
memory_provider_base,
|
|
"get_embedding",
|
|
return_value=mock_embedding,
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def memory_none(agent_test_config: Config, mock_get_embedding):
|
|
was_memory_backend = agent_test_config.memory_backend
|
|
|
|
agent_test_config.memory_backend = "no_memory"
|
|
yield get_memory(agent_test_config)
|
|
|
|
agent_test_config.memory_backend = was_memory_backend
|