Get startedGet started for free

Proofreading text

Have text that you want to proofread? Use the Databricks SDK to ask an AI model to proofread your text for you. It will send you back the proofread version of your text and a list of the specific changes it made.

This exercise is part of the course

Databricks with the Python SDK

View Course

Exercise instructions

  • Query the class in the workspace client used to query AI models.
  • Fill in the role used to provide instructions to the AI model on how to answer future queries.
  • Fill in the role used when sending a query to the AI model.
  • Print the message details from the AI model response.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

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.____}")
Edit and Run Code