Skip to content

Commit 85374f2

Browse files
Wauplingithub-actions[bot]
authored andcommitted
Update inference types (automated commit)
1 parent c329d56 commit 85374f2

File tree

5 files changed

+97
-61
lines changed

5 files changed

+97
-61
lines changed

docs/source/en/package_reference/inference_types.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,12 @@ This part of the lib is still under development and will be improved in future r
5757

5858
[[autodoc]] huggingface_hub.ChatCompletionInputFunctionName
5959

60-
[[autodoc]] huggingface_hub.ChatCompletionInputJSONSchema
60+
[[autodoc]] huggingface_hub.ChatCompletionInputGrammarType
6161

6262
[[autodoc]] huggingface_hub.ChatCompletionInputMessage
6363

6464
[[autodoc]] huggingface_hub.ChatCompletionInputMessageChunk
6565

66-
[[autodoc]] huggingface_hub.ChatCompletionInputResponseFormatJSONObject
67-
68-
[[autodoc]] huggingface_hub.ChatCompletionInputResponseFormatJSONSchema
69-
70-
[[autodoc]] huggingface_hub.ChatCompletionInputResponseFormatText
71-
7266
[[autodoc]] huggingface_hub.ChatCompletionInputStreamOptions
7367

7468
[[autodoc]] huggingface_hub.ChatCompletionInputTool
@@ -197,6 +191,18 @@ This part of the lib is still under development and will be improved in future r
197191

198192

199193

194+
## image_to_video
195+
196+
[[autodoc]] huggingface_hub.ImageToVideoInput
197+
198+
[[autodoc]] huggingface_hub.ImageToVideoOutput
199+
200+
[[autodoc]] huggingface_hub.ImageToVideoParameters
201+
202+
[[autodoc]] huggingface_hub.ImageToVideoTargetSize
203+
204+
205+
200206
## object_detection
201207

202208
[[autodoc]] huggingface_hub.ObjectDetectionBoundingBox

docs/source/ko/package_reference/inference_types.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,12 @@ rendered properly in your Markdown viewer.
5656

5757
[[autodoc]] huggingface_hub.ChatCompletionInputFunctionName
5858

59-
[[autodoc]] huggingface_hub.ChatCompletionInputJSONSchema
59+
[[autodoc]] huggingface_hub.ChatCompletionInputGrammarType
6060

6161
[[autodoc]] huggingface_hub.ChatCompletionInputMessage
6262

6363
[[autodoc]] huggingface_hub.ChatCompletionInputMessageChunk
6464

65-
[[autodoc]] huggingface_hub.ChatCompletionInputResponseFormatJSONObject
66-
67-
[[autodoc]] huggingface_hub.ChatCompletionInputResponseFormatJSONSchema
68-
69-
[[autodoc]] huggingface_hub.ChatCompletionInputResponseFormatText
70-
7165
[[autodoc]] huggingface_hub.ChatCompletionInputStreamOptions
7266

7367
[[autodoc]] huggingface_hub.ChatCompletionInputTool
@@ -196,6 +190,18 @@ rendered properly in your Markdown viewer.
196190

197191

198192

193+
## image_to_video[[huggingface_hub.ImageToVideoInput]]
194+
195+
[[autodoc]] huggingface_hub.ImageToVideoInput
196+
197+
[[autodoc]] huggingface_hub.ImageToVideoOutput
198+
199+
[[autodoc]] huggingface_hub.ImageToVideoParameters
200+
201+
[[autodoc]] huggingface_hub.ImageToVideoTargetSize
202+
203+
204+
199205
## object_detection[[huggingface_hub.ObjectDetectionBoundingBox]]
200206

201207
[[autodoc]] huggingface_hub.ObjectDetectionBoundingBox

