27 lines
2.7 KiB
Python
27 lines
2.7 KiB
Python
import tiktoken
|
|
MAX_GPT4_TOKENS= 7500
|
|
MAX_GPT35_TURBO_TOKENS= 16000
|
|
GPT4_COMPLETION_TOKENS=1000
|
|
|
|
RERANKING_TOKENS= 400
|
|
encoding = tiktoken.get_encoding("cl100k_base")
|
|
encoding_gpt4 = tiktoken.encoding_for_model("gpt-4")
|
|
encoding_gpt35 = tiktoken.encoding_for_model("gpt-3.5-turbo")
|
|
|
|
openai_doc_reference_prompt_v2='Use the articles provided, which are delimited by triple quotes, to answer questions. If the answer cannot be found in the articles, do not provide false information; instead, write "Ich konnte keine Antwort finden.". If a question is incoherent or not factually accurate, explain the issue rather than providing an incorrect response. When you find a suitable answer, reply to the question as if you already knew the answer and refrain from referencing the provided articles. Please respond in German.'
|
|
|
|
openai_doc_reference_prompt_v1='Use the provided articles delimited by triple quotes to answer questions. If the answer cannot be found in the articles, write "I could not find an answer.". If you find a suitable answer, then reply to the question as if you already knew the answer and do not mention the provided articles in your response. Answer in German.'
|
|
|
|
openai_doc_citation_prompt_v1="You will be provided with a list of documents and a question. Your task is to reorder all documents in descending order of relevance to the given question. The ordered list should contain the id(s) of all documents, whether or not they are directly relevant to the question. Ensure you return only the array, without any additional information."
|
|
openai_doc_citation_prompt_v2="You will be provided with a list of documents and a question. Your task is to reorder all documents in descending order of relevance to the given question. The ordered list should only contain the top five id(s) of the documents. Ensure you return only the python array, without any additional information."
|
|
|
|
|
|
openai_expert_search='You will be provided with a list of paper titles, abstracts and author informations. Your task is to identify top 3 experts (authors) which fits to a given question. If a author is already in your top 3 then dont repeat the author again. Please respond in German.'
|
|
openai_wpm_recommendation="You will be provided with a list of courses delimited by triple quotes. Your task is to recommend the top 5 courses that best fit the user's interests. For each course, provide a short description, the course title, and the name of the professor offering the course. If a course is already in your top 5, don't repeat it. Please respond in German."
|
|
|
|
def count_prompt_tokens_gpt4(text):
|
|
return len(list(encoding.encode(text)))
|
|
|
|
def count_prompt_tokens_gpt35(text):
|
|
return len(list(encoding.encode(text)))
|