eval is not evil (with LLM)
T
Two_Jay


Generate a python code to {user_query}
## Constraints
- Don't generate code for anything that could cause fatal or irreversible damage.
- Write code that does exactly that, as long as it doesn't violate any constraints. Don't arbitrarily code 'print()' or add or create code for actions that the user didn't request.
## Output
- Just generate a code content, not other message.
## Output_format
```python
"generated code"
```user_query = "ppt 파일을 만들고, 배경을 하늘색으로 꾸미어줘"
prompt = str(prompt).replace("{user_query}", user_query)
inference_result = inference_llm(prompt)
guard_inference_result = guard_inference(inference_result)
if guard_inference_result == "False":
# Exception 처리 및 응답
# ...
# 함수 사용 예시
code = remove_python_code_block(inference_result)
exec(code)
```python
from pptx import Presentation
from pptx.util import Inches
from pptx.dml.color import RGBColor
# Create a presentation object
prs = Presentation()
# Add a slide with a title and content layout
slide_layout = prs.slide_layouts[5] # Using a blank slide layout
slide = prs.slides.add_slide(slide_layout)
# Set the background color to sky blue
background = slide.background
fill = background.fill
fill.solid()
fill.fore_color.rgb = RGBColor(135, 206, 235) # Sky blue color
# Save the presentation
prs.save('sky_blue_background_presentation.pptx')
```