Skip to content

Commit

Permalink
AutoGPT: Make autogpt.core play nice with its parent module
Browse files Browse the repository at this point in the history
  • Loading branch information
Pwuts committed Sep 15, 2023
1 parent b4401cd commit 5074d69
Show file tree
Hide file tree
Showing 7 changed files with 770 additions and 15 deletions.
7 changes: 0 additions & 7 deletions autogpts/autogpt/autogpt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
import random
import sys

from dotenv import load_dotenv

if "pytest" in sys.argv or "pytest" in sys.modules or os.getenv("CI"):
print("Setting random seed to 42")
random.seed(42)

# Load the users .env file into environment variables
load_dotenv(verbose=True, override=True)

del load_dotenv
6 changes: 6 additions & 0 deletions autogpts/autogpt/autogpt/app/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from dotenv import load_dotenv

# Load the users .env file into environment variables
load_dotenv(verbose=True, override=True)

del load_dotenv
4 changes: 2 additions & 2 deletions autogpts/autogpt/autogpt/core/ability/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
import inflection
from pydantic import Field


from autogpt.core.ability.schema import AbilityResult
from autogpt.core.configuration import SystemConfiguration
from autogpt.core.planning.simple import LanguageModelConfiguration
from autogpt.core.plugin.base import PluginLocation


class AbilityConfiguration(SystemConfiguration):
"""Struct for model configuration."""

from autogpt.core.plugin.base import PluginLocation

location: PluginLocation
packages_required: list[str] = Field(default_factory=list)
language_model_required: LanguageModelConfiguration = None
Expand Down
752 changes: 752 additions & 0 deletions autogpts/autogpt/autogpt/core/poetry.lock

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions autogpts/autogpt/autogpt/core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
packages = [{ include = "autogpt/core", from = "../.." }]

[tool.poetry.scripts]
cli = "autogpt.core.runner.cli_app.cli:autogpt"

[tool.poetry.dependencies]
python = "^3.10"
agent-protocol = "^0.3.0"
click = "^8.1.7"
colorama = "^0.4.6"
distro = "^1.8.0"
inflection = "^0.5.1"
openai = "^0.28.0"
pydantic = "^2.3.0"
pydantic = "^1.10.12"
pyyaml = "^6.0.0"

[build-system]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ async def _create_embedding(text: str, *_, **kwargs) -> openai.Embedding:
Args:
text str: The text to embed.
model_name str: The name of the model to use.
model str: The name of the model to use.
Returns:
str: The embedding.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def update_usage_and_cost(


class ModelProviderSettings(ProviderSettings):
resource_type = ResourceType.MODEL
resource_type: ResourceType = ResourceType.MODEL
credentials: ModelProviderCredentials
budget: ModelProviderBudget

Expand All @@ -159,7 +159,7 @@ def get_remaining_budget(self) -> float:
class EmbeddingModelProviderModelInfo(ModelProviderModelInfo):
"""Struct for embedding model information."""

model_service = ModelProviderService.EMBEDDING
llm_service: ModelProviderService = ModelProviderService.EMBEDDING
embedding_dimensions: int


Expand Down Expand Up @@ -196,7 +196,7 @@ async def create_embedding(
class LanguageModelProviderModelInfo(ModelProviderModelInfo):
"""Struct for language model information."""

model_service = ModelProviderService.LANGUAGE
llm_service: ModelProviderService = ModelProviderService.LANGUAGE
max_tokens: int


Expand Down

0 comments on commit 5074d69

Please sign in to comment.