Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tiktoken to requirements.txt #11

Open
ryanbrackney opened this issue Mar 13, 2023 · 3 comments
Open

Add tiktoken to requirements.txt #11

ryanbrackney opened this issue Mar 13, 2023 · 3 comments

Comments

@ryanbrackney
Copy link

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
Copy link

moghwan commented Mar 15, 2023

same here, hopefully the author merge the fix soon #5

@comster
Copy link

comster commented Apr 2, 2023

+1

Also would be cool to add a Dockerfile?

@nathan-eagle
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants