Last active
December 31, 2021 10:01
-
-
Save john-adeojo/f599d5df787c3e65032c8040294b8221 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Knowledge engine question and answer | |
if button: | |
response_json = openai.Answer.create( | |
search_model="ada", | |
model="davinci", | |
question=question, | |
file=openai.File.list()['data'][-1]['id'], # Get latest file | |
examples_context= "In 2017, U.S. life expectancy was 78.6 years." , | |
examples=[["What is human life expectancy in the United States?", "78 years."]], | |
max_rerank=300, | |
max_tokens=100, | |
stop=["\n", "<|endoftext|>"] | |
) | |
# Return answer to UI | |
st.markdown(response_json["answers"][0], unsafe_allow_html=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment