Skip to content

Commit

Permalink
NO HALLUCINATING
Browse files Browse the repository at this point in the history
  • Loading branch information
whitead committed Feb 28, 2023
1 parent cceff88 commit 47d5dc0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/test_paperqa.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,14 @@ def test_bad_context():
# get wiki page about politician
r = requests.get("https://en.wikipedia.org/wiki/Frederick_Bates_(politician)")
f.write(r.text)
docs = paperqa.Docs(llm=OpenAI(temperature=0.1, model_name="text-davinci-003"))
docs = paperqa.Docs(
llm=OpenAI(temperature=0.1, model_name="text-davinci-003", max_tokens=100)
)
docs.add(doc_path, "WikiMedia Foundation, 2023, Accessed now")
answer = docs.query("What year was Barack Obama born greatest accomplishment?")
answer = docs.query(
"What year was Barack Obama born greatest accomplishment?",
length_prompt="about 20 words",
)
assert "cannot answer" in answer.answer
os.remove(doc_path)

Expand Down

0 comments on commit 47d5dc0

Please sign in to comment.