mirror of
https://github.com/microsoft/graphrag.git
synced 2026-01-14 09:07:20 +08:00
Some checks are pending
Python CI / python-ci (ubuntu-latest, 3.10) (push) Waiting to run
Python CI / python-ci (ubuntu-latest, 3.11) (push) Waiting to run
Python CI / python-ci (windows-latest, 3.10) (push) Waiting to run
Python CI / python-ci (windows-latest, 3.11) (push) Waiting to run
Python Integration Tests / python-ci (ubuntu-latest, 3.10) (push) Waiting to run
Python Integration Tests / python-ci (windows-latest, 3.10) (push) Waiting to run
Python Notebook Tests / python-ci (ubuntu-latest, 3.10) (push) Waiting to run
Python Notebook Tests / python-ci (windows-latest, 3.10) (push) Waiting to run
Python Smoke Tests / python-ci (ubuntu-latest, 3.10) (push) Waiting to run
Python Smoke Tests / python-ci (windows-latest, 3.10) (push) Waiting to run
* Simplify Factory interface * Migrate CacheFactory to standard base class * Migrate LoggerFactory to standard base class * Migrate StorageFactory to standard base class * Migrate VectorStoreFactory to standard base class * Update vector store example notebook * Delete notebook outputs * Move default providers into factories * Move retry/limit tests into integ * Split language model factories * Set smoke test tpm/rpm * Fix factory integ tests * Add method to smoke test, switch text to 'fast' * Fix text smoke config for fast workflow * Add new workflows to text smoke test * Convert input readers to a proper factory * Remove covariates from fast smoke test * Update docs for input factory * Bump smoke runtime * Even longer runtime * min-csv timeout * Remove unnecessary lambdas
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
# Copyright (c) 2024 Microsoft Corporation.
|
|
# Licensed under the MIT License
|
|
|
|
"""LiteLLM Test Utilities."""
|
|
|
|
|
|
def bin_time_intervals(
|
|
time_values: list[float], time_interval: int
|
|
) -> list[list[float]]:
|
|
"""Bin values."""
|
|
bins: list[list[float]] = []
|
|
|
|
bin_number = 0
|
|
for time_value in time_values:
|
|
upper_bound = (bin_number * time_interval) + time_interval
|
|
while time_value >= upper_bound:
|
|
bin_number += 1
|
|
upper_bound = (bin_number * time_interval) + time_interval
|
|
while len(bins) <= bin_number:
|
|
bins.append([])
|
|
bins[bin_number].append(time_value)
|
|
|
|
return bins
|
|
|
|
|
|
def assert_max_num_values_per_period(
|
|
periods: list[list[float]], max_values_per_period: int
|
|
):
|
|
"""Assert the number of values per period."""
|
|
for period in periods:
|
|
assert len(period) <= max_values_per_period
|
|
|
|
|
|
def assert_stagger(time_values: list[float], stagger: float):
|
|
"""Assert stagger."""
|
|
for i in range(1, len(time_values)):
|
|
assert time_values[i] - time_values[i - 1] >= stagger
|