src/huggingface_hub/inference/_generated/types/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,10 @@
2424
ChatCompletionInputFunctionDefinition,
2525
ChatCompletionInputFunctionName,
2626
ChatCompletionInputGrammarType,
27-
ChatCompletionInputJSONSchema,
27+
ChatCompletionInputGrammarTypeType,
2828
ChatCompletionInputMessage,
2929
ChatCompletionInputMessageChunk,
3030
ChatCompletionInputMessageChunkType,
31-
ChatCompletionInputResponseFormatJSONObject,
32-
ChatCompletionInputResponseFormatJSONSchema,
33-
ChatCompletionInputResponseFormatText,
3431
ChatCompletionInputStreamOptions,
3532
ChatCompletionInputTool,
3633
ChatCompletionInputToolCall,
@@ -85,6 +82,7 @@
8582
ImageToTextOutput,
8683
ImageToTextParameters,
8784
)
85+
from .image_to_video import ImageToVideoInput, ImageToVideoOutput, ImageToVideoParameters, ImageToVideoTargetSize
8886
from .object_detection import (
8987
ObjectDetectionBoundingBox,
9088
ObjectDetectionInput,

src/huggingface_hub/inference/_generated/types/chat_completion.py

Lines changed: 9 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# See:
44
# - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
55
# - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
6-
from typing import Any, Dict, List, Literal, Optional, Union
6+
from typing import Any, List, Literal, Optional, Union
77

88
from .base import BaseInferenceType, dataclass_with_extra
99

@@ -45,51 +45,17 @@ class ChatCompletionInputMessage(BaseInferenceType):
4545
tool_calls: Optional[List[ChatCompletionInputToolCall]] = None
4646

4747

48-
@dataclass_with_extra
49-
class ChatCompletionInputJSONSchema(BaseInferenceType):
50-
name: str
51-
"""
52-
The name of the response format.
53-
"""
54-
description: Optional[str] = None
55-
"""
56-
A description of what the response format is for, used by the model to determine
57-
how to respond in the format.
58-
"""
59-
schema: Optional[Dict[str, object]] = None
60-
"""
61-
The schema for the response format, described as a JSON Schema object. Learn how
62-
to build JSON schemas [here](https://json-schema.org/).
63-
"""
64-
strict: Optional[bool] = None
65-
"""
66-
Whether to enable strict schema adherence when generating the output. If set to
67-
true, the model will always follow the exact schema defined in the `schema`
68-
field.
69-
"""
70-
71-
72-
@dataclass_with_extra
73-
class ChatCompletionInputResponseFormatText(BaseInferenceType):
74-
type: Literal["text"]
75-
76-
77-
@dataclass_with_extra
78-
class ChatCompletionInputResponseFormatJSONSchema(BaseInferenceType):
79-
type: Literal["json_schema"]
80-
json_schema: ChatCompletionInputJSONSchema
48+
ChatCompletionInputGrammarTypeType = Literal["json", "regex", "json_schema"]
8149

8250

8351
@dataclass_with_extra
84-
class ChatCompletionInputResponseFormatJSONObject(BaseInferenceType):
85-
type: Literal["json_object"]
86-
87-
88-
ChatCompletionInputGrammarType = Union[
89-
ChatCompletionInputResponseFormatText,
90-
ChatCompletionInputResponseFormatJSONSchema,
91-
ChatCompletionInputResponseFormatJSONObject,
92-
]
52+
class ChatCompletionInputGrammarType(BaseInferenceType):
53+
type: "ChatCompletionInputGrammarTypeType"
54+
value: Any
55+
"""A string that represents a [JSON Schema](https://json-schema.org/).
56+
JSON Schema is a declarative language that allows to annotate JSON documents
57+
with types and descriptions.
58+
"""
9359

9460

9561
@dataclass_with_extra
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Inference code generated from the JSON schema spec in @huggingface/tasks.
2+
#
3+
# See:
4+
# - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
5+
# - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
6+
from typing import Any, Optional
7+
8+
from .base import BaseInferenceType, dataclass_with_extra
9+
10+
11+
@dataclass_with_extra
12+
class ImageToVideoTargetSize(BaseInferenceType):
13+
"""The size in pixel of the output video frames."""
14+
15+
height: int
16+
width: int
17+
18+
19+
@dataclass_with_extra
20+
class ImageToVideoParameters(BaseInferenceType):
21+
"""Additional inference parameters for Image To Video"""
22+
23+
guidance_scale: Optional[float] = None
24+
"""For diffusion models. A higher guidance scale value encourages the model to generate
25+
videos closely linked to the text prompt at the expense of lower image quality.
26+
"""
27+
negative_prompt: Optional[str] = None
28+
"""One prompt to guide what NOT to include in video generation."""
29+
num_frames: Optional[float] = None
30+
"""The num_frames parameter determines how many video frames are generated."""
31+
num_inference_steps: Optional[int] = None
32+
"""The number of denoising steps. More denoising steps usually lead to a higher quality
33+
video at the expense of slower inference.
34+
"""
35+
prompt: Optional[str] = None
36+
"""The text prompt to guide the video generation."""
37+
seed: Optional[int] = None
38+
"""Seed for the random number generator."""
39+
target_size: Optional[ImageToVideoTargetSize] = None
40+
"""The size in pixel of the output video frames."""
41+
42+
43+
@dataclass_with_extra
44+
class ImageToVideoInput(BaseInferenceType):
45+
"""Inputs for Image To Video inference"""
46+
47+
inputs: str
48+
"""The input image data as a base64-encoded string. If no `parameters` are provided, you can
49+
also provide the image data as a raw bytes payload.
50+
"""
51+
parameters: Optional[ImageToVideoParameters] = None
52+
"""Additional inference parameters for Image To Video"""
53+
54+
55+
@dataclass_with_extra
56+
class ImageToVideoOutput(BaseInferenceType):
57+
"""Outputs of inference for the Image To Video task"""
58+
59+
video: Any
60+
"""The generated video returned as raw bytes in the payload."""

0 commit comments

Comments
 (0)