From the course: Building with the Claude API by Anthropic
Unlock this course with a free trial
Join today to access over 25,600 courses taught by industry experts.
Controlling model output - Claude Tutorial
From the course: Building with the Claude API by Anthropic
Controlling model output
Besides just changing our prompts that we send into Claude, there are two other ways we could strongly influence the output that we get out of it. So in this video, we're going to discuss two techniques. One is pre-filling assistant messages. The second is stop sequences. Let's first take a look at pre-filling assistant messages. Okay, let's imagine that we send Claude some kind of really tough to answer question. Something like, is tea or coffee better at breakfast? I have absolutely no idea what kind of response Claude would give me. As a matter of fact, let's go over to our Jupyter notebook really quickly and see what kind of response we get in the first place. Back inside of my notebook, I'm creating an empty list of messages. I'm then going to add in a user message with text of is tea or coffee better at breakfast. I then feed in the list messages to our chat function and then I'm going to print out the answer that we get back. I'm going to run this. Then if we take a look at the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Accessing the API5m 18s
-
(Locked)
Making a request6m 2s
-
(Locked)
Multi-turn conversations8m 54s
-
(Locked)
Chat exercise3m 54s
-
(Locked)
System prompts6m 20s
-
(Locked)
System prompts exercise1m 25s
-
(Locked)
Temperature6m 7s
-
(Locked)
Response streaming8m 23s
-
(Locked)
Controlling model output6m 27s
-
(Locked)
Structured data5m 59s
-
(Locked)
Structured data exercise4m 57s
-
(Locked)
-
-
-
-
-
-
-
-
-