BaldiSlayer / rofl-lab1

4 stars 6 forks source link

feat llm: add system prompt #90

Open stewkk opened 1 week ago

stewkk commented 1 week ago

closes #91

stewkk commented 1 week ago
def parse_similar_objects(text: str):
    splitted = []

    question_answer_pairs = text.split("Похожие объекты: ")[1].split("Вопрос: ")

    for qa_pair in question_answer_pairs:
        qa_pair = qa_pair.strip()

        if qa_pair == "":
            continue

        question, answer = qa_pair.split("Ответ: ")[:2]
        question, answer = question[:-2].strip(), answer.strip()

        splitted.append(f"<question>{question}</question> <answer>{answer}</answer>")

    return splitted
BaldiSlayer commented 5 days ago
def parse_similar_objects(text: str):
    splitted = []

    question_answer_pairs = text.split("Похожие объекты: ")[1].split("Вопрос: ")

    for qa_pair in question_answer_pairs:
        qa_pair = qa_pair.strip()

        if qa_pair == "":
            continue

        question, answer = qa_pair.split("Ответ: ")[:2]
        question, answer = question[:-2].strip(), answer.strip()

        splitted.append(f"<question>{question}</question> <answer>{answer}</answer>")

    return splitted

Теперь это ненужно, так как я поменял api