Spaces:
Runtime error
Runtime error
Update agents/software_architect_agent.py
Browse files
agents/software_architect_agent.py
CHANGED
|
@@ -10,12 +10,17 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
| 10 |
device_map="auto"
|
| 11 |
)
|
| 12 |
|
| 13 |
-
def run(state):
|
| 14 |
-
"""
|
| 15 |
-
|
|
|
|
|
|
|
| 16 |
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(model.device)
|
| 17 |
output_ids = model.generate(input_ids, max_new_tokens=512)
|
| 18 |
output = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
device_map="auto"
|
| 11 |
)
|
| 12 |
|
| 13 |
+
def run(state: dict) -> dict:
|
| 14 |
+
"""Software Architect designs overall system architecture"""
|
| 15 |
+
messages = state["messages"]
|
| 16 |
+
prompt = messages[-1]["content"]
|
| 17 |
+
|
| 18 |
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(model.device)
|
| 19 |
output_ids = model.generate(input_ids, max_new_tokens=512)
|
| 20 |
output = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
| 21 |
|
| 22 |
+
return {
|
| 23 |
+
"messages": [{"role": "Software Architect", "content": output}],
|
| 24 |
+
"chat_log": state["chat_log"] + [{"role": "Software Architect", "content": output}],
|
| 25 |
+
"arch_output": output,
|
| 26 |
+
}
|