Notebooks
C
Cohere
Constructing Prompt Commands

Constructing Prompt Commands

llmunotebookscohere-developer-experience

Constructing Prompts for the Command Model

Prompts can be as simple as a one-liner, or they can be as complex as multiple layers of specific information. The more specific your command is, the more likely you will get exactly what you need from the model.

We’ll look at some tips and ideas for constructing the commands in your prompt to help you get to your intended outcome.

Read the accompanying article here.

Setup

[3]

Setup

[ ]

Function to generate text

Let’s define a text generation function that we'll use throughout this notebook.

[3]

Instruction

At its core, prompting a Command model is about sending an instruction to a text generation model and getting a response back. Hence, the smallest unit of a perfectly complete prompt is a short line of instruction to the model.

[4]
Sure! Here is a creative product description for the wireless headphone product named the CO-1T: 

**CO-1T Wireless Headphones: Immerse Yourself in Pure Audio Bliss**

Step into the future of audio with the CO-1T wireless headphones, your ultimate sonic companion. Crafted with precision and an unwavering attention to detail, these headphones are an ode to the perfect marriage of style and function. The CO-1T is designed to elevate your listening experience, taking you on an auditory journey like no other.

**Unparalleled Sound Quality**

Immerse yourself in a rich tapestry of sound, where every note resonates with crystal clarity. Our custom-tuned drivers deliver a powerful acoustic performance, ensuring a balanced and dynamic range that brings your music to life. Experience deep, thumping bass that pulsates through your veins, crisp mids, and soaring highs that linger long after the song has ended.

**Liberating Wireless Freedom**

Bid farewell to tangled cords and embrace the wireless revolution. The CO-1T connects seamlessly to your device, offering uninterrupted audio streaming from up to 30 feet away. With a stable Bluetooth 5.0 connection, you're free to move and groove without missing a beat. And when you're on the go, the sleek carrying case ensures effortless portability and quick charging, keeping you connected wherever your adventures take you.

**Ergonomic Design for Extended Comfort**

We understand that true immersion means losing yourself in the experience, so we've crafted the CO-1T with your comfort in mind. The ergonomic design ensures a secure and comfortable fit, allowing you to wear them for extended periods without fatigue. The soft, cushioned ear pads gently envelope your ears, creating a seal that blocks out ambient noise, so it's just you and your favorite tunes.

**Intuitive Touch Controls**

The CO-1T wireless headphones offer effortless control right at your fingertips. With intuitive touch sensors, you can seamlessly play, pause, skip tracks, and adjust volume with a simple tap or swipe. Answer calls with crystal-clear clarity, thanks to the built-in microphone, and activate your favorite voice assistant with a touch, keeping you connected and in control, all without reaching for your device.

**Aesthetic Appeal, Uncompromised**

More than just a listening device, the CO-1T is a fashion statement. The sleek and minimalist design language ensures these headphones complement any style, from casual to professional. Choose from a range of eye-catching colors to match your unique personality and taste. The CO-1T is proof that form and function can coexist harmoniously.

**Long-Lasting Battery Life**

Say goodbye to constant charging woes. The CO-1T wireless headphones offer an impressive battery life of up to 24 hours on a single charge, ensuring you stay connected throughout the day. And when you need a quick energy boost, the fast-charging feature provides up to 3 hours of playback time with just a 15-minute charge, so you're never far from your favorite tunes.

**Your Audio, Your Way**

Tailor your listening experience to your unique preferences with the CO-1T companion app. Fine-tune the EQ settings to match your favorite genres, create custom presets, and discover a whole new world of audio enhancements. The app also provides helpful tutorials, firmware updates, and exclusive content to ensure you get the most out of your headphones.

**The CO-1T Promise**

We are committed to delivering an exceptional audio experience, and that promise extends beyond the headphones themselves. The CO-1T wireless headphones come with a one-year warranty, ensuring your peace of mind. Should you ever need assistance, our dedicated customer support team is always ready to help, ensuring your CO-1T journey is nothing short of exceptional.

Elevate your audio game with the CO-1T wireless headphones. It's time to unlock a whole new world of immersive listening.

Specifics

