Skip to content

Commit aa951b8

Browse files
nshkrdotcomnshkrdotcom
authored andcommitted
fb
1 parent b5e4d06 commit aa951b8

File tree

3 files changed

+83
-27
lines changed

3 files changed

+83
-27
lines changed

lib/mix/tasks/pipeline.generate.ex

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -965,19 +965,34 @@ defmodule Mix.Tasks.Pipeline.Generate do
965965
end
966966

967967
defp replace_template_variables(config, input) do
968-
# Manually replace template variables in the config
969-
config_json = Jason.encode!(config)
968+
# Deep replace template variables in the config structure
969+
deep_replace_templates(config, input)
970+
end
970971

971-
# Replace each input variable
972-
updated_json =
973-
Enum.reduce(input, config_json, fn {key, value}, acc ->
974-
String.replace(acc, "{{#{key}}}", to_string(value))
975-
end)
972+
defp deep_replace_templates(value, replacements) when is_binary(value) do
973+
# Replace all template variables in the string
974+
Enum.reduce(replacements, value, fn {key, replacement_value}, acc ->
975+
template = "{{#{key}}}"
976+
if String.contains?(acc, template) do
977+
String.replace(acc, template, to_string(replacement_value))
978+
else
979+
acc
980+
end
981+
end)
982+
end
976983

977-
case Jason.decode(updated_json) do
978-
{:ok, updated_config} -> updated_config
979-
# Return original if replacement failed
980-
{:error, _} -> config
981-
end
984+
defp deep_replace_templates(value, replacements) when is_list(value) do
985+
Enum.map(value, &deep_replace_templates(&1, replacements))
986+
end
987+
988+
defp deep_replace_templates(value, replacements) when is_map(value) do
989+
Map.new(value, fn {k, v} ->
990+
{k, deep_replace_templates(v, replacements)}
991+
end)
992+
end
993+
994+
defp deep_replace_templates(value, _replacements) do
995+
# For any other type (numbers, booleans, atoms, etc.), return as-is
996+
value
982997
end
983998
end

lib/pipeline/meta/generator.ex

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,17 @@ defmodule Pipeline.Meta.Generator do
122122

123123
defp select_claude_model(dna) do
124124
case dna.optimization_chromosome.performance_profile do
125-
"speed_optimized" -> "claude-3-haiku-20240307"
126-
"accuracy_optimized" -> "claude-3-opus-20240229"
127-
_ -> "claude-3-sonnet-20240229"
125+
"speed_optimized" -> "claude-opus-4-20250514"
126+
"accuracy_optimized" -> "claude-opus-4-20250514"
127+
_ -> "claude-opus-4-20250514"
128128
end
129129
end
130130

131131
defp select_gemini_model(dna) do
132132
case dna.optimization_chromosome.performance_profile do
133-
"speed_optimized" -> "gemini-1.5-flash"
134-
_ -> "gemini-1.5-pro"
133+
"speed_optimized" -> "gemini-2.5-flash"
134+
"accuracy_optimized" -> "gemini-2.5-pro"
135+
_ -> "gemini-2.5-flash-lite-preview-06-17"
135136
end
136137
end
137138

working_genesis.yaml

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,58 @@ workflow:
1616
content: |
1717
Request: {{pipeline_request}}
1818
19-
Respond with YAML pipeline configuration only. No explanations, no descriptions, no questions - just the YAML code block.
19+
ANALYZE THE REQUEST:
20+
- If it mentions reading files from specific directories, use claude with cwd
21+
- If it mentions "claude code" working in a directory, use claude with cwd
22+
- If it mentions analyzing code in a specific path, use claude with cwd
23+
- If it needs to modify or create files in specific locations, use claude with cwd
2024
25+
Generate a pipeline in the EXACT format shown below. DO NOT include providers section, DO NOT include api_key fields, DO NOT include inputs/outputs sections at the root level.
26+
27+
Use this exact structure:
28+
29+
```yaml
30+
name: descriptive_pipeline_name
31+
description: Clear description of what this pipeline does
32+
33+
steps:
34+
- name: first_step
35+
type: prompt
36+
provider: gemini
37+
model: gemini-2.5-flash-lite-preview-06-17
38+
prompt: |
39+
Your detailed prompt here
40+
41+
- name: second_step
42+
type: prompt
43+
provider: claude
44+
model: claude-opus-4-20250514
45+
prompt: |
46+
Another detailed prompt
47+
Can reference previous steps: {{first_step.output}}
48+
```
49+
50+
For Claude steps that need to work with files in specific directories, use:
2151
```yaml
22-
workflow:
23-
name: descriptive_name
24-
description: clear purpose
25-
version: "1.0.0"
26-
27-
steps:
28-
- name: meaningful_step_name
52+
- name: claude_with_directory
2953
type: claude
54+
claude_options:
55+
max_turns: 10
56+
allowed_tools: ["Read", "Write", "Edit", "LS", "Glob"]
57+
cwd: "/path/to/working/directory" # Sets working directory for Claude tools
58+
output_format: "text"
3059
prompt:
3160
- type: "static"
32-
content: "Detailed, specific prompt"
33-
```
61+
content: |
62+
Your instructions here
63+
```
64+
65+
IMPORTANT:
66+
- Use gemini-2.5-flash-lite-preview-06-17, gemini-2.5-pro, or gemini-2.5-flash for Gemini models
67+
- Use claude-opus-4-20250514 for Claude models
68+
- For Claude steps that need file access, use type: claude with claude_options
69+
- Set cwd in claude_options to specify working directory
70+
- Include allowed_tools for file operations: ["Read", "Write", "Edit", "LS", "Glob", "Grep"]
71+
- NO providers section with API keys
72+
- NO workflow wrapper
73+
- Regular prompts use type: prompt with provider and model fields

0 commit comments

Comments
 (0)