Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions agents/impl_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,10 @@
from dotenv import load_dotenv
import textwrap
from . import utils
import dataclasses


@dataclasses.dataclass(frozen=True)
class GenerationAttempt:
code: str
errors: str


@dataclasses.dataclass(frozen=True)
class ImplGenerationRequest:
interface_str: str
test_str: str
prior_attempts: list[GenerationAttempt] = dataclasses.field(default_factory=list)
from .models import GenerationAttempt, ImplGenerationRequest # Import Pydantic models

# Removed dataclass definitions for GenerationAttempt and ImplGenerationRequest
# Removed import dataclasses

class ImplGenerator:

Expand Down
15 changes: 15 additions & 0 deletions agents/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from pydantic import BaseModel, Field
from typing import List

class GenerationAttempt(BaseModel):
code: str
errors: str

class ImplGenerationRequest(BaseModel):
interface_str: str
test_str: str
prior_attempts: List[GenerationAttempt] = Field(default_factory=list)

class TestGenerationRequest(BaseModel):
interface_str: str
prior_attempts: List[GenerationAttempt] = Field(default_factory=list)
16 changes: 3 additions & 13 deletions agents/test_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,10 @@
from dotenv import load_dotenv
import textwrap
from . import utils
from dataclasses import dataclass, field


@dataclass(frozen=True)
class GenerationAttempt:
code: str
errors: str


@dataclass(frozen=True)
class TestGenerationRequest:
interface_str: str
prior_attempts: list[GenerationAttempt] = field(default_factory=list)
from .models import GenerationAttempt, TestGenerationRequest # Import Pydantic models

# Removed dataclass definitions for GenerationAttempt and TestGenerationRequest
# Removed import for dataclasses

class TestGenerator:

Expand Down
7 changes: 4 additions & 3 deletions demo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from agents import impl_generator
from agents import test_generator
from dataclasses import dataclass
from pydantic import BaseModel # Import BaseModel for Pydantic
from dotenv import load_dotenv
import os
import py_compile
Expand All @@ -10,12 +10,13 @@
import logfire


@dataclass
class Example:
# Define the Pydantic model Example
class Example(BaseModel):
code: str
project_name: str
filename: str

# Removed old dataclass Example definition

math_utils = Example(
project_name='math-utils',
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ pytest
modelcontextprotocol
uvicorn[standard]
fastapi
pydantic