hwchase17 / notion-qa

MIT License
2.13k stars 374 forks source link

Add tiktoken to requirements.txt #11

Open ryanbrackney opened 1 year ago

ryanbrackney commented 1 year ago

On a fresh container with minimal prereqs, first call results in:

`Traceback (most recent call last): File "/opt/conda/lib/python3.10/site-packages/langchain/llms/openai.py", line 233, in get_num_tokens import tiktoken ModuleNotFoundError: No module named 'tiktoken'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/jovyan/work/notion-qa/qa.py", line 20, in result = chain({"question": args.question}) File "/opt/conda/lib/python3.10/site-packages/langchain/chains/base.py", line 146, in call raise e File "/opt/conda/lib/python3.10/site-packages/langchain/chains/base.py", line 142, in call outputs = self._call(inputs) File "/opt/conda/lib/python3.10/site-packages/langchain/chains/qa_with_sources/base.py", line 97, in call answer, = self.combine_document_chain.combine_docs(docs, inputs) File "/opt/conda/lib/python3.10/site-packages/langchain/chains/combine_documents/map_reduce.py", line 150, in combine_docs num_tokens = length_func(result_docs, kwargs) File "/opt/conda/lib/python3.10/site-packages/langchain/chains/combine_documents/stuff.py", line 79, in prompt_length return self.llm_chain.llm.get_num_tokens(prompt) File "/opt/conda/lib/python3.10/site-packages/langchain/llms/openai.py", line 235, in get_num_tokens raise ValueError( ValueError: Could not import tiktoken python package. This is needed in order to calculate get_num_tokens. Please it install it with `pip install tiktoken``

Installing fixes. Probably should be part of the requirements.txt

moghwan commented 1 year ago

same here, hopefully the author merge the fix soon https://github.com/hwchase17/notion-qa/pull/5

comster commented 1 year ago

+1

Also would be cool to add a Dockerfile?

nathan-eagle commented 1 year ago

I found the same thing. 'pip install tiktoken' solved the problem.