본문으로 건너뛰기

ChatGPT와 Streamlit을 이용한 챗봇(1)

SeHyoung Kim

2023.05.10

최근 ChatGPT API와 Streamlit을 이용한 챗봇을 많이 만들길래 저도 한번 따라해 보았습니다. 아직 많이 부족하지만 재미있게 봐주시고, 피드백은 환영입니다.
Dacon 대회와 함께 진행하며 공부하고 있는데 맨 아래에 홈페이지 들어가셔서 좋아요 눌러주시면 감사하겠습니다 :)

기능은 해외 뉴스 기사를 입력받으면 이를 이용해 기업 코드 추출, 요약, 관련 전문 지식 설명 입니다.
총 세번의 ChatGPT모델을 이용하였습니다.
1) 기업 코드 추출
2) 한글로 요약
3) 전문 지식 설명
이를 효율적으로 해보기 위해서 few-shot prompting을 활용해 보았습니다. user와 assistant의 content를 활용하여 모델을 만드니 성능 자체는 괜찮은 것 같습니다.

ChatGPT에서 추출한 기업 코드를 이용해서 yfinance에서 데이터를 가져오고, Prophet과 함께 이용하여 예측 모델을 만들어 제공해주는 것입니다.

만들면서 아쉬웠던 점은 속도입니다. 해외 뉴스 기사를 입력했을 때, 완전히 정보를 도출하기까지 시간이 조금 걸리더라구요..ㅠㅠ


많이 부족하지만 재미있게 보셨다면 좋아요 눌러주시면 감사하겠습니다 :)


3

함께 이야기해요 3

로그인하고 댓글을 남겨 주세요

S
SeHyoung Kim2023.05.10
적극적인 피드백 환영입니다 :)
성정환 프로필 이미지
성정환2023.05.11
오오 도움 많이 될거같아요! 궁금한게 관련회사는 어떻게 찾는건가요?
S
SeHyoung Kim2023.05.11
 
"role": "system", "content": "The system outputs the company's name and yfinance symbol in the form of {company name: symbol} in a news article."

이렇게 시스템 역할을 설정한 다음에,
{"role": "user", "content": """
Apple and Nike is developing an AI-powered health coaching service code named Quartz, according to a new report from Bloomberg’s Mark Gurman. The tech giant is reportedly also working on technology for tracking emotions and plans to roll out an iPad version of the iPhone Health app this year.
The AI-powered health coaching service is designed to help users stay motivated to exercise, improve their eating habits and sleep better. The idea behind the service is to use AI and information from a user’s Apple Watch to develop coaching programs specially tailored for them. As with Apple’s other services, the health coaching service is expected to have a monthly fee.
Several teams at Apple are reportedly working on the project, including the company’s health, Siri and AI teams. Gurman writes that the service is planned for next year but notes that it could be postponed or shelved altogether.
In addition, the report says Apple’s Health app will be getting tools for tracking emotions and managing vision conditions, such as nearsightedness. The launch version of the emotion tracker will allow users to log their mood, answer questions about their day and compare their results over time. In the future, Apple reportedly hopes the mood tracker will be able to use algorithms to understand a user’s mood based on their speech, text and other data.
        """},
        {"role": "assistant", "content": """
Apple:AAPL,Nike:NKE
        """}

이렇게 user와 assistant에 원하는 결과 예시를 추가하였습니다 :)


필요한 AI 정보만
메일함에 쏙쏙 넣어드려요.

지금 핫한 AI 소식부터 직접 해 본 사례까지, 월요일마다 무료로 받아보세요

이런 사례도 있어요

사례 전체 보기