Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Minhye01 #2

wants to merge 2 commits into from

Conversation

joowon-dm-snu
Copy link
Collaborator

No description provided.



# 주어진 문자열을 임베딩하는 함수
def embed(text: str, model: str, wait_time: float = 0.1) -> list:
Copy link
Collaborator Author

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:
Copy link
Collaborator Author

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]:
Copy link
Collaborator Author

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,
Copy link
Collaborator Author

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(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calcuate ~~

Comment on lines +42 to +45
context = ""
for i in range(num_context):
context += f"\n Context {i+1} \n"
context += vector_db["QA"].iloc[top_indices[i]]
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이름 잘 생각해보기

)

# 답변에 활용할 문맥 검색
context = find_context(
Copy link
Collaborator Author

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(..)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants