Tạo nội dung mới

Nhập môn các mô hình Claude

Nikhil Rangarajan

Data Scientist

Tạo nội dung sáng tạo

  • Vượt ngoài chuyển đổi văn bản sang sáng tạo gốc
    • Truyện

Một cuốn sách mở

Nhập môn các mô hình Claude

Tạo nội dung sáng tạo

  • Vượt ngoài chuyển đổi văn bản sang sáng tạo gốc
    • Truyện
    • Nội dung marketing

Một cuốn sách mở và trang web hiển thị nội dung marketing

Nhập môn các mô hình Claude

Tạo nội dung sáng tạo

  • Vượt ngoài chuyển đổi văn bản sang sáng tạo gốc
    • Truyện
    • Nội dung marketing

Một cuốn sách mở, trang web hiển thị nội dung marketing và đoạn mã

Nhập môn các mô hình Claude

Tạo nội dung sáng tạo

  • Vượt ngoài chuyển đổi văn bản sang sáng tạo gốc
    • Truyện
    • Nội dung marketing
    • Email

Một cuốn sách mở, trang web hiển thị nội dung marketing, đoạn mã và email

Nhập môn các mô hình Claude

Tạo nội dung sáng tạo

  • Vượt ngoài chuyển đổi văn bản sang sáng tạo gốc
    • Truyện
    • Nội dung marketing
    • Email
    • Kịch bản

Một cuốn sách mở, trang web hiển thị nội dung marketing, đoạn mã, email và kịch bản

Nhập môn các mô hình Claude

Viết prompt tạo nội dung hiệu quả

$$

  • Mức độ cụ thể
  • Nhắc mơ hồ: Kết quả chung chung
  • Nhắc chi tiết: Nội dung đúng mục tiêu
# Vague prompt
prompt = "Write a product description"

# Specific prompt prompt = """Write a 150-word product description for a wireless bluetooth speaker targeting college students. Use an energetic, casual tone and highlight portability, battery life, and sound quality."""
Nhập môn các mô hình Claude

Viết prompt tạo nội dung hiệu quả

$$

  • Trường hợp dùng Claude phổ biến nhất: mã
  • Prompt cụ thể tạo mã đúng mục tiêu
    • Ngôn ngữ lập trình
    • Chức năng cụ thể
    • Yêu cầu xử lý lỗi
    • Đầu ra kỳ vọng
# Vague prompt
prompt = "Write some code"

# Specific prompt  
prompt = """Write a Python function 
that validates email addresses 
using regex. 
Include error handling for invalid 
inputs and return both boolean result 
and descriptive error message."""
Nhập môn các mô hình Claude

Hiểu về nhiệt độ

  • Dải nhiệt độ: 0.0 (quyết định) đến 1.0 (rất sáng tạo)
    • Thấp (0.1–0.3): Ổn định, dự đoán được
    • Trung bình (0.4–0.7): Cân bằng sáng tạo và mạch lạc
    • Cao (0.8–1.0): Sáng tạo tối đa, khó đoán hơn

Thang nhiệt độ từ 0 đến 1

Nhập môn các mô hình Claude

Nhiệt độ trong lệnh gọi mô hình

# Conservative generation
response1 = client.messages.create(
    model="claude-sonnet-4-6",
    temperature=0.2,
    messages=[{"role": "user", "content": prompt}])

# Creative generation response2 = client.messages.create( temperature=0.8, messages=[{"role": "user", "content": prompt}])
print("Temperature 0.2 Response (Conservative)") print(response1.content[0].text)
print("Temperature 0.8 Response (Creative)") print(response2.content[0].text)
Nhập môn các mô hình Claude

Nhiệt độ trong lệnh gọi mô hình

Temperature 0.2 Response (Conservative)
A rainbow is an optical phenomenon that occurs when sunlight and rain are present 
simultaneously. It forms when white light from the sun passes through water 
droplets in the atmosphere, causing the light to refract, reflect, and disperse 
into its component colors...

Temperature 0.8 Response (Creative)
Ah, rainbows! Those magical bridges painted across stormy skies that never fail 
to make us pause and wonder. Picture this: millions of tiny water droplets hanging 
in the air after a rainfall, each one acting like a miniature crystal ball. When 
sunlight hits these droplets, something absolutely enchanting happens...
Nhập môn các mô hình Claude

Dùng tham số top_p

$$

  • top_p (lấy mẫu hạt nhân): Thay thế nhiệt độ để kiểm soát sáng tạo
  • Giá trị điển hình: 0.1 (tập trung) đến 0.9 (đa dạng)
  • Kết hợp: Dùng đồng thời temperature và top_p để kiểm soát chính xác

$$

client.messages.create(
model="claude-sonnet-4-6",
temperature=0.7,
top_p=0.3, #Likely words
messages=[{"role":"user", 
           "content":prompt}])
Nhập môn các mô hình Claude

Tính năng an toàn của Claude

$$

  • 📝 Thế mạnh nội dung: Viết, phân tích, lập trình, sáng tạo
  • 🚫 An toàn tích hợp: Từ chối nội dung gây hại, tuân thủ chuẩn đạo đức
  • ✅ Thực hành tốt: Prompt rõ ràng, thử tham số, rà soát đầu ra
Nhập môn các mô hình Claude

Ayo berlatih!

Nhập môn các mô hình Claude

Preparing Video For Download...