SlideShare a Scribd company logo
LLM Pair programming
Chakrit Phain
R&D Softnix Technology Co.,Ltd,
Scenario 1:Improve existing code
prompt_template = """
I don't think this code is the best way to do it
in Python, can you help me?
{question}
Please explain, in detail, what you did to
improve it.
"""
Scenario 1:Improve existing code
question = """
def func_x(array)
for i in range(len(array)):
print(array[i])
""”
prompt = prompt_template.format(question=question)
generate_text(prompt)
Scenario 1:Improve existing code
I improved the code by using the `*` operator to unpack
the array into individual arguments for the `print()`
function. This is more concise and efficient than using
a `for` loop.
Scenario 1:Improve existing code
prompt_template = """
I don't think this code is the best way to do it
in Python, can you help me?
{question}
Please explore multiple ways of solving the
problem,
and tell me which is the most Pythonic"""
Scenario 1:Improve existing code
Scenario 2: Simplify code
Can you please simplify this code for a linked list in
Python?
{question}
Explain in detail what you did to modify it, and why.
- Ask the LLM to perform a code review.
- Note that adding/removing newline characters may affect the LLM
completion that gets output by the LLM.
Scenario 2: Simplify code
List1.headval.dataval =>Mon
List1.headval.nextval.dataval=> Tue
List1.headval.nextval.nextval.datval= Wed
Scenario 2: Simplify code
List1.headval.dataval =>Mon
List1.headval.nextval.dataval=> Tue
List1.headval.nextval.nextval.datval= Wed
Scenario 2: Simplify code
Can you please simplify this code for a linked list in
Python?
You are an expert in Pythonic code.
{question}
Please comment each line in detail,
and explain in detail what you did to modify it, and why.
Scenario 2: Simplify code
Scenario 3: Write test cases
- It may help to specify that you want the LLM to output "in code" to
encourage it to write unit tests instead of just returning test cases in English.
Can you please create test cases in code for this Python code?
{question}
Explain in detail what these test cases are designed to achieve.
Scenario 3: Write test cases
- It may help to specify that you want the LLM to output "in code" to
encourage it to write unit tests instead of just returning test cases in English.
Scenario 3: Write test cases
Scenario 4: Make code more efficient
- Improve runtime by potentiallyavoidinginefficient methods (such as ones that use
recursion when not needed).
Can you please make this code more efficient?
{question}
Explain in detail what you changed and why.
Scenario 4: Make code more efficient
Scenario 4: Make code more efficient
Scenario 5: Debug your code
prompt_template = """
Can you please help me to debug this code?
{question}
Explain in detail what you found and why it was a bug.
"""
Scenario 5: Debug your code
Scenario 5: Debug your code

More Related Content

DOCX
Realtime selenium interview questions
PPTX
Refactoring legacy code driven by tests - ENG
PDF
clicks2conversations.pdf
PPTX
Refactoring legacy code driven by tests - ITA
DOCX
Faculty of ScienceDepartment of ComputingFinal Examinati.docx
DOCX
Compiler lab final report writing
DOCX
Exercise1[5points]Create the following classe
PDF
RubyTesting
Realtime selenium interview questions
Refactoring legacy code driven by tests - ENG
clicks2conversations.pdf
Refactoring legacy code driven by tests - ITA
Faculty of ScienceDepartment of ComputingFinal Examinati.docx
Compiler lab final report writing
Exercise1[5points]Create the following classe
RubyTesting

Similar to LLM_PairProgramming.pdf (20)

PDF
RubyTesting
PDF
Cis 1403 lab1- the process of programming
PPTX
My Presentation ITPsdhjccjh cjhj (1).pptx
DOCX
Question 1 1 pts Skip to question text.As part of a bank account.docx
PDF
Clean code: understanding Boundaries and Unit Tests
PPTX
My Presentation ITPdcjsdicjscisuchc.pptx
PDF
Devry CIS 355A Full Course Latest
PDF
Start Building a Game and Get the Basic Structure Running
PDF
Capgemini Interview Questions By ScholarHat
PDF
Python for Machine Learning
DOCX
Objectives Assignment 09 Applications of Stacks COS.docx
PPTX
Recursive Functions in Python - Assignment Sample for University Students
PDF
Understand and Harness the Capabilities of Intel® Xeon Phi™ Processors
PDF
The Ultimate Question of Programming, Refactoring, and Everything
PDF
The Ultimate Question of Programming, Refactoring, and Everything
PPTX
CODE TUNINGtertertertrtryryryryrtytrytrtry
DOCX
Important notes· NOTE it is usually fine and often encouraged i.docx
DOCX
OverviewAssignment 1 Hypothetical Machine SimulatorCSci 43.docx
PDF
Google Interview Questions By Scholarhat
KEY
Your Own Metric System
RubyTesting
Cis 1403 lab1- the process of programming
My Presentation ITPsdhjccjh cjhj (1).pptx
Question 1 1 pts Skip to question text.As part of a bank account.docx
Clean code: understanding Boundaries and Unit Tests
My Presentation ITPdcjsdicjscisuchc.pptx
Devry CIS 355A Full Course Latest
Start Building a Game and Get the Basic Structure Running
Capgemini Interview Questions By ScholarHat
Python for Machine Learning
Objectives Assignment 09 Applications of Stacks COS.docx
Recursive Functions in Python - Assignment Sample for University Students
Understand and Harness the Capabilities of Intel® Xeon Phi™ Processors
The Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and Everything
CODE TUNINGtertertertrtryryryryrtytrytrtry
Important notes· NOTE it is usually fine and often encouraged i.docx
OverviewAssignment 1 Hypothetical Machine SimulatorCSci 43.docx
Google Interview Questions By Scholarhat
Your Own Metric System
Ad

More from Chakrit Phain (20)

PPTX
Web scraping with php
PPTX
ChatGPT_Prompts.pptx
PDF
Sentence-BERT
PDF
AI_ML_Softnix.pdf
PPTX
Web Scraping with Python
PPTX
เปรียบเทียบ RPA Opensource
PPTX
PHP Bandwidth Shaping script
PPTX
PHP Explode & Preg_split Test
PPTX
Types of Big Data Analytics
PDF
Genetic Algorithm
PDF
Machine Learning Algorithm & Anomaly detection 2021
PDF
Text classification With Rapid Miner
PPTX
Ai optimization Example
PPTX
Zabbix aws
PPTX
Anomaly Detection Technique
PPTX
Softnix Anomaly Detection Methods
PDF
Neo4j Graph Database และการประยุกตร์ใช้
PDF
Softnix how ml_work_0.1draft
PPTX
Shell Shock
PPTX
Neo4j introduction
Web scraping with php
ChatGPT_Prompts.pptx
Sentence-BERT
AI_ML_Softnix.pdf
Web Scraping with Python
เปรียบเทียบ RPA Opensource
PHP Bandwidth Shaping script
PHP Explode & Preg_split Test
Types of Big Data Analytics
Genetic Algorithm
Machine Learning Algorithm & Anomaly detection 2021
Text classification With Rapid Miner
Ai optimization Example
Zabbix aws
Anomaly Detection Technique
Softnix Anomaly Detection Methods
Neo4j Graph Database และการประยุกตร์ใช้
Softnix how ml_work_0.1draft
Shell Shock
Neo4j introduction
Ad

Recently uploaded (20)

PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Encapsulation theory and applications.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Mobile App Security Testing_ A Comprehensive Guide.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Understanding_Digital_Forensics_Presentation.pptx
Empathic Computing: Creating Shared Understanding
Spectral efficient network and resource selection model in 5G networks
Chapter 3 Spatial Domain Image Processing.pdf
Approach and Philosophy of On baking technology
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
“AI and Expert System Decision Support & Business Intelligence Systems”
Encapsulation theory and applications.pdf
Programs and apps: productivity, graphics, security and other tools
Digital-Transformation-Roadmap-for-Companies.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
sap open course for s4hana steps from ECC to s4
Dropbox Q2 2025 Financial Results & Investor Presentation

LLM_PairProgramming.pdf

  • 1. LLM Pair programming Chakrit Phain R&D Softnix Technology Co.,Ltd,
  • 2. Scenario 1:Improve existing code prompt_template = """ I don't think this code is the best way to do it in Python, can you help me? {question} Please explain, in detail, what you did to improve it. """
  • 3. Scenario 1:Improve existing code question = """ def func_x(array) for i in range(len(array)): print(array[i]) ""” prompt = prompt_template.format(question=question) generate_text(prompt)
  • 4. Scenario 1:Improve existing code I improved the code by using the `*` operator to unpack the array into individual arguments for the `print()` function. This is more concise and efficient than using a `for` loop.
  • 5. Scenario 1:Improve existing code prompt_template = """ I don't think this code is the best way to do it in Python, can you help me? {question} Please explore multiple ways of solving the problem, and tell me which is the most Pythonic"""
  • 7. Scenario 2: Simplify code Can you please simplify this code for a linked list in Python? {question} Explain in detail what you did to modify it, and why. - Ask the LLM to perform a code review. - Note that adding/removing newline characters may affect the LLM completion that gets output by the LLM.
  • 8. Scenario 2: Simplify code List1.headval.dataval =>Mon List1.headval.nextval.dataval=> Tue List1.headval.nextval.nextval.datval= Wed
  • 9. Scenario 2: Simplify code List1.headval.dataval =>Mon List1.headval.nextval.dataval=> Tue List1.headval.nextval.nextval.datval= Wed
  • 10. Scenario 2: Simplify code Can you please simplify this code for a linked list in Python? You are an expert in Pythonic code. {question} Please comment each line in detail, and explain in detail what you did to modify it, and why.
  • 12. Scenario 3: Write test cases - It may help to specify that you want the LLM to output "in code" to encourage it to write unit tests instead of just returning test cases in English. Can you please create test cases in code for this Python code? {question} Explain in detail what these test cases are designed to achieve.
  • 13. Scenario 3: Write test cases - It may help to specify that you want the LLM to output "in code" to encourage it to write unit tests instead of just returning test cases in English.
  • 14. Scenario 3: Write test cases
  • 15. Scenario 4: Make code more efficient - Improve runtime by potentiallyavoidinginefficient methods (such as ones that use recursion when not needed). Can you please make this code more efficient? {question} Explain in detail what you changed and why.
  • 16. Scenario 4: Make code more efficient
  • 17. Scenario 4: Make code more efficient
  • 18. Scenario 5: Debug your code prompt_template = """ Can you please help me to debug this code? {question} Explain in detail what you found and why it was a bug. """
  • 19. Scenario 5: Debug your code
  • 20. Scenario 5: Debug your code