Skip to content

Instantly share code, notes, and snippets.

@ninehills
Last active September 2, 2024 14:22
Show Gist options
  • Save ninehills/ecf7107574c83016e8b68965bf9a51c4 to your computer and use it in GitHub Desktop.
Save ninehills/ecf7107574c83016e8b68965bf9a51c4 to your computer and use it in GitHub Desktop.
ChatPDF-zh.ipynb
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yuhangch
Copy link

COOOOL,有没有一个问题平均需要token的估计?

@ninehills
Copy link
Author

COOOOL,有没有一个问题平均需要token的估计?

这个要和你使用的参数来定,我更新了一个版本,可以计算每次计算消耗的 Token。
针对如下参数:

response_mode="tree_summarize",
similarity_top_k=3,
mode="embedding",

的情况下,每次问题估计消耗 10000 token,也就是相当于 $0.02 = 0.14 元人民币。
如果将 similarity_top_k 改成默认值 1,那么价格将会降低为原来的 1/3。

@ntzhrm
Copy link

ntzhrm commented Apr 6, 2023

I did not know what to do, would u please help me with these error?

TypeError Traceback (most recent call last)
in <cell line: 1>()
----> 1 resp = chat("这本书讲了什么?")
2 display_response(resp)

7 frames
/usr/local/lib/python3.9/dist-packages/llama_index/indices/vector_store/base_query.py in init(self, index_struct, service_context, vector_store, similarity_top_k, **kwargs)
35 ) -> None:
36 """Initialize params."""
---> 37 super().init(
38 index_struct=index_struct, service_context=service_context, **kwargs
39 )

TypeError: init() got an unexpected keyword argument 'llm_predictor'

@ninehills
Copy link
Author

ninehills commented Apr 7, 2023

llama_index 0.5 have API broken!!!
so you can use pip install llama_index==0.4.40 .

I did not know what to do, would u please help me with these error?

TypeError: init() got an unexpected keyword argument 'llm_predictor'

@ninehills
Copy link
Author

ninehills commented Apr 27, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment