Find answers from the community

Home
Members
Mitch 🪬
M
Mitch 🪬
Offline, last seen 24 hours ago
Joined January 29, 2025
Hi guys, quick question about modifying the reranking system. I implemented a couple changes into _postprocess_nodes inside of LLMRerank where it gives priority to nodes with a more recent date and a specific subtype. However, since llm_rerank.py is directly part of a Python package, I'm having trouble with utilizing the modified file instead of the original version of LLM rerank. Is there either a way to make these same node reranking adjustments in my workflow file or override the original package with my new code? Here is my updated section of the code:
Plain Text
for node, relevance in zip(choice_nodes, relevances):
                # date score
                date_str = node.metadata.get('date')
                date_score = datetime.strptime(date_str, "%Y-%m-%d").timestamp()
                # Subtype score
                subtype = node.metadata.get('subtype', '')
                subtype_score = 1.0 if subtype == "pro report" else 0.0
                node_score = relevance + date_score + subtype_score
                initial_results.append(NodeWithScore(node=node, score=node_score))
1 comment
M
Hi all, I am working on my RAG workflow for my model and need some guidance. I want to integrate Grok into my LLM reranking system but it's not working for me. Grok's documentation says it's compatible with the OpenAI SDK so I am assuming this is the correct format, but I still can't get it to run:
ranker = LLMRerank( choice_batch_size=5, top_n=5, llm=OpenAI(model="grok-2-latest", api_key=XAI_API_KEY, api_base="https://api.x.ai/v1") )
I'm also trying to implement this in the synthesize() step and having the same issue. Any guidance would be appreciated!
8 comments
M
L