Skip to content

Remove magic number in list truncations #27

Description

@MrCsabaToth

Hard coding numeric constants inline in source code is an anti pattern, and is called "magic numbers". We would want to refactor those out at least into a contants.py or similar files so the developer can adjust them in a central location, or sometimes even better if it's in an environment variables .env.

A few examples:

hackathon_agent.py 1036
            for i, source in enumerate(ttd_dr_result.sources[:10], 1):
evaluator_agent.py, coverage_evaluator.py, hallucination_evaluator.py
two [:200]

synthesis_evaluator.py, one [:200]

context_pruner.py
            topic=topic[:500],

denoiser.py
            source_list = ", ".join([s.get("title", "Unknown") for s in sources[:3]])
        old_preview = old_draft[:2000] if len(old_draft) > 2000 else old_draft
        new_preview = new_draft[:2000] if len(new_draft) > 2000 else new_draft
evaluator.py
            research_brief=research_brief[:2000],
            draft=draft[:8000],
evolver.py
        top_variants = sorted_variants[:min(3, len(sorted_variants))]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions