Skip to content

feature(benchmark): добавить сравнение провайдеров поиска - #4

Open
gman-dev-nov wants to merge 1 commit into
feature/lookup-yandex-isbn-hintfrom
feature/provider-benchmark
Open

feature(benchmark): добавить сравнение провайдеров поиска#4
gman-dev-nov wants to merge 1 commit into
feature/lookup-yandex-isbn-hintfrom
feature/provider-benchmark

Conversation

@gman-dev-nov

Copy link
Copy Markdown
Owner

Что изменилось

Добавлена benchmark-инфраструктура для сравнения поисковых провайдеров и вспомогательные адаптеры для воспроизводимого прогона.

Теперь в проекте есть отдельный инструмент, который позволяет прогонять набор запросов через несколько источников и смотреть, какие провайдеры лучше покрывают реальные сценарии поиска книг.

Зачем это нужно

До этого качество провайдеров оценивалось в основном вручную и фрагментарно. Это мешало:

  • сравнивать источники между собой;
  • принимать решения о порядке fallback;
  • понимать, какие провайдеры реально полезны, а какие почти не дают ценности.

Benchmark нужен, чтобы обсуждать провайдерный слой на основе измерений, а не интуиции.

Что получает команда

  • воспроизводимый способ сравнения провайдеров;
  • основу для будущих изменений порядка lookup;
  • инструмент для локального анализа проблемных кейсов.

Технически

  • добавлен home_library/benchmark.py;
  • добавлены адаптеры поисковых провайдеров для benchmark-сценария;
  • добавлены Playwright helper-ы для связанных тестовых сценариев;
  • добавлены тесты benchmark и Playwright-обвязки;
  • добавлен файл с примерами и материалами для Alpina-кейсов.

Проверка

  • venv/bin/python -m pytest tests/test_home_library_benchmark.py tests/test_home_library_playwright_providers.py -q

Добавил benchmark-инфраструктуру для сравнения поисковых провайдеров и вспомогательные адаптеры для воспроизводимого прогона. Это дает понятный способ оценивать полноту, устойчивость и полезность разных источников на одном наборе запросов, а не опираться на разрозненные ручные проверки.

Отдельно добавлены тесты для benchmark-обвязки и Playwright-загрузки, чтобы зафиксировать рабочее состояние инструмента и упростить дальнейшее развитие провайдерного слоя на основе измерений, а не предположений.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d5c76a1959

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread home_library/benchmark.py
Comment on lines +346 to +348
if parsed is None:
parsed = BookRecord(title=book.title, author=book.author, isbn=isbn)
return ProviderRunResult("DuckDuckGo", PROVIDER_FOUND, book=parsed)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove query-data fallback when DDG parser returns no book

When extract_book_from_serp(...) fails, this fallback fabricates a BookRecord from the input query (book.title/book.author) and marks the provider as found. In _run_search_isbn_benchmark, verification checks those same fields, so any page containing an ISBN can be counted as a verified DDG hit even if the SERP never produced matching metadata, which materially inflates precision metrics.

Useful? React with 👍 / 👎.

Comment thread home_library/benchmark.py
Comment on lines +401 to +403
if parsed is None:
parsed = BookRecord(title=book.title, author=book.author, isbn=isbn)
return ProviderRunResult("Yandex", PROVIDER_FOUND, book=parsed)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid synthetic Yandex matches when SERP parse fails

This fallback also injects the expected query title/author when Yandex parsing fails, then returns PROVIDER_FOUND. Because benchmark verification compares returned title/author against the same expected values, failed parses can still become verified successes if any ISBN was detected in HTML, producing systematically overstated Yandex quality in benchmark output.

Useful? React with 👍 / 👎.

Comment thread home_library/benchmark.py
Comment on lines +310 to +312
title=str(product.get("title", "")),
author=book.author,
publisher="Питер",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not hardcode expected author in Piter candidate

The Piter candidate record copies book.author from benchmark input instead of using provider-derived metadata. This makes author matching trivially succeed in _book_match_score and later verification, so wrong or ambiguous Piter results can still look fully matched, biasing provider comparison for books where title alone is not unique.

Useful? React with 👍 / 👎.

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