Provide the utility to count the token saved using Semantic Cache
Maintainer thường phản hồi trong vòng 5 ngày
@justin-cechmanek đang làm issue này rồi.
Từ ngày 20/8/2024.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
It would be nice to have an optional mode permitting to monitor the number of token the Semantic Cache permits to save.
To do so, today we can store the token as metadata item.
from langchain_community.callbacks import get_openai_callback
with get_openai_callback() as cb:
response = agent.run(input=user_query, callbacks=[retrieval_handler])
red.set("query_token_total",cb.total_tokens)
red.incr("session_token",cb.total_tokens)
return response
(...)
metadata=dict()
if int(red.get("query_token_total").decode('utf-8'))!=0:
metadata["token"]= int(red.get("query_token_total").decode('utf-8'))
llmcache.store(user_query, response, metadata=metadata)
else:
llmcache.store(user_query, response)
I am wondering if it would make sense to make such easier as it permits to highlight the Semantic Cache value.
- Ngôn ngữ chính
- Python
- Star
- 432
- Fork
- 111
- Merge trung bình
- 5 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 16
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của redis/redis-vl-python
-
exists() depends on exact FT.INFO error wording; an unrecognised "missing index" message makes create() never create the index (regression from #672)Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
redis/redis-vl-python#773 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Vector field with index_missing=True cannot be createdCó thể đã có người làm @RaphaelFakhri đã nhận 5 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
redis/redis-vl-python#770 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Add Python 3.15 supportCó thể đã có người làm @vishal-bala đã nhận 7 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
redis/redis-vl-python#757 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 5 ngày
-
SearchIndex.drop_keys does not validate cluster hash-tag co-location (inconsistent with drop_documents)Có thể đã có người làm @Hashim1999164 đã nhận 4 ngày trước. Đang mởbug good first issue index
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
redis/redis-vl-python#601 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
redis/redis-vl-python#300 ·
Maintainer thường phản hồi trong vòng 5 ngày
Tất cả issue của redis/redis-vl-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
MISP/misp-workbench#496 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
fossasia/visdom-dev#69 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
[Bug] Parameters named like a property break to_xcal()Có thể đã có người làm @atharvasalunke1267 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
collective/icalendar#2018 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày