-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minhye01 #2
base: main
Are you sure you want to change the base?
Minhye01 #2
Conversation
|
||
|
||
# 주어진 문자열을 임베딩하는 함수 | ||
def embed(text: str, model: str, wait_time: float = 0.1) -> list: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
decorator
|
||
|
||
# 주어진 프롬프트에 따라 답변을 생성하는 함수 | ||
def generate(model: str, messages=list) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
retry decorator
user_question: str, | ||
num_context: int, | ||
min_sim_score: float, | ||
) -> Union[str, bool]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
str | bool
|
||
# 유저의 질문을 대답하기 위한 문맥을 찾는 함수 | ||
def find_context( | ||
vector_db: pd.DataFrame, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
뭔가 어색
|
||
user_vector = embed(user_question, model, wait_time=0) | ||
|
||
cosine_similarities = cosine_similarity( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calcuate ~~
context = "" | ||
for i in range(num_context): | ||
context += f"\n Context {i+1} \n" | ||
context += vector_db["QA"].iloc[top_indices[i]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for -> list genetor
context = "~~~".join([ i + "..." for i in numbers])
@@ -0,0 +1,74 @@ | |||
import pandas as pd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chatbot/chatbot/chatbot.py 는 뭔가 어색하다
import pandas as pd | ||
import yaml | ||
from exceptions import ExitReason | ||
from LLM import generate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
llm_service
|
||
# 답변에 활용할 문맥 검색 | ||
context = find_context( | ||
vector_db, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이름 잘 생각해보기
) | ||
|
||
# 답변에 활용할 문맥 검색 | ||
context = find_context( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# vector_database/base.py
class VectorDatabase(ABC):
def find_context():
raise NotImplementedError()
# vector_database/local.py
class PandasBasedVectorDatbase(VectorDatabase):
def find_context(..)
No description provided.