Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -64,8 +64,28 @@ def generate_code(state: State):
|
|
| 64 |
No additional text, no markdown fences, just the pure code.
|
| 65 |
|
| 66 |
User request:"""
|
| 67 |
-
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
# code = code_generator.invoke(full_prompt)
|
| 70 |
|
| 71 |
# return {"code": str(code)}
|
|
|
|
| 64 |
No additional text, no markdown fences, just the pure code.
|
| 65 |
|
| 66 |
User request:"""
|
| 67 |
+
instruction = f"""
|
| 68 |
+
You are an expert LangGraph developer.
|
| 69 |
+
|
| 70 |
+
Your task is to generate working Python code using the LangGraph library based on the user's request.
|
| 71 |
+
|
| 72 |
+
Guidelines:
|
| 73 |
+
- Identify the high-level steps from the user's prompt.
|
| 74 |
+
- Break the task into individual LangGraph nodes (functions).
|
| 75 |
+
- Define a TypedDict for the shared state.
|
| 76 |
+
- Build a `StateGraph` using `add_node`, `add_edge`, and `set_entry_point`.
|
| 77 |
+
- Ensure the graph compiles and ends at the `END` node.
|
| 78 |
+
- Avoid external libraries unless clearly specified.
|
| 79 |
+
- Print final output using a terminal node if needed.
|
| 80 |
+
- Keep it clean, minimal, and executable.
|
| 81 |
+
|
| 82 |
+
Now, generate the code for this task:
|
| 83 |
+
{user_prompt}
|
| 84 |
+
"""
|
| 85 |
+
|
| 86 |
+
full_prompt = system_prompt + instruction
|
| 87 |
+
|
| 88 |
+
# full_prompt = system_prompt + user_prompt
|
| 89 |
# code = code_generator.invoke(full_prompt)
|
| 90 |
|
| 91 |
# return {"code": str(code)}
|