Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Provide the utility to count the token saved using Semantic Cache

Aperta
#182 2 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 5 giorni

@justin-cechmanek ci sta già lavorando.

Dal 20/8/2024.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

enhancement

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.

Lingua principale
Python
Stelle
431
Fork
107
Merge medio
5g 17h
PR unite (30g)
16

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di redis/redis-vl-python

Tutte le issue di redis/redis-vl-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.