Find answers from the community

Updated 3 months ago

I just updated llama index and the

I just updated llama_index and the ResponseSynthesizer was not in the package. Has it been removed? I ended up backing down to a pre .7 version and that worked. Just trying to understand the changes and why as these wonderful APIs hurdle forward. thank you.
L
y
4 comments
Basically, ResponseSynthesizer -> get_response_synthesizer()

https://medium.com/@jerryjliu98/llamaindex-0-7-0-better-enabling-bottoms-up-llm-application-development-959db8f75024

Here's the full example from the blog as well

Plain Text
from llama_index import (
    VectorStoreIndex,
    get_response_synthesizer,
)
from llama_index.indices.postprocessor import (
    SimilarityPostprocessor,
    SentenceEmbeddingOptimizer
)

documents = ...
# build index
index = VectorStoreIndex.from_documents(documents)
# configure response synthesizer
response_synthesizer = get_response_synthesizer(
   response_mode="tree_summarize",
)
# assemble query engine
query_engine = index.as_query_engine(
  similarity_top_k=3,
    response_synthesizer=response_synthesizer,
    node_postprocessors=[
        SimilarityPostprocessor(similarity_cutoff=0.7),
        SentenceEmbeddingOptimizer(percentile_cutoff=0.5)
    ]
)
It's a pretty easy change actually too πŸ™‚
When upgrading to 0.7.4, I got a error

'LLMPredictor' object has no attribute 'last_token_usage'
Token counting has been removed from the llm predictor, and added to the callback handler

https://gpt-index.readthedocs.io/en/latest/examples/callbacks/TokenCountingHandler.html
Add a reply
Sign up and join the conversation on Discord