evaluation_upravy
This commit is contained in:
parent
07134b7681
commit
0641a71284
@ -24,6 +24,9 @@ from evaluation.rag_metrics import (
|
|||||||
summarize_results,
|
summarize_results,
|
||||||
)
|
)
|
||||||
from evaluation.rag_runner import (
|
from evaluation.rag_runner import (
|
||||||
|
DEFAULT_BACKOFF_BASE,
|
||||||
|
DEFAULT_BACKOFF_MAX,
|
||||||
|
DEFAULT_MAX_ATTEMPTS,
|
||||||
DEFAULT_MODEL,
|
DEFAULT_MODEL,
|
||||||
DEFAULT_TIMEOUT,
|
DEFAULT_TIMEOUT,
|
||||||
LOCAL_OPENAPI_URL,
|
LOCAL_OPENAPI_URL,
|
||||||
@ -155,6 +158,39 @@ def parse_args() -> argparse.Namespace:
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--max-attempts",
|
||||||
|
type=int,
|
||||||
|
default=DEFAULT_MAX_ATTEMPTS,
|
||||||
|
help=(
|
||||||
|
"Maximálny počet HTTP pokusov "
|
||||||
|
"pre retryable chyby. "
|
||||||
|
f"Predvolené: {DEFAULT_MAX_ATTEMPTS}."
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--backoff-base",
|
||||||
|
type=float,
|
||||||
|
default=DEFAULT_BACKOFF_BASE,
|
||||||
|
help=(
|
||||||
|
"Počiatočný exponential backoff "
|
||||||
|
"v sekundách. "
|
||||||
|
f"Predvolené: {DEFAULT_BACKOFF_BASE}."
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--backoff-max",
|
||||||
|
type=float,
|
||||||
|
default=DEFAULT_BACKOFF_MAX,
|
||||||
|
help=(
|
||||||
|
"Maximálny exponential backoff "
|
||||||
|
"v sekundách. "
|
||||||
|
f"Predvolené: {DEFAULT_BACKOFF_MAX}."
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--delay",
|
"--delay",
|
||||||
type=float,
|
type=float,
|
||||||
@ -200,6 +236,21 @@ def parse_args() -> argparse.Namespace:
|
|||||||
"--timeout musí byť > 0"
|
"--timeout musí byť > 0"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if args.max_attempts <= 0:
|
||||||
|
parser.error(
|
||||||
|
"--max-attempts musí byť > 0"
|
||||||
|
)
|
||||||
|
|
||||||
|
if args.backoff_base < 0:
|
||||||
|
parser.error(
|
||||||
|
"--backoff-base nesmie byť záporné"
|
||||||
|
)
|
||||||
|
|
||||||
|
if args.backoff_max < 0:
|
||||||
|
parser.error(
|
||||||
|
"--backoff-max nesmie byť záporné"
|
||||||
|
)
|
||||||
|
|
||||||
if args.delay < 0:
|
if args.delay < 0:
|
||||||
parser.error(
|
parser.error(
|
||||||
"--delay nesmie byť záporné"
|
"--delay nesmie byť záporné"
|
||||||
@ -799,7 +850,8 @@ def main() -> int:
|
|||||||
try:
|
try:
|
||||||
openwebui_api_key = (
|
openwebui_api_key = (
|
||||||
load_env_value(
|
load_env_value(
|
||||||
"OPENWEBUI_API_KEY"
|
"OPENWEBUI_API_KEY",
|
||||||
|
allow_env_file=False,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -821,6 +873,15 @@ def main() -> int:
|
|||||||
openapi = request_json(
|
openapi = request_json(
|
||||||
LOCAL_OPENAPI_URL,
|
LOCAL_OPENAPI_URL,
|
||||||
timeout=args.timeout,
|
timeout=args.timeout,
|
||||||
|
max_attempts=(
|
||||||
|
args.max_attempts
|
||||||
|
),
|
||||||
|
backoff_base=(
|
||||||
|
args.backoff_base
|
||||||
|
),
|
||||||
|
backoff_max=(
|
||||||
|
args.backoff_max
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
operation_id, rag_tool = (
|
operation_id, rag_tool = (
|
||||||
@ -912,6 +973,17 @@ def main() -> int:
|
|||||||
f"{len(questions)}"
|
f"{len(questions)}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
print(
|
||||||
|
"Retry: "
|
||||||
|
f"{args.max_attempts} pokusy"
|
||||||
|
)
|
||||||
|
|
||||||
|
print(
|
||||||
|
"Backoff: "
|
||||||
|
f"{args.backoff_base}s "
|
||||||
|
f"→ max {args.backoff_max}s"
|
||||||
|
)
|
||||||
|
|
||||||
print(
|
print(
|
||||||
"=" * 60
|
"=" * 60
|
||||||
)
|
)
|
||||||
@ -1010,6 +1082,15 @@ def main() -> int:
|
|||||||
search_api_key
|
search_api_key
|
||||||
),
|
),
|
||||||
timeout=args.timeout,
|
timeout=args.timeout,
|
||||||
|
max_attempts=(
|
||||||
|
args.max_attempts
|
||||||
|
),
|
||||||
|
backoff_base=(
|
||||||
|
args.backoff_base
|
||||||
|
),
|
||||||
|
backoff_max=(
|
||||||
|
args.backoff_max
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
scores = evaluate_answer(
|
scores = evaluate_answer(
|
||||||
@ -1092,6 +1173,15 @@ def main() -> int:
|
|||||||
"applied_override_ids": (
|
"applied_override_ids": (
|
||||||
selected_override_ids
|
selected_override_ids
|
||||||
),
|
),
|
||||||
|
"max_attempts": (
|
||||||
|
args.max_attempts
|
||||||
|
),
|
||||||
|
"backoff_base": (
|
||||||
|
args.backoff_base
|
||||||
|
),
|
||||||
|
"backoff_max": (
|
||||||
|
args.backoff_max
|
||||||
|
),
|
||||||
"completed_so_far": len(
|
"completed_so_far": len(
|
||||||
results
|
results
|
||||||
),
|
),
|
||||||
@ -1174,6 +1264,15 @@ def main() -> int:
|
|||||||
"timeout": (
|
"timeout": (
|
||||||
args.timeout
|
args.timeout
|
||||||
),
|
),
|
||||||
|
"max_attempts": (
|
||||||
|
args.max_attempts
|
||||||
|
),
|
||||||
|
"backoff_base": (
|
||||||
|
args.backoff_base
|
||||||
|
),
|
||||||
|
"backoff_max": (
|
||||||
|
args.backoff_max
|
||||||
|
),
|
||||||
"delay": (
|
"delay": (
|
||||||
args.delay
|
args.delay
|
||||||
),
|
),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user