A simple and short prompt can get you started, but in most cases, you’ll need to add specificity to your instructions.

Single paragraph

[5]
Introducing the CO-1T Wireless Headphones: Your New Sanctuary from Distractions

As a software developer, you know that focus is key. In noisy offices, where concentration can be hard to find, the CO-1T Wireless Headphones are your secret weapon. With these headphones, you can create your own personal sanctuary of calm and productivity, no matter the chaos around you.

**Bluetooth Freedom:**
First and foremost, the CO-1T offers Bluetooth connectivity, freeing you from the tangle of wires. No more feeling tethered to your desk; move freely, take that call away from your screen, and stay connected up to 10 meters away. 

**Crystal Clear Audio:** 
Experience superior sound quality with our custom-tuned drivers, delivering crisp, clear audio. Whether you're on a call or listening to music, every word and note is rendered with precision and clarity, ensuring you don't miss a beat. 

**Active Noise Cancellation:** 
Our advanced active noise cancellation technology blocks out distractions, letting you focus on the task at hand. The world around you fades away, leaving you immersed in your work, your music, or your call. 

**Fast Charging:** 
Time is precious, and we know you can't afford to be without your headphones. That's why the CO-1T headphones offer fast charging. Just 10 minutes of charging gives you up to 2 hours of playtime, ensuring you're never caught off guard. A full charge provides an impressive 24 hours of playtime, enough to power you through those long workdays and beyond. 

**Comfortable Design:** 
We understand that long hours demand comfort. That's why we've designed the CO-1T with soft, breathable ear cushions that gently envelop your ears, ensuring all-day comfort. The adjustable headband provides a secure, personalized fit, so you can wear them with ease from morning to night. 

**Easy Controls:** 
Seamlessly switch between your music and calls with intuitive, easy-to-use controls. The built-in microphone ensures that you can take calls with crystal-clear clarity, and the intuitive touch controls let you adjust volume, skip tracks, and answer calls with a simple tap. 

The CO-1T Wireless Headphones are the ultimate tool for software developers seeking focus and calm in their busy, noisy environments. So, create your sanctuary, block out the distractions, and let your productivity soar. 

Your headphones, your sanctuary.

Structured

In the example above, we pack the additional details of the prompt in a single paragraph. Alternatively, we can also compose it to be more structured, like so:

[6]
Escape the chaos of your office and enter a world of focus with the CO-1T wireless headphones. These headphones are specifically designed for software developers like yourself who need peace and quiet to write code and troubleshoot. With a busy work environment, the last thing you need is the hassle and restriction of tangled wires. The CO-1T headphones offer a seamless Bluetooth connection, providing you with true wireless freedom. No more feeling tethered to your desk—move around the office freely and stay connected to your tasks without any distractions.
 
 One of the standout features of the CO-1T headphones is their fast-charging capability. A quick 10-minute charge gives you up to 4 hours of playtime, ensuring you're never without your focus-inducing soundtrack. Need to block out the noise completely? The active noise cancellation feature does just that, allowing you to immerse yourself in your work and forget the chaos around you. When you need to collaborate, the built-in microphone has you covered, providing clear and crisp call quality.
 
 The benefits of the CO-1T wireless headphones are clear: freedom, focus, and flexibility. Free yourself from distractions and immerse yourself in a world tailored to your productivity. With these headphones, you can create your own quiet workspace, no matter how noisy your office is.

Context

While LLMs excel in text generation tasks, they struggle in context-aware scenarios. In real applications, being able to add context to a prompt is key because this is what enables personalized generative AI for a team or company. It makes many use cases possible, such as intelligent assistants, customer support, and productivity tools, that retrieve the right information from a wide range of sources and add it to the prompt.

Without Context

[7]
The CO-1T wireless headphone is an innovative and feature-rich audio device designed for immersive listening experiences. Here are its key features: 

- Superior Sound Quality: CO-1T headphones deliver exceptional audio performance with clear and powerful sound. Enhanced bass response and crisp treble ensure an enjoyable listening experience across various music genres. 

- Active Noise Cancellation (ANC): Advanced ANC technology effectively blocks out unwanted background noise, allowing you to focus on your music, podcasts, or calls without distractions. You can fully immerse yourself in your audio world, even in noisy environments. 

