GPT4 create your chatbot











>> YOUR LINK HERE: ___ http://youtube.com/watch?v=PM_rKVJ91Is

Today we are going to learn how to create with the new GPT-4 version a chat bot that is able to read Reuters.com and use the info as an output in the chat, instead to use old 2021 info • Here is the code created by GPT • • import openai • import os • import feedparser • api_key = your api key here • openai.api_key = api_key • Fetch latest news from Reuters RSS feed • def fetch_reuters_news(): • url = http://feeds.reuters.com/reuters/topNews • feed = feedparser.parse(url) • news_items = [] • for entry in feed.entries: • headline = entry.title • summary = entry.summary • news_items.append((headline, summary)) • return news_items • def ask_gpt_with_news(question, news_items): • news_prompt = \ • .join([f {headline}\ • {summary} for headline, summary in news_items]) • prompt = f Latest news from Reuters:\ • {news_prompt}\ • \ • Question: {question}\ • Answer: • response = openai.Completion.create( • engine= text-davinci-002 , • prompt=prompt, • max_tokens=150, • n=1, • stop=None, • temperature=0.5, • ) • answer = response.choices[0].text.strip() • return answer • news_items = fetch_reuters_news() • while True: • user_question = input( You: ) • if user_question.lower() == exit : • break • gpt_answer = ask_gpt_with_news(user_question, news_items) • print( GPT-3.5: + gpt_answer) • • AWS Load Balancer Controller with EKS, our free webinar: http://mkdev.me/webinars/aws-lb-contr... • Check out mkdev dispatch, a bi-weekly newsletter about DevOps and Cloud-Native - https://mkdev.me/dispatch • DevOps Accents is our monthly podcast, where 3 mkdev founders chat about DevOps, Cloud, and Life: https://mkdev.me/podcast • If you or your company need consulting around Kubernetes, GitOps, and similar topics, reach out to us via email - at [email protected] or check out our website: https://mkdev.me • #GPT #GPT4 #GPT3 #chat #chatbot #pyhton

#############################









Content Report
Youtor.org / Youtor.org Torrents YT video Downloader © 2024

created by www.mixer.tube