ComenzarEmpieza gratis

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.

Este ejercicio forma parte del curso

Databricks with the Python SDK

Ver curso

Instrucciones del ejercicio

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

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

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 roles 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.____}")
Editar y ejecutar código