- Transparency Mode: This mode uses the headphone's built-in microphones to amplify ambient sounds, ensuring you remain aware of your surroundings. It's ideal for situations where you need to be attentive, like when walking on busy streets or waiting for important announcements. 

- Long-lasting Battery Life: The CO-1T offers impressive battery performance, providing up to 30 hours of continuous playback on a single charge with ANC turned on. Even with heavy usage, you can rely on these headphones to keep the music going throughout the day. 

- Fast Charging: A quick 10-minute charge gives you up to 5 hours of listening time, ensuring you're never without your music for long. 

- Comfortable Design: The headphones feature soft, padded earcups and an adjustable headband for a comfortable fit, making them ideal for extended listening sessions. 

- Touch Controls: Easy-to-use touch controls on the earcups let you adjust volume, play/pause music, answer calls, and activate voice assistants with simple gestures. 

- Multipoint Connection: Connect to two devices simultaneously and seamlessly switch between them. This feature is handy when you want to connect to both your phone and laptop without constantly pairing and unpairing. 

- Voice Assistant Integration: Seamlessly access popular voice assistants like Siri and Google Assistant with a simple touch, allowing for hands-free control and added convenience. 

- Foldable Design: The headphones fold down to a compact size, making them easy to carry and store in the included hard case. 

- Bluetooth 5.0: Ensures a stable and reliable wireless connection with reduced audio latency and improved power efficiency. 

The CO-1T wireless headphones offer a comprehensive set of features that cater to modern audio enthusiasts, providing an exceptional blend of sound quality, convenience, and flexibility.

With Context

[8]
The key features of the CO-1T wireless headphones are: 

- Noise-canceling capabilities: This feature allows the user to block out surrounding chaos and work or relax in peace, making it ideal for busy offices or commutes. 

- Fast-charging capacity: The CO-1T headphones can quickly charge, ensuring they are ready for use whenever needed and providing an efficient and convenient way to keep the headphones powered. 

- Wireless Bluetooth connectivity: With Bluetooth, the headphones offer a seamless and wire-free listening experience, giving the user freedom of movement and ease of use. 

- Partnership-designed: These headphones are designed in partnership with software developers who work in busy, chaotic environments, ensuring the product is tailored to the needs of those seeking a quiet, focused work environment. 

The CO-1T headphones seem to be a great option for anyone seeking a peaceful and productive day, offering a break from the overwhelming noise of the world.

Examples

All our prompts so far use what is called zero-shot prompting, which means that we are providing instruction without any example. But in many cases, it is extremely helpful to provide examples to the model to guide its response. This is called few-shot prompting.

Without Examples (Zero-Shot)

[9]
Sure! I have drafted the following message: 

"Hey Alison! I was wondering if you could pick me up tonight so we can go to the concert together. Let me know if that works for you!" 

Would you like to revise the message before I send it?

With Examples (Few-Shot)

[10]
Action: Can you pick me up tonight so we can go to the concert together?

Chain of Thought

One specific way to provide examples in a prompt is to show responses that include a reasoning step. This way, we are asking the model to “think” first rather than going straight to the response.

Without Examples

[25]
There are 14 red balls in the box.

The box originally had 5 red balls, as half of the 10 balls were red. With the addition of 4 more red balls, the total number of red balls becomes 9. Therefore, there are 14 red balls in the box.

With Examples

[28]
Initially, there are 12 x 1/2 = 6 red balls in the box. After adding 4 red balls, there are 6 + 4 = 10 red balls. So, there are 10 red balls in the box.

Format

We can also get the model to generate responses in a certain format. Let’s look at a couple of them: markdown tables and JSON strings.

Table Format

[30]
| Invoice Number | Merchant Name | Account Number |
| --- | --- | --- |
| INVOICE #0521 | ALLBIRDS | XXX3846 |
| INVOICE #6781 | SHOPPERS | XXX9877 |
| INVOICE #0777 | CN TOWER | XXX3846 |

JSON Format

