ตรวจทานข้อความ
มีข้อความที่ต้องการตรวจทานอยู่ใช่ไหม? ใช้ Databricks SDK เพื่อให้โมเดล AI ช่วยตรวจทานข้อความให้ โมเดลจะส่งคืนข้อความที่ตรวจทานแล้วพร้อมรายการการเปลี่ยนแปลงที่ทำไป
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Databricks กับ Python SDK
คำแนะนำการฝึกหัด
- เรียกใช้คลาสใน workspace client ที่ใช้สำหรับเรียกใช้งานโมเดล AI
- ระบุ role ที่ใช้กำหนดคำแนะนำให้โมเดล AI ว่าควรตอบคำถามในอนาคตอย่างไร
- ระบุ role ที่ใช้เมื่อต้องการส่งคำถามไปยังโมเดล AI
- แสดงผลรายละเอียดข้อความจากการตอบกลับของโมเดล AI
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
w = WorkspaceClient()
text_to_proofread = "I am gong to the stor to buy some bred. I migt also buy some mlk. Do u want to jon me?"
# Query the AI model via the workspace client
response = w.____.query(
name="databricks-meta-llama-3-3-70b-instruct",
messages=[
ChatMessage(
# Specify the role for configuring model behavior
role=ChatMessageRole.____, content=f"You are a helpful writing assistant. "
),
ChatMessage(
# Specify the role for sending the query
role=ChatMessageRole.____, content=f"Proofread the following text: {text_to_proofread}"
),
],
max_tokens=200)
# Print the content of the model's response
print(f"RESPONSE:\n{response.choices[0].message.____}")