Welcome to the official guide on how to use HonsetLLM. This post will cover the basics of getting started with our software and some advanced features that you can leverage to make the most out of it.
Getting Started
Before diving into the details, make sure you have HonsetLLMinstalled.
If you haven’t installed it yet, check out our installation guide.
Initial Setup
After installation, let’s set up the project.
1. import
# importsimport pandas as pd # for storing text and embeddings dataimport tiktoken # for counting tokensfrom read more
How to use
Welcome to the official guide on how to use HonsetLLM. This post will cover the basics of getting started with our software and some advanced features that you can leverage to make the most out of it.
Getting Started
Before diving into the details, make sure you have HonsetLLMinstalled.
If you haven’t installed it yet, check out our installation guide.
Initial Setup
After installation, let’s set up the project.
1. import
# imports
import pandas as pd # for storing text and embeddings data
import tiktoken # for counting tokens
from scipy import spatial # for calculating vector similarities for search
import re
from tqdm import tqdm
import json
import os
import sys
import urllib.request
2. setting your api keys
from openai import OpenAI #for chat_gpt api
openai.api_key = 'YOUR_API_KEY'
from newspaper import Article #for naver news api
client_id = "YOUR_CLIENT_ID"
client_secret = "YOUR_API_KEY"
3. run ‘generate answer’ function
The logic will extract keywords from your question. It will start a conversation by referring to news searches based on your keywords.
If you want to know more about how it works, read methods.
def generate_answer(question : str):
#find the keyword
keyword = find_keyword(openai, question)
#search news (naver api)
response = search_article(keyword)
#Embedding searched articles
article = make_article(response)
#Find articles similar to your question
most_related_article = collect_articles(keyword, article, top_n=5)
#Answering questions
response = generate_data(openai,most_related_article, question)
return response
Example
input
answer = generate_answer('손흥민의 최근 뉴스들을 알려줘')
answer = generate_answer('Keep up with the latest news from Heungmin Son')
output
answer
손흥민 선수에 관한 최근 뉴스에는 다음과 같은 내용이 포함되어 있습니다:
1. 주장으로서의 역할: 영국 매체 'TBR 풋볼'에 따르면, 엔제 포스테코글루 감독은 이번 시즌을 앞두고 손흥민 선수를 토트넘의 새로운 주장으로 임명하였습니다. 손흥민 선수는 주장으로서 첫 연설을 할 때 크게 긴장했다고 말했으며, 이는 그가 경험한 가장 긴장된 순간 중 하나였습니다.
2. 팀의 분위기 변화: 토트넘에서 주장이 된 이후, 손흥민 선수는 선수들을 하나로 뭉치게 하는 리더십을 발휘하고 있습니다. 경기장 밖에서도 선수들과 좋은 관계를 유지하며 좋은 경기력을 선보이고 있습니다. 이로 인해 토트넘은 시즌 초반 좋은 흐름을 타고 있지만, 최근에는 리그 2연패에 빠졌으며 승점 26으로 4위에 위치해 있습니다.
이 외에도, 토트넘은 현재 공격수 부문에서 변화가 있을 수 있는 상황에 놓여있습니다. 특히 히샬리송 선수가 사우디아라비아로 이적할 가능성이 언급되며, 토트넘은 새로운 공격수 영입을 고려하고 있는 상황입니다.
손흥민 선수 개인적으로는 토트넘에서 중요한 역할을 수행하고 있으며, 새로운 주장으로서 팀의 통합과 성과 향상을 위해 중요한 역할을 하고 있다는 점이 강조되고 있습니다.
answer
Recent news about Son Heung-min includes the following:
1. Role as captain: According to TBR Football, a British media outlet, Enze Postecoglou appointed Son Heung-min as the new captain of Tottenham ahead of this season. Son said he was very nervous when he gave his first speech as captain, and it was one of the most nerve-wracking moments he has ever experienced.
2. Changing the mood of the team: Since becoming captain of Tottenham, Heung-min has provided leadership that has brought the players together. He has a good relationship with his players off the field as well. Because of this, Tottenham had a good start to the season, but have recently lost two straight league games and are in fourth place with 26 points.
In addition to this, Tottenham are currently in a situation where there could be some changes in the forward department, especially with the possibility of a move to Saudi Arabia being mentioned, and Spurs are looking to bring in a new striker.
It is emphasized that Son Heung-min personally plays an important role for Tottenham, and as the new captain, he is playing an important role in the team's unity and performance.
Translated with www.DeepL.com/Translator (free version)
Comments