찾기 및 바꾸기
찾기 및 바꾸기 도구는 수십 년 동안 사용되어 왔지만, 정확히 일치하는 단어나 문구를 식별하고 바꾸는 데에만 국한되는 경우가 많았습니다. 자동차에 대해 설명하는 텍스트 블록이 제공되었으니, 채팅 완성 모델을 사용해 이 텍스트를 비행기에 대한 내용으로 적절히 수정해 보세요.
이 연습은 강의의 일부입니다
Python으로 DeepSeek 활용하기
연습 안내
deepseek-ai/DeepSeek-V4-Pro-0813에prompt를 전송하는 요청을 만들어, 자동차에 대한 텍스트 구절을 비행기에 대한 내용으로 바꾸세요. 최대 토큰 수는100으로 설정합니다.- API의 텍스트 응답을 추출하여 출력하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
client = OpenAI(api_key="", base_url="https://api.together.xyz/v1")
prompt="""Replace car with plane and adjust phrase:
A car is a vehicle that is typically powered by an internal combustion engine or an electric motor. It has four wheels, and is designed to carry passengers and/or cargo on roads or highways. Cars have become a ubiquitous part of modern society, and are used for a wide variety of purposes, such as commuting, travel, and transportation of goods. Cars are often associated with freedom, independence, and mobility."""
# Create a request to the chat model
response = client.chat.completions.create(
model="deepseek-ai/DeepSeek-V4-Pro-0813",
messages=[{"role": "user", "____": ____}],
____
)
# Extract and print the response text
print(response.choices[0].____.____)