Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions eval_protocol/adapters/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
to EvaluationRow format for use in evaluation pipelines.
"""

from __future__ import annotations

import logging
from typing import Any, Callable, Dict, Iterator, List, Optional, Union
from typing import TYPE_CHECKING, Any, Callable, Dict, Iterator, List, Optional, Union

from eval_protocol.models import CompletionParams, EvaluationRow, InputMetadata, Message

Expand All @@ -20,7 +22,19 @@
BIGQUERY_AVAILABLE = True
except ImportError:
BIGQUERY_AVAILABLE = False
logger.warning("Google Cloud BigQuery not installed. Install with: pip install 'eval-protocol[bigquery]'")
# Optional dependency: avoid noisy warnings during import
logger.debug("Google Cloud BigQuery not installed. Optional feature disabled.")

# Avoid importing BigQuery types at runtime for annotations when not installed
if TYPE_CHECKING:
from google.cloud import bigquery as _bigquery_type

QueryParameterType = Union[
_bigquery_type.ScalarQueryParameter,
_bigquery_type.ArrayQueryParameter,
]
else:
QueryParameterType = Any

# Type alias for transformation function
TransformFunction = Callable[[Dict[str, Any]], Dict[str, Any]]
Expand Down Expand Up @@ -96,7 +110,7 @@ def __init__(
def get_evaluation_rows(
self,
query: str,
query_params: Optional[List[Union[bigquery.ScalarQueryParameter, bigquery.ArrayQueryParameter]]] = None,
query_params: Optional[List[QueryParameterType]] = None,
limit: Optional[int] = None,
offset: int = 0,
model_name: str = "gpt-3.5-turbo",
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ adapters = [
"datasets>=2.0.0",
"transformers>=4.0.0",
]
bigquery = [
"google-cloud-bigquery>=3.0.0",
"google-auth>=2.0.0",
]
svgbench = [
"selenium>=4.0.0",
]
Expand Down
Loading
Loading