Skip to content

[Bot] Update inference types #3104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

HuggingFaceInfra
Copy link
Contributor

This PR updates the inference types. It has been generated by running:

# Generate Python code
pnpm run inference-codegen  # from @huggingface/tasks-gen

# Copy to this repository
cp -r ./huggingface.js/packages/tasks/.python_generated/* ./huggingface_hub/src/huggingface_hub/inference/_generated/types

# Clean things
make inference_update
make style

This PR was automatically created by the Update Inference Types workflow.

Make sure the changes are correct before merging.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@HuggingFaceInfra HuggingFaceInfra force-pushed the update-inference-types-automated-pr branch from 7f293e7 to 8990983 Compare May 24, 2025 03:17
Copy link

codecov bot commented May 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.12%. Comparing base (1ebdbf9) to head (8990983).

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #3104       +/-   ##
===========================================
- Coverage   76.33%   57.12%   -19.21%     
===========================================
  Files         130      134        +4     
  Lines       12952    13293      +341     
===========================================
- Hits         9887     7594     -2293     
- Misses       3065     5699     +2634     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@HuggingFaceInfra HuggingFaceInfra force-pushed the update-inference-types-automated-pr branch 3 times, most recently from 7db22ba to 32628dd Compare May 29, 2025 03:20
@HuggingFaceInfra HuggingFaceInfra force-pushed the update-inference-types-automated-pr branch 3 times, most recently from 47ec62d to 85374f2 Compare June 5, 2025 03:22
@HuggingFaceInfra HuggingFaceInfra force-pushed the update-inference-types-automated-pr branch 3 times, most recently from 53f15af to ab506b6 Compare June 12, 2025 03:22
@Wauplin
Copy link
Contributor

Wauplin commented Jun 17, 2025

Opened huggingface/huggingface.js#1537 and #3167 to finally fix the chat completion discrepancies. Once merged, we will get back to a "normal" PR with only text-to-video stuff.

@HuggingFaceInfra HuggingFaceInfra force-pushed the update-inference-types-automated-pr branch 2 times, most recently from 69e7ebd to 5a7d328 Compare June 24, 2025 03:23
@HuggingFaceInfra HuggingFaceInfra force-pushed the update-inference-types-automated-pr branch from 5a7d328 to 152ebf8 Compare June 25, 2025 03:24
Wauplin added a commit to huggingface/huggingface.js that referenced this pull request Jun 25, 2025
In huggingface/huggingface_hub#3082
@hanouticelina fixed the Python inference types for chat completion
grammar input. Biggest update was:

```py
@dataclass_with_extra
class ChatCompletionInputResponseFormatText(BaseInferenceType):
    type: Literal["text"]


@dataclass_with_extra
class ChatCompletionInputResponseFormatJSONSchema(BaseInferenceType):
    type: Literal["json_schema"]
    json_schema: ChatCompletionInputJSONSchema


@dataclass_with_extra
class ChatCompletionInputResponseFormatJSONObject(BaseInferenceType):
    type: Literal["json_object"]


ChatCompletionInputGrammarType = Union[
    ChatCompletionInputResponseFormatText,
    ChatCompletionInputResponseFormatJSONSchema,
    ChatCompletionInputResponseFormatJSONObject,
]
```

---

This PR reflects "officially" this update in the JS specs. It makes JS
and Python specs aligned again (was not the case for the last month,
ending up with annoying PRs like this one
huggingface/huggingface_hub#3104). The result is
not as satisfying as what a manual implementation would give because the
3 objects are merged in 1 with optional fields (see `export type
ChatCompletionInputGrammarTypeType = "text" | "json_schema" |
"json_object";`). This is because quicktype do not handle properly
unions (see glideapps/quicktype#1266 - 6 yo
:confused: ). It's not the only case like this in our specs but first
time I find out about it. Not a problem since we don't enforce data
structures.


In Python, the data structure will result in this:
huggingface/huggingface_hub#3167
@HuggingFaceInfra HuggingFaceInfra force-pushed the update-inference-types-automated-pr branch 3 times, most recently from 8b59498 to 7da279c Compare July 2, 2025 03:24
@HuggingFaceInfra HuggingFaceInfra force-pushed the update-inference-types-automated-pr branch 4 times, most recently from 46de283 to 9212cb7 Compare July 8, 2025 03:24
@HuggingFaceInfra HuggingFaceInfra force-pushed the update-inference-types-automated-pr branch 2 times, most recently from 870f0c6 to 53be813 Compare July 12, 2025 03:28
@HuggingFaceInfra HuggingFaceInfra force-pushed the update-inference-types-automated-pr branch 3 times, most recently from 001d86d to 6c3e0d7 Compare July 17, 2025 03:28
@HuggingFaceInfra HuggingFaceInfra force-pushed the update-inference-types-automated-pr branch from 6c3e0d7 to a899310 Compare July 22, 2025 03:29
@Wauplin
Copy link
Contributor

Wauplin commented Jul 22, 2025

waiting for #3231 to be merged first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants