docs = """When and under what conditions can I apply to your graduate programs? Graduate student admissions are made in the fall and spring semesters specified in the academic calendar. Minimum application requirements: 
To have the undergraduate degree required in the program application requirements To have at least 55 points from ALES in the field required in the program application conditions. For the PhD Program, getting at least 55 points from the Foreign Language Exam
Can I apply to more than one graduate program? You can apply to 1 Master's program without thesis and 1 Master's program with thesis or 1 Master's program without thesis and 1 PhD program. 
Will I pay a fee for graduate programs? Master's and PhD programs with thesis are free of charge, but if you cannot graduate within the normal period, you will pay a fee until your maximum period expires.
Non-thesis Master's programs are paid and the total fee of our institute's programs is 5500.00 TL. It is collected in two equal installments at the beginning of the semester. Distance Education Non-Thesis Master's Degree programs are paid and the total fee is 6500,00 TL. It is collected in two equal installments at the beginning of the semester.
In non-thesis master's programs, free of charge for the relatives of martyrs and veterans, and for the disabled; discounts are made according to disability rates. The fee for the employees of the institution with a protocol in non-thesis master's programs is 3400TL.
The total fee for Aksaray University staff is 2000TL. How long is the military service deferment (extension) period for graduate programs? Does the institute do this process?
It is 1.5 years for non-thesis Master's programs, 3 years for Master's programs with thesis and 6 years for PhD programs. Our institute makes the deferment procedures within 1 month from the date of registration."""

with open("./AsuAI/FAQ-DeepL.txt", mode="r", encoding="utf-8") as file:
    docs2 = file.read()

docs2_1 = docs2[:4000]

# api key
import os

from dotenv import load_dotenv

load_dotenv(".env")
api_key = os.environ.get("OPENAI_API_KEY")

import langchain
from langchain.cache import SQLiteCache

langchain.llm_cache = SQLiteCache(database_path=".langchain.db")

import deepl
from langchain.chat_models import ChatOpenAI
from langchain.document_loaders import WikipediaLoader
from langchain.prompts import (
    ChatPromptTemplate,
    HumanMessagePromptTemplate,
    SystemMessagePromptTemplate,
)

auth_key = os.environ.get("DEEPL_API_KEY")
translator = deepl.Translator(auth_key)

## Connect OpenAI Model
model = ChatOpenAI(openai_api_key=api_key)


def answer_my_question(question, docs):
    question = translator.translate_text(question, target_lang="EN-US")
    print(question)

    ## Prompt - Format Question
    template = "Answer this question:\n{question}\n Here is some extra context:\n{document}\n If the answer isn't in the context return 'I cannot find the answer.'."
    human_prompt = HumanMessagePromptTemplate.from_template(template)

    ## Chat Prompt - Get Result Content
    chat_prompt = ChatPromptTemplate.from_messages([human_prompt])

    ## Get Result
    result = model(
        chat_prompt.format_prompt(question=question, document=docs).to_messages()
    )

    return translator.translate_text(result.content, target_lang="TR")


import streamlit as st

st.title("Aksaray Üniversitesi AI Danışman")
question_text = st.text_area("Size nasıl yardımcı olabilirim?")

if st.button("Cevapla", type="primary"):
    answer_text = answer_my_question(question=question_text, docs=docs2_1)
    st.markdown(answer_text)

langchain.prompts.ChatPromptTemplate.from_messages langchain.prompts.HumanMessagePromptTemplate.from_template langchain.chat_models.ChatOpenAI langchain.cache.SQLiteCache
[((2056, 2075), 'dotenv.load_dotenv', 'load_dotenv', (['""".env"""'], {}), "('.env')\n", (2067, 2075), False, 'from dotenv import load_dotenv\n'), ((2086, 2118), 'os.environ.get', 'os.environ.get', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (2100, 2118), False, 'import os\n'), ((2200, 2242), 'langchain.cache.SQLiteCache', 'SQLiteCache', ([], {'database_path': '""".langchain.db"""'}), "(database_path='.langchain.db')\n", (2211, 2242), False, 'from langchain.cache import SQLiteCache\n'), ((2492, 2523), 'os.environ.get', 'os.environ.get', (['"""DEEPL_API_KEY"""'], {}), "('DEEPL_API_KEY')\n", (2506, 2523), False, 'import os\n'), ((2537, 2563), 'deepl.Translator', 'deepl.Translator', (['auth_key'], {}), '(auth_key)\n', (2553, 2563), False, 'import deepl\n'), ((2597, 2631), 'langchain.chat_models.ChatOpenAI', 'ChatOpenAI', ([], {'openai_api_key': 'api_key'}), '(openai_api_key=api_key)\n', (2607, 2631), False, 'from langchain.chat_models import ChatOpenAI\n'), ((3368, 3412), 'streamlit.title', 'st.title', (['"""Aksaray Üniversitesi AI Danışman"""'], {}), "('Aksaray Üniversitesi AI Danışman')\n", (3376, 3412), True, 'import streamlit as st\n'), ((3429, 3476), 'streamlit.text_area', 'st.text_area', (['"""Size nasıl yardımcı olabilirim?"""'], {}), "('Size nasıl yardımcı olabilirim?')\n", (3441, 3476), True, 'import streamlit as st\n'), ((3481, 3517), 'streamlit.button', 'st.button', (['"""Cevapla"""'], {'type': '"""primary"""'}), "('Cevapla', type='primary')\n", (3490, 3517), True, 'import streamlit as st\n'), ((2984, 3034), 'langchain.prompts.HumanMessagePromptTemplate.from_template', 'HumanMessagePromptTemplate.from_template', (['template'], {}), '(template)\n', (3024, 3034), False, 'from langchain.prompts import ChatPromptTemplate, HumanMessagePromptTemplate, SystemMessagePromptTemplate\n'), ((3094, 3142), 'langchain.prompts.ChatPromptTemplate.from_messages', 'ChatPromptTemplate.from_messages', (['[human_prompt]'], {}), '([human_prompt])\n', (3126, 3142), False, 'from langchain.prompts import ChatPromptTemplate, HumanMessagePromptTemplate, SystemMessagePromptTemplate\n'), ((3598, 3622), 'streamlit.markdown', 'st.markdown', (['answer_text'], {}), '(answer_text)\n', (3609, 3622), True, 'import streamlit as st\n')]