이번 강의에서는 챗봇을 만들어봅니다. 여태까지의 강의에서는 나(user)의 프롬프트에 ChatGPT(assistant)가 답을 출력해주는 형태를 만들어주는 방식으로 실습을 해봤습니다.
이제 한발자국 더 나아가서
그림을 보면서 정리해볼까요
이제 챗봇을 위해 우리가 할 일은 messages 배열을 준비하는 것 뿐입니다
{"role": "system", "content": "입력부분"}
{"role": "user", "content": "입력부분"}
messages = [
messages = [
{'role':'system', 'content':'You are friendly chatbot.'},
{'role':'user', 'content':'Hi, my name is Isa'} ]
response = get_completion_from_messages(messages, temperature=1)
print(response)
# > Hello Isa! It's nice to meet you. How can I assist you today?
messages = [
{'role':'system', 'content':'You are friendly chatbot.'},
{'role':'user', 'content':'Hi, my name is Isa'},
{'role':'assistant', 'content': "Hi Isa! It's nice to meet you. \
Is there anything I can help you with today?"},
{'role':'user', 'content':'Yes, you can remind me, What is my name?'} ]
response = get_completion_from_messages(messages, temperature=1)
print(response)
마무리는 조그만거라도 당장 실현하라는 것!
마지막 말이 자신감을 길러주는데, 이제 당신들은 "이 과정을 마치셨으니 이제 여러분은 오늘날 소수의 사람만이 할 수 있는 일을 구축할 수 있는 풍부한 지식을 갖추게 될 것입니다. (And now that you've finished this course, I think you now have a wealth of knowledge that let you build things that few people today know how to.; translated by DeepL)"
자 아무거나라도 좋으니 실천해보자