[31]
```json
[
    {
        "Invoice Number": "INVOICE #0521",
        "Merchant Name": "ALLBIRDS",
        "Account Number": "XXX3846"
    },
    {
        "Invoice Number": "INVOICE #6781",
        "Merchant Name": "SHOPPERS",
        "Account Number": "XXX9877"
    },
    {
        "Invoice Number": "INVOICE #0777",
        "Merchant Name": "CN TOWER",
        "Account Number": "XXX3846"
    }
]
```

Steps

To steer the model toward generating higher-quality responses, it can be helpful to add instructions for the model to generate intermediate steps before generating the final output. The information generated during these steps helps enrich the model’s context before it generates the final response.

Without Steps

[36]
Here's a startup idea for the education industry:

**Personalized Learning Platform**

The idea is to create an online platform that offers personalized learning experiences for students. The platform would use advanced algorithms and machine learning techniques to adapt to the unique needs and learning style of each student.

Here's how it could work:

- **Assessment:** When a student signs up, they take an initial assessment to determine their current knowledge and skill level in a particular subject. The platform also evaluates their learning preferences, such as visual, auditory, or kinesthetic learning.
- **Personalized Curriculum:** Based on the assessment results, the platform generates a personalized curriculum for each student. This curriculum adapts as the student progresses, ensuring that the content and pace of learning are tailored to their individual needs.
- **Interactive Content:** The platform offers a variety of interactive content types, including videos, simulations, games, and virtual reality experiences, to engage students and cater to different learning styles.
- **Real-time Feedback:** The system provides immediate feedback to students as they complete assignments and quizzes, helping them understand their strengths and weaknesses and allowing them to adjust their learning strategies accordingly.
- **Adaptive Practice:** The platform uses spaced repetition and adaptive learning techniques to reinforce concepts and ensure that students retain information over time.
- **Teacher Support:** In addition to the personalized learning experience, the platform provides teachers with tools to track student progress, identify areas of improvement, and offer additional support and resources as needed.
- **Collaborative Features:** Students can also interact with their peers through discussion forums, study groups, and collaborative projects, fostering a sense of community and allowing them to learn from each other.

The key advantage of this startup idea is its ability to personalize the learning experience for each student, ensuring that they receive education tailored to their unique needs and learning style. This can lead to improved academic performance, increased engagement, and a more enjoyable learning journey.

To monetize the platform, you could consider subscription models for students or schools, offering different tiers of access and support. Partnerships with educational institutions and companies that provide interactive learning content could also be explored.

This startup idea leverages technology to revolutionize the way students learn, making education more effective, engaging, and accessible to all.

With Steps

[37]
Industry: Education

The Problem: Students often struggle to retain information and stay engaged during traditional lecture-based learning sessions. This can lead to lower academic performance and a lack of interest in the subject matter. The challenge is to make learning more interactive, immersive, and engaging to improve knowledge retention and academic outcomes.

Audience: This startup idea targets two primary audiences. The first is students in middle school, high school, and college who are looking for alternative and more effective ways to learn and retain information. The second audience is educational institutions and teachers who are always seeking innovative methods to enhance their teaching practices and improve student engagement and outcomes.

Startup Idea: Immersive Learning Experiences

The startup idea is to create an educational platform that offers immersive and interactive learning experiences to students. The platform will utilize virtual reality (VR) and augmented reality (AR) technologies to develop interactive and engaging learning modules across various subjects.

Here's how it works:

- Students will be able to access the platform and choose from a range of interactive learning experiences tailored to different subjects and topics.
- Each learning module will be designed to be highly immersive and interactive. For example, a history lesson might involve a VR reconstruction of an ancient battlefield, allowing students to explore and interact with the environment while learning about key historical events.
- The platform will also incorporate gamification elements, such as quests, challenges, and leaderboards, to encourage student engagement and create a fun learning environment.
- The learning experiences will be developed in collaboration with subject matter experts and educators to ensure accuracy and pedagogical effectiveness.
- Teachers will also have the ability to customize and adapt the modules to suit the specific needs of their classrooms.

By using immersive technologies and interactive storytelling, the startup will transform passive learners into active participants, greatly enhancing knowledge retention and making learning an enjoyable experience.

Startup Name: ImmerseEdu