Skip to content

Commit 3a75d5b

Browse files
committed
Refactor agent and project modules: replace llm_completion import with litellm, and add metadata file existence check in Project class.
1 parent fcbb276 commit 3a75d5b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

weaver/agent.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66
import time
77
from datetime import datetime
8-
from litellm import completion as llm_completion
9-
8+
import litellm
109
from weaver.config import get_model_config
1110
from weaver.exceptions import AgentError
1211

@@ -65,7 +64,7 @@ def execute_task(self, task_id: int):
6564
last_error = None
6665
for attempt in range(1, 4):
6766
try:
68-
response = llm_completion(
67+
response = litellm.llm_completion(
6968
model=model_cfg["model"],
7069
prompt=prompt,
7170
max_tokens=model_cfg.get("max_tokens")

weaver/project.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ def __init__(self, project_name: str, project_goal: str = None):
3232
if self.project_dir.exists():
3333
raise WeaverError(f"Project '{project_name}' already exists.")
3434
self.project_dir.mkdir(parents=True)
35+
if self.meta_path.exists():
36+
raise WeaverError(f"Project metadata file '{self.meta_path}' already exists.")
37+
self.project_dir.mkdir(exist_ok=True)
3538
self.sources_dir.mkdir()
3639
self.results_dir.mkdir()
3740
# Save metadata

0 commit comments

Comments
 (0)