Skip to content

chore(huggingface-hub): Fix chat completion stream type - #7070

Open
alexander-alderman-webb wants to merge 7 commits into
masterfrom
webb/add-huggingface-hub-types
Open

chore(huggingface-hub): Fix chat completion stream type#7070
alexander-alderman-webb wants to merge 7 commits into
masterfrom
webb/add-huggingface-hub-types

Conversation

@alexander-alderman-webb

@alexander-alderman-webb alexander-alderman-webb commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Description

Add huggingface-hub to the uv typing group.
Cast iterator to the correct type.

The type for chat_completion() can be found here:

https://github.com/huggingface/huggingface_hub/blob/b4f4e92226642a4472945a174b9761b688a27dae/src/huggingface_hub/inference/_client.py#L559

Issues

Reminders

@alexander-alderman-webb
alexander-alderman-webb marked this pull request as ready for review August 6, 2026 15:07
@alexander-alderman-webb
alexander-alderman-webb requested a review from a team as a code owner August 6, 2026 15:07
@alexander-alderman-webb
alexander-alderman-webb changed the base branch from renovate/lock-file-maintenance to master August 6, 2026 15:11
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

87055 passed | ❌ 2 failed | ⏭️ 5442 skipped | Total: 92499 | Pass Rate: 94.11% | Execution Time: 303m 15s

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -13138
Passed Tests 📉 -12102
Failed Tests 📈 +1
Skipped Tests 📉 -1037

➕ New Tests (2)

View new tests
  • test_async_nonstreaming_chat_completion[False-False-False-False]
    • File: tests.integrations.litellm.test_litellm
    • Status: ❌ Failing
  • test_url_query_data_collection_event_processor[data_collection_denylist_default]
    • File: tests.integrations.sanic.test_sanic
    • Status: ❌ Failing

➖ Removed Tests (1)

View removed tests
  • test_continuous_profiler_auto_start_and_stop_sampled_span_streaming[non-experiment-thread]
    • File: tests.profiler.test_continuous_profiler

❌ Failed Tests

test_async_nonstreaming_chat_completion[False-False-False-False]

File: tests.integrations.litellm.test_litellm
Suite: py3.10-litellm-v1.83.14
Error: pytest.PytestUnraisableExceptionWarning: Exception ignored in thread started by: <bound method Thread._bootstrap of <Thread(asyncio_1, started 139758806160960)>> Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

Stack Trace
/usr/lib/python3.10/threading.py:973: in _bootstrap
    self._bootstrap_inner()
/usr/lib/python3.10/threading.py:1011: in _bootstrap_inner
    _sys.settrace(_trace_hook)
E   RuntimeError: Cannot install a trace function while another trace function is being installed

The above exception was the direct cause of the following exception:
.tox/py3.10-litellm-v1.83.14/lib/python3.10/site-packages/_pytest/runner.py:361: in from_call
    result: TResult | None = func()
.tox/py3.10-litellm-v1.83.14/lib/python3.10/site-packages/_pytest/runner.py:250: in <lambda>
    lambda: runtest_hook(item=item, **kwds),
.tox/py3.10-litellm-v1.83.14/lib/python3.10/site-packages/pluggy/_hooks.py:512: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
.tox/py3.10-litellm-v1.83.14/lib/python3.10/site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
.tox/py3.10-litellm-v1.83.14/lib/python3.10/site-packages/_pytest/logging.py:865: in pytest_runtest_call
    yield
.tox/py3.10-litellm-v1.83.14/lib/python3.10/site-packages/pluggy/_callers.py:53: in run_old_style_hookwrapper
    return result.get_result()
.tox/py3.10-litellm-v1.83.14/lib/python3.10/site-packages/pluggy/_callers.py:38: in run_old_style_hookwrapper
    res = yield
.tox/py3.10-litellm-v1.83.14/lib/python3.10/site-packages/_pytest/capture.py:900: in pytest_runtest_call
    return (yield)
.tox/py3.10-litellm-v1.83.14/lib/python3.10/site-packages/_pytest/skipping.py:268: in pytest_runtest_call
    return (yield)
.tox/py3.10-litellm-v1.83.14/lib/python3.10/site-packages/_pytest/unraisableexception.py:183: in pytest_runtest_call
    collect_unraisable(item.config)
.tox/py3.10-litellm-v1.83.14/lib/python3.10/site-packages/_pytest/unraisableexception.py:79: in collect_unraisable
    raise errors[0]
.tox/py3.10-litellm-v1.83.14/lib/python3.10/site-packages/_pytest/unraisableexception.py:67: in collect_unraisable
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
E   pytest.PytestUnraisableExceptionWarning: Exception ignored in thread started by: <bound method Thread._bootstrap of <Thread(asyncio_1, started 139758806160960)>>
E   Enable tracemalloc to get traceback where the object was allocated.
E   See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

test_url_query_data_collection_event_processor[data_collection_denylist_default]

File: tests.integrations.sanic.test_sanic
Suite: py3.6-sanic-v0.8.3
Error: AttributeError: 'NoneType' object has no attribute 'status'

Stack Trace
tests/integrations/sanic/test_sanic.py:783: in test_url_query_data_collection_event_processor
    assert response.status == 200
E   AttributeError: 'NoneType' object has no attribute 'status'

✅ Patch coverage is 100.00%. Project has 2512 uncovered lines.
❌ Project coverage is 89.88%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    90.00%    89.88%    -0.12%
==========================================
  Files          193       193         —
  Lines        24946     24828      -118
  Branches      9000      8930       -70
==========================================
+ Hits         22451     22316      -135
- Misses        2495      2512       +17
- Partials      1435      1420       -15

Generated by Codecov Action

@ericapisani

Copy link
Copy Markdown
Member

Looks like there's some test failures, will wait until they're 🟢 before taking a look

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.

2 participants