텍스트 교정하기
교정이 필요한 텍스트가 있으신가요? Databricks SDK를 사용해 AI 모델에게 텍스트 교정을 요청해 보세요. AI 모델이 교정된 텍스트와 함께 구체적으로 수정한 내용 목록을 반환해 드립니다.
이 연습은 강의의 일부입니다
Python SDK로 Databricks 다루기
연습 안내
- 워크스페이스 클라이언트에서 AI 모델을 쿼리하는 데 사용하는 클래스를 호출하세요.
- AI 모델에게 이후 쿼리 응답 방식에 대한 지침을 제공하는 역할을 입력하세요.
- 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.____}")