Skip to content

Commit

Permalink
feat: code cleaning!
Browse files Browse the repository at this point in the history
added other variables as global variable
  • Loading branch information
amindadgar committed Dec 17, 2024
1 parent a42750b commit ec93c8b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions utils/globals.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# the theshold to skip nodes of being included in an answer
RETRIEVER_THRESHOLD = 0.4
REFERENCE_SCORE_THRESHOLD = 0.5
INVALID_QUERY_RESPONSE = (
"We're unable to process your query. Please refine it and try again."
)
Expand Down
7 changes: 5 additions & 2 deletions utils/query_engine/prepare_answer_sources.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import logging

from llama_index.core.schema import NodeWithScore
from utils.globals import REFERENCE_SCORE_THRESHOLD


class PrepareAnswerSources:
def __init__(self, threshold: float = 0.5, max_refs_per_source: int = 3) -> None:
def __init__(
self, threshold: float = REFERENCE_SCORE_THRESHOLD, max_refs_per_source: int = 3
) -> None:
"""
Initialize the PrepareAnswerSources class.
Parameters
----------
threshold : float, optional
Minimum score threshold for including a node's URL, by default 0.5
Minimum score threshold for including a node's URL, by default 0.5 set in globals file
max_refs_per_source : int, optional
Maximum number of references to include per data source, by default 3
"""
Expand Down

0 comments on commit ec93c8b

Please sign in to comment.