Skip to content

Refactor LLM functions for better structure and error handling#41

Open
muneebwanee wants to merge 1 commit into
apurvsinghgautam:mainfrom
muneebwanee:patch-4
Open

Refactor LLM functions for better structure and error handling#41
muneebwanee wants to merge 1 commit into
apurvsinghgautam:mainfrom
muneebwanee:patch-4

Conversation

@muneebwanee

Copy link
Copy Markdown
Contributor

Replaced the fragile split(",") logic in filter_results with JsonOutputParser to ensure the LLM always returns a valid list of indices. Also added a "Map-Reduce" strategy in generate_summary. If the scraped content is too large (>15,000 chars), it splits the text, summarizes chunks individually, and then combines them. This prevents context window errors.

Replaced the fragile split(",") logic in filter_results with JsonOutputParser to ensure the LLM always returns a valid list of indices. Also added a "Map-Reduce" strategy in generate_summary. If the scraped content is too large (>15,000 chars), it splits the text, summarizes chunks individually, and then combines them. This prevents context window errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant