Skip to content

Commit

Permalink
Merge pull request #1054 from Pythagora-io/fixes
Browse files Browse the repository at this point in the history
properly setup default models
  • Loading branch information
LeonOstrez authored Jul 16, 2024
2 parents 12b868d + 895a74c commit d8f221f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions core/agents/code_monkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from core.agents.base import BaseAgent
from core.agents.convo import AgentConvo
from core.agents.response import AgentResponse, ResponseType
from core.config import DESCRIBE_FILES_AGENT_NAME
from core.config import CODE_MONKEY_AGENT_NAME, DESCRIBE_FILES_AGENT_NAME
from core.llm.parser import JSONParser, OptionalCodeBlockParser
from core.log import get_logger

Expand Down Expand Up @@ -56,7 +56,7 @@ async def implement_changes(self) -> AgentResponse:
iterations = self.current_state.iterations
user_feedback = None
user_feedback_qa = None
llm = self.get_llm()
llm = self.get_llm(CODE_MONKEY_AGENT_NAME)

if "task_review_feedback" in task and task["task_review_feedback"]:
instructions = task.get("task_review_feedback")
Expand Down
3 changes: 1 addition & 2 deletions core/agents/troubleshooter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from core.agents.convo import AgentConvo
from core.agents.mixins import IterationPromptMixin
from core.agents.response import AgentResponse
from core.config import ROUTE_FILES_AGENT_NAME
from core.db.models.file import File
from core.db.models.project_state import TaskStatus
from core.llm.parser import JSONParser, OptionalCodeBlockParser
Expand Down Expand Up @@ -158,7 +157,7 @@ async def get_user_instructions(self) -> Optional[str]:
async def _get_route_files(self) -> list[File]:
"""Returns the list of file paths that have routes defined in them."""

llm = self.get_llm(ROUTE_FILES_AGENT_NAME)
llm = self.get_llm()
convo = AgentConvo(self).template("get_route_files").require_schema(RouteFilePaths)
file_list = await llm(convo, parser=JSONParser(RouteFilePaths))
route_files: set[str] = set(file_list.files)
Expand Down
6 changes: 3 additions & 3 deletions core/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

# Agents with sane setup in the default configuration
DEFAULT_AGENT_NAME = "default"
CODE_MONKEY_AGENT_NAME = "CodeMonkey"
DESCRIBE_FILES_AGENT_NAME = "CodeMonkey.describe_files"
ROUTE_FILES_AGENT_NAME = "Troubleshooter.get_route_files"

# Endpoint for the external documentation
EXTERNAL_DOCUMENTATION_API = "http://docs-pythagora-io-439719575.us-east-1.elb.amazonaws.com"
Expand Down Expand Up @@ -111,7 +111,7 @@ class AgentLLMConfig(_StrictModel):
"""

provider: LLMProvider = LLMProvider.OPENAI
model: str = Field(description="Model to use", default="gpt-4-0125-preview")
model: str = Field(description="Model to use", default="gpt-4o-2024-05-13")
temperature: float = Field(
default=0.5,
description="Temperature to use for sampling",
Expand Down Expand Up @@ -309,8 +309,8 @@ class Config(_StrictModel):
agent: dict[str, AgentLLMConfig] = Field(
default={
DEFAULT_AGENT_NAME: AgentLLMConfig(),
CODE_MONKEY_AGENT_NAME: AgentLLMConfig(model="gpt-4-0125-preview", temperature=0.0),
DESCRIBE_FILES_AGENT_NAME: AgentLLMConfig(model="gpt-3.5-turbo", temperature=0.0),
ROUTE_FILES_AGENT_NAME: AgentLLMConfig(model="gpt-4o", temperature=0.0),
}
)
prompt: PromptConfig = PromptConfig()
Expand Down
2 changes: 1 addition & 1 deletion example-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"agent": {
"default": {
"provider": "openai",
"model": "gpt-4o",
"model": "gpt-4o-2024-05-13",
"temperature": 0.5
},
"CodeMonkey": {
Expand Down
2 changes: 1 addition & 1 deletion tests/config/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_builtin_defaults():
config = ConfigLoader.from_json("{}")

assert config.llm_for_agent().provider == LLMProvider.OPENAI
assert config.llm_for_agent().model == "gpt-4-0125-preview"
assert config.llm_for_agent().model == "gpt-4o-2024-05-13"
assert config.llm_for_agent().base_url is None
assert config.llm_for_agent().api_key is None

Expand Down

0 comments on commit d8f221f

Please sign in to comment.