การสร้างเนื้อหาใหม่

Claude Models เบื้องต้น

Nikhil Rangarajan

Data Scientist

การสร้างเนื้อหาเชิงสร้างสรรค์

  • ก้าวข้ามการแปลงข้อความสู่การสร้างสรรค์ต้นฉบับ
    • เรื่องราว

หนังสือเปิดอยู่

Claude Models เบื้องต้น

การสร้างเนื้อหาเชิงสร้างสรรค์

  • ก้าวข้ามการแปลงข้อความสู่การสร้างสรรค์ต้นฉบับ
    • เรื่องราว
    • คัดลอกการตลาด

หนังสือเปิดอยู่และหน้าเว็บแสดงคัดลอกการตลาด

Claude Models เบื้องต้น

การสร้างเนื้อหาเชิงสร้างสรรค์

  • ก้าวข้ามการแปลงข้อความสู่การสร้างสรรค์ต้นฉบับ
    • เรื่องราว
    • คัดลอกการตลาด
    • โค้ด

หนังสือเปิดอยู่ หน้าเว็บแสดงคัดลอกการตลาด และโค้ดสั้น ๆ

Claude Models เบื้องต้น

การสร้างเนื้อหาเชิงสร้างสรรค์

  • ก้าวข้ามการแปลงข้อความสู่การสร้างสรรค์ต้นฉบับ
    • เรื่องราว
    • คัดลอกการตลาด
    • โค้ด
    • อีเมล

หนังสือเปิดอยู่ หน้าเว็บแสดงคัดลอกการตลาด โค้ดสั้น ๆ และอีเมล

Claude Models เบื้องต้น

การสร้างเนื้อหาเชิงสร้างสรรค์

  • ก้าวข้ามการแปลงข้อความสู่การสร้างสรรค์ต้นฉบับ
    • เรื่องราว
    • คัดลอกการตลาด
    • โค้ด
    • อีเมล
    • สคริปต์

หนังสือเปิดอยู่ หน้าเว็บแสดงคัดลอกการตลาด โค้ดสั้น ๆ อีเมล และสคริปต์

Claude Models เบื้องต้น

การเขียน prompt สำหรับการสร้างเนื้อหาอย่างมีประสิทธิภาพ

$$

  • ความเฉพาะเจาะจง
  • Prompt กว้าง ๆ: ผลลัพธ์ทั่วไป
  • Prompt ละเอียด: เนื้อหาตรงเป้า
# 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."""
Claude Models เบื้องต้น

การเขียน prompt สำหรับการสร้างเนื้อหาอย่างมีประสิทธิภาพ

$$

  • กรณีใช้งาน Claude ที่พบบ่อยที่สุด: โค้ด
  • Prompt ที่เฉพาะเจาะจงนำไปสู่โค้ดที่ตรงเป้า
    • ภาษาโปรแกรม
    • ฟังก์ชันการทำงานที่ต้องการ
    • ข้อกำหนดการจัดการข้อผิดพลาด
    • ผลลัพธ์ที่คาดหวัง
# 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."""
Claude Models เบื้องต้น

ทำความเข้าใจ temperature

  • ช่วงค่า temperature: 0.0 (แน่นอน) ถึง 1.0 (สร้างสรรค์สูง)
    • Temperature ต่ำ (0.1-0.3): ผลลัพธ์สม่ำเสมอ คาดเดาได้
    • Temperature กลาง (0.4-0.7): สมดุลระหว่างความสร้างสรรค์และความสอดคล้อง
    • Temperature สูง (0.8-1.0): สร้างสรรค์สูงสุด คาดเดาได้ยาก

Temperature ตั้งแต่ 0 ถึง 1

Claude Models เบื้องต้น

การใช้ temperature ในการเรียกโมเดล

# 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)
Claude Models เบื้องต้น

การใช้ temperature ในการเรียกโมเดล

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...
Claude Models เบื้องต้น

การใช้พารามิเตอร์ `top_p`

$$

  • top_p (nucleus sampling): ทางเลือกแทน temperature สำหรับควบคุมความสร้างสรรค์
  • ค่าทั่วไป: 0.1 (เจาะจง) ถึง 0.9 (หลากหลาย)
  • ใช้ร่วมกัน: ใช้ temperature และ top_p พร้อมกันเพื่อควบคุมอย่างละเอียด

$$

client.messages.create(
model="claude-sonnet-4-6",
temperature=0.7,
top_p=0.3, #Likely words
messages=[{"role":"user", 
           "content":prompt}])
Claude Models เบื้องต้น

ฟีเจอร์ความปลอดภัยของ Claude

$$

  • 📝 จุดแข็งด้านเนื้อหา: การเขียน การวิเคราะห์ การเขียนโค้ด งานสร้างสรรค์
  • 🚫 ความปลอดภัยในตัว: ปฏิเสธเนื้อหาที่เป็นอันตราย ยึดแนวทางจริยธรรม
  • ✅ แนวทางปฏิบัติที่ดี: ใช้ prompt ที่ชัดเจน ทดลองปรับพารามิเตอร์ ตรวจสอบผลลัพธ์
Claude Models เบื้องต้น

มาฝึกกันเถอะ!

Claude Models เบื้องต้น

Preparing Video For Download...