Skip to content

Commit 77143df

Browse files
Merge pull request #84 from Grigorij-Dudnik/dev
Release 0.4.2
2 parents 3a45e72 + 57bd011 commit 77143df

File tree

4 files changed

+38
-25
lines changed

4 files changed

+38
-25
lines changed

src/utilities/llms.py

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,19 @@ def llm_open_local_hosted(model):
3535

3636
def init_llms_medium_intelligence(tools=None, run_name="Clean Coder", temp=0):
3737
llms = []
38-
if getenv("ANTHROPIC_API_KEY"):
39-
llms.append(ChatAnthropic(model="claude-sonnet-4-20250514", temperature=temp, timeout=90))
40-
4138
if getenv("OPENROUTER_API_KEY"):
42-
llms.append(llm_open_router("anthropic/claude-4-sonnet"))
43-
if getenv("OPENAI_API_KEY"):
44-
llms.append(ChatOpenAI(model="gpt-4.1", temperature=temp, timeout=90))
39+
llms.append(llm_open_router("anthropic/claude-sonnet-4"))
40+
if getenv("OPENROUTER_API_KEY"):
41+
llms.append(llm_open_router("openai/gpt-4.1"))
4542

4643
if getenv("OLLAMA_MODEL"):
4744
llms.append(ChatOllama(model=os.getenv("OLLAMA_MODEL")))
4845
if getenv("LOCAL_MODEL_API_BASE"):
4946
llms.append(llm_open_local_hosted(getenv("LOCAL_MODEL_NAME")))
47+
48+
if getenv("OPENAI_API_KEY"):
49+
llms.append(ChatOpenAI(model="gpt-4.1", temperature=temp, timeout=90))
50+
5051
for i, llm in enumerate(llms):
5152
if tools:
5253
llm = llm.bind_tools(tools)
@@ -56,18 +57,19 @@ def init_llms_medium_intelligence(tools=None, run_name="Clean Coder", temp=0):
5657

5758
def init_llms_mini(tools=None, run_name="Clean Coder", temp=0):
5859
llms = []
59-
if os.getenv("ANTHROPIC_API_KEY"):
60-
llms.append(ChatAnthropic(model="claude-3-5-haiku-20241022", temperature=temp, timeout=90))
6160
if os.getenv("OPENROUTER_API_KEY"):
6261
llms.append(llm_open_router("anthropic/claude-3.5-haiku"))
63-
if os.getenv("OPENAI_API_KEY"):
64-
llms.append(ChatOpenAI(model="gpt-4.1-mini", temperature=temp, timeout=90))
62+
6563
# if os.getenv("GOOGLE_API_KEY"):
6664
# llms.append(ChatGoogleGenerativeAI(model="gemini-2.0-flash-exp", temperature=temp, timeout=60))
6765
if os.getenv("OLLAMA_MODEL"):
6866
llms.append(ChatOllama(model=os.getenv("OLLAMA_MODEL")))
6967
if getenv("LOCAL_MODEL_API_BASE"):
7068
llms.append(llm_open_local_hosted(getenv("LOCAL_MODEL_NAME")))
69+
70+
if os.getenv("OPENAI_API_KEY"):
71+
llms.append(ChatOpenAI(model="gpt-4.1-mini", temperature=temp, timeout=90))
72+
7173
for i, llm in enumerate(llms):
7274
if tools:
7375
llm = llm.bind_tools(tools)
@@ -77,19 +79,21 @@ def init_llms_mini(tools=None, run_name="Clean Coder", temp=0):
7779

7880
def init_llms_high_intelligence(tools=None, run_name="Clean Coder", temp=0.2):
7981
llms = []
80-
if os.getenv("ANTHROPIC_API_KEY"):
81-
llms.append(ChatAnthropic(model="claude-opus-4-20250514", temperature=temp, timeout=90))
8282
if getenv("OPENROUTER_API_KEY"):
83-
llms.append(llm_open_router("anthropic/claude-4-opus"))
84-
if os.getenv("OPENAI_API_KEY"):
85-
llms.append(ChatOpenAI(model="o3", temperature=1, timeout=90, reasoning_effort="high"))
86-
if os.getenv("OPENAI_API_KEY"):
87-
llms.append(ChatOpenAI(model="o1", temperature=1, timeout=90))
83+
llms.append(llm_open_router("anthropic/claude-opus-4"))
84+
if getenv("OPENROUTER_API_KEY"):
85+
llms.append(llm_open_router("google/gemini-2.5-pro"))
8886

8987
if os.getenv("OLLAMA_MODEL"):
9088
llms.append(ChatOllama(model=os.getenv("OLLAMA_MODEL")))
9189
if getenv("LOCAL_MODEL_API_BASE"):
9290
llms.append(llm_open_local_hosted(getenv("LOCAL_MODEL_NAME")))
91+
92+
if os.getenv("ANTHROPIC_API_KEY"):
93+
llms.append(ChatAnthropic(model="claude-opus-4-20250514", temperature=temp, timeout=90, max_tokens=8000))
94+
if os.getenv("OPENAI_API_KEY"):
95+
llms.append(ChatOpenAI(model="o3", temperature=1, timeout=90, reasoning_effort="high"))
96+
9397
for i, llm in enumerate(llms):
9498
if tools:
9599
llm = llm.bind_tools(tools)

src/utilities/manager_utils.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,16 @@ def actualize_tasks_list_and_progress_description(state):
329329
content=tasks_progress_template.format(tasks=project_tasks, progress_description=progress_description),
330330
tasks_and_progress_message=True,
331331
)
332-
# insert tasks message near the end of conversation to ensure AI task list is most actual
333-
state["messages"].insert(-2, tasks_and_progress_msg)
332+
# Find the index of the last AI message with tool calls to insert the task list before it.
333+
# Default to inserting before the last message if no such AI message is found.
334+
insertion_index = -1
335+
for i in range(len(state["messages"]) - 1, -1, -1):
336+
msg = state["messages"][i]
337+
if msg.type == "ai" and getattr(msg, "tool_calls", None):
338+
insertion_index = i
339+
break
340+
341+
state["messages"].insert(insertion_index, tasks_and_progress_msg)
334342
return state
335343

336344

src/utilities/set_up_dotenv.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ def set_up_env_coder_pipeline():
2020
color="cyan",
2121
)
2222
)
23-
envs["ANTHROPIC_API_KEY"] = input("Provide your Anthropic API key (Optional) (Why? Best coding capabilities):\n")
23+
envs["OPEN_ROUTER_API_KEY"] = input("Provide your OpenRouter API key:\n")
2424
envs["OPENAI_API_KEY"] = input(
25-
"Provide your OpenAI API key (Optional) (Why? Needed for using microphone, best planning capabilities with o1):\n"
25+
"Provide your OpenAI API key (Optional) (Needed for microphone use):\n"
2626
)
27-
envs["OPEN_ROUTER_API_KEY"] = input("Provide your OpenRouter API key (Optional) (Why? All models in one place):\n")
2827
print(colored("2/3. Now provide the folder containing your project.", color="cyan"))
2928
envs["WORK_DIR"] = input("Provide full path to your work directory:\n")
3029
print(colored("3/3. (Optional) If you want to use frontend feedback feature:", color="cyan"))
@@ -54,11 +53,10 @@ def set_up_env_manager():
5453
color="cyan",
5554
)
5655
)
57-
envs["ANTHROPIC_API_KEY"] = input("Provide your Anthropic API key (Optional) (Why? Best coding capabilities):\n")
56+
envs["OPEN_ROUTER_API_KEY"] = input("Provide your OpenRouter API key:\n")
5857
envs["OPENAI_API_KEY"] = input(
59-
"Provide your OpenAI API key (Optional) (Why? Needed for using microphone, best planning capabilities with o1):\n"
58+
"Provide your OpenAI API key (Optional) (Needed for microphone use):\n"
6059
)
61-
envs["OPEN_ROUTER_API_KEY"] = input("Provide your OpenRouter API key (Optional) (Why? All models in one place):\n")
6260
print(colored("2/4. Now provide the folder containing your project.", color="cyan"))
6361
envs["WORK_DIR"] = input("Provide full path to your work directory:\n")
6462
print(colored("3/4. (Optional) If you want to use frontend feedback feature:", color="cyan"))

src/utilities/util_functions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ def convert_image(image_path):
113113
if not os.path.exists(join_paths(work_dir, image_path)):
114114
print_formatted(f"Image not exists: {image_path}", color="yellow")
115115
return
116+
if image_path.split(".")[-1] not in ["png", "jpeg", "gif", "webp"]:
117+
print_formatted(f"Image format not supported: {image_path}", color="yellow")
118+
return
116119
return [
117120
{"type": "text", "text": f"I###\n{image_path}"},
118121
{

0 commit comments

Comments
 (0)