Swift Tasking
Swift Tasking
1. Coding Standard
2. Code Generation
3. Problem Reflection
4. Test Reasoning
5. Code Refactoring
7. Coding Advanced
9. Test Generation
You will create your prompts and responses for two different projects:
Need Help?
After writing your prompt, you will write a response to your prompt. The
response will also be completely perfect. If you were to send your ‘user
written prompt’ to an LLM and that LLM provided you with your written
response, you should be delighted. This response must be:
Highly creative
Your response needs to be better than the best LLM available (state-of-
the-art model: SOTA).To accomplish this:
Review the Task Type: In the UI there will be a note indicating the
task type (Code Generation, Problem Reflection, Test Reasoning, Code
Refactoring, Structure Data Generation, Retrieval Augmented
Generation (RAG), Test Generation, Bug Fixing, Solution Reasoning, Tool
Use). Review the task-specific instructions for any clarifications.
Consider the User: Need to be sure that you respond to all of the
following questions:
Would the response you created delight the user relative to the
prompt?
Quick note: In some situations, you may also receive a pre-written prompt.
In this situation write the response to that prompt as if you were an LLM.
Prompt 3 / Response 3
End of conversation
Every prompt after the first must relate to the category and
subcategory and continue a natural conversational flow as a follow-up
to the previous response.
Need Help?
Clear Asks
Personal Perspective
Context
Goal/Value
What should you consider for a perfect response? Select all that apply
What is the most important thing to consider when working with multiturns?
To maintain continuity, they should build off context from previous prompts
and responses
Here are the categories, please take a look. Always keep them in your notes
while doing the tasks.
Task Categories
Examples
Task Categories and Examples
Task Categories
Examples
Need Help?
Perfect Task
import Foundation
print("Enter the amount to pay: ", terminator: "")
remainingCoins %= 25
remainingCoins %= 10
remainingCoins %= 5
} else {
print("Invalid input.")
}
This program gives change for cents of an amount, in coins of 25, 10, 5, and
1 cents. I want an improved version that is modularized and simple to add
other coin values such as 50 cents coins and has appropriate comments in
each section of the code.
Response:
```swift
import Foundation
/// Calculate the minimum number of coins needed for a given amount in
cents with a list of coin values as constants.
///
/// - Parameters:
/// - Returns:
/// - Array of tuples: An array where each tuple contains a coin value and the
number of such coins used.
if result > 0 {
} else {
numberCoins.append(result)
return coinsNumbers
///
/// - Parameters:
/// - change (Array of tuples): An array of tuples where each tuple contains a
coin value and the number of such coins used.
}
// Prompt the user to enter the amount to pay and calculate the amount of
cents
displayChange(change: change)
} else {
print("Invalid input.")
```
The code has a function `coins_cents` that allows for a more efficient
calculation of the number of coins required for each type so that the number
of coins is the minimum possible. The code structure is adjusted to have a
main block with a call to the function and a practical display of the result. It
has comments on the relevant lines as well as docstrings in the functions.
Clear Asks:
• Add functionality to easily include other coin values, such as 50-cent coins.
• They are seeking to improve the existing program to make it more flexible
and maintainable.
Context:
Goal / Value:
• The desired outcome is a modular and flexible program that can easily
incorporate additional coin values, such as 50-cent coins.
Need Help?
All levels can be considered simultaneously; they are not mutually exclusive.
Need Help?
Key Concepts
1. Constants and Variables: Constants (let) and variables (var) store
values. Constants cannot be changed once set, whereas variables can.
2. Data Types: Swift uses type inference and also allows explicit type
declarations for clarity
Best Practices
Practical Techniques
1. Declaring Variables: Use let for constants and var for variables.
For more details, you can visit the Swift Programming Language
Documentation:
Swift Programming Language (6.0 beta)
iOS Insights
Swift Books
No MacBook? No Problem!
Focus on building Swift scripts and test your code using these tools:
Happy coding!
Task Interface
While we know that each project looks different, this section showcases
thetasking interface and the steps to follow.
4) After the prompt section, your response section follows right after. Here
you need to make sure that the response is original, creative, and adhering
to the task category and responding to the prompt.Before the next step,
please select Get feedback, and do the proper modifications
5) Once you have taken the time to craft your response, you may hit finish
editing. Depending on your project, you may either need to write another
turn before submitting!
Course Overview
This course aims to help you identify and correct common errors.
Code Execution:
Indentation Issues
🚨DISCLAIMER🚨
Common Errors
Best Practices
Swift 5
Lists
Tables
Headers
Headers should be used to organize content or establish a hierarchy of
information.
Highlights
Coding Style
Swift 5
Prompt Design:
Lack of complexity
Common Error
The prompt is too basic, resulting in solutions that do not fully address the
task's complexity.
Best Practices
Create prompts that are more detailed and complex. Employ advanced
problem-solving techniques and consider multiple approaches to ensure the
task is addressed comprehensively. This involves incorporating specific
requirements within the prompt to encourage a more thorough and in-depth
response.
Common Error
Adding too many constraints to a prompt does not necessarily increase its
complexity. Instead, it results in a very specific task that does not contribute
effectively to training the model.
Best Practices
The goal should be to make the prompt challenging enough to push the
model's capabilities without overwhelming it with excessively specific
requirements:
Adding these best practices, ensures the prompt remains broad enough to be
useful for training while still presenting a meaningful challenge.
Need Help?
Response Design:
Verbosity
Common Error
There are multiple sentences to explain concepts that are possible within a
sentence or two.
Best Practices
Keeping responses clear and to the point ensures that the message is
effectively conveyed and understood.
Lack of details
Common Error
Provide responses that are too simplistic and do not address the full
scope or complexity of the prompt.
Ensure that the response includes all necessary details and addresses
the prompt comprehensively.
Break down the task into detailed steps and ensure each step is
thoroughly explained.
Need Help?
Instruction Following:
Incomplete Explanation
Common Error
Provide responses that do not fully explain the reasoning or process behind
the solution.
Best Practices
Include comprehensive explanations for each step and justify why certain
methods or approaches are used if needed/asked in the prompt.
Problem Reflection
Common Error
Best Practices
Need Help?
Grammar:
Typos
Common Error
Typos can undermine the credibility of a document and lead to
misunderstandings. It could also be one of the reasons why the code doesn't
compile correctly.
Best Practices
Proofreading:
Code Reviews:
Use code review tools and platforms that provide integrated discussion
and annotation features.
Don't forget!
By following these best practices, you ensure that your task is well-
spelling mistakes, and make sure you follow the instructions according
🐝