Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Databricks with the Python SDK

Cursus bekijken

Oefeninstructies

  • 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.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

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 class in the workspace client used to query AI models
response = w.____.query(
  name="databricks-meta-llama-3-3-70b-instruct",
  messages=[
        ChatMessage( 
          	# Fill in the role used to provide instructions to the AI model on how to answer future queries
            role=ChatMessageRole.____, content=f"You are a helpful writing assistant. "
        ),
        ChatMessage( 
          	# Fill in the role used when sending a query to the AI model
            role=ChatMessageRole.____, content=f"Proofread the following text: {text_to_proofread}"
        ),
    ],
  max_tokens=200)

# Print the message details from the AI model response
print(f"RESPONSE:\n{response.choices[0].message.____}")
Code bewerken en uitvoeren