Skip to content

Commit 9212cb7

Browse files
Wauplingithub-actions[bot]
authored andcommitted
Update inference types (automated commit)
1 parent 6e944cf commit 9212cb7

File tree

5 files changed

+106
-51
lines changed

5 files changed

+106
-51
lines changed

docs/source/en/package_reference/inference_types.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,14 @@ 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
61+
62+
[[autodoc]] huggingface_hub.ChatCompletionInputJSONSchemaConfig
6163

6264
[[autodoc]] huggingface_hub.ChatCompletionInputMessage
6365

6466
[[autodoc]] huggingface_hub.ChatCompletionInputMessageChunk
6567

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

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

198194

199195

196+
## image_to_video
197+
198+
[[autodoc]] huggingface_hub.ImageToVideoInput
199+
200+
[[autodoc]] huggingface_hub.ImageToVideoOutput
201+
202+
[[autodoc]] huggingface_hub.ImageToVideoParameters
203+
204+
[[autodoc]] huggingface_hub.ImageToVideoTargetSize
205+
206+
207+
200208
## object_detection
201209

202210
[[autodoc]] huggingface_hub.ObjectDetectionBoundingBox

docs/source/ko/package_reference/inference_types.md

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

5757
[[autodoc]] huggingface_hub.ChatCompletionInputFunctionName
5858

59-
[[autodoc]] huggingface_hub.ChatCompletionInputJSONSchema
59+
[[autodoc]] huggingface_hub.ChatCompletionInputGrammarType
60+
61+
[[autodoc]] huggingface_hub.ChatCompletionInputJSONSchemaConfig
6062

6163
[[autodoc]] huggingface_hub.ChatCompletionInputMessage
6264

6365
[[autodoc]] huggingface_hub.ChatCompletionInputMessageChunk
6466

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

7369
[[autodoc]] huggingface_hub.ChatCompletionInputTool
@@ -196,6 +192,18 @@ rendered properly in your Markdown viewer.
196192

197193

198194

195+
## image_to_video[[huggingface_hub.ImageToVideoInput]]
196+
197+
[[autodoc]] huggingface_hub.ImageToVideoInput
198+
199+
[[autodoc]] huggingface_hub.ImageToVideoOutput
200+
201+
[[autodoc]] huggingface_hub.ImageToVideoParameters
202+
203+
[[autodoc]] huggingface_hub.ImageToVideoTargetSize
204+
205+
206+
199207
## object_detection[[huggingface_hub.ObjectDetectionBoundingBox]]
200208

201209
[[autodoc]] huggingface_hub.ObjectDetectionBoundingBox

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@
2424
ChatCompletionInputFunctionDefinition,
2525
ChatCompletionInputFunctionName,
2626
ChatCompletionInputGrammarType,
27-
ChatCompletionInputJSONSchema,
27+
ChatCompletionInputGrammarTypeType,
28+
ChatCompletionInputJSONSchemaConfig,
2829
ChatCompletionInputMessage,
2930
ChatCompletionInputMessageChunk,
3031
ChatCompletionInputMessageChunkType,
31-
ChatCompletionInputResponseFormatJSONObject,
32-
ChatCompletionInputResponseFormatJSONSchema,
33-
ChatCompletionInputResponseFormatText,
3432
ChatCompletionInputStreamOptions,
3533
ChatCompletionInputTool,
3634
ChatCompletionInputToolCall,
@@ -85,6 +83,7 @@
8583
ImageToTextOutput,
8684
ImageToTextParameters,
8785
)
86+
from .image_to_video import ImageToVideoInput, ImageToVideoOutput, ImageToVideoParameters, ImageToVideoTargetSize
8887
from .object_detection import (
8988
ObjectDetectionBoundingBox,
9089
ObjectDetectionInput,

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

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -46,50 +46,30 @@ class ChatCompletionInputMessage(BaseInferenceType):
4646

4747

4848
@dataclass_with_extra
49-
class ChatCompletionInputJSONSchema(BaseInferenceType):
49+
class ChatCompletionInputJSONSchemaConfig(BaseInferenceType):
5050
name: str
51-
"""
52-
The name of the response format.
53-
"""
51+
"""The name of the response format."""
5452
description: Optional[str] = None
53+
"""A description of what the response format is for, used by the model to determine how to
54+
respond in the format.
5555
"""
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/).
56+
schema: Optional[Dict[str, Any]] = None
57+
"""The schema for the response format, described as a JSON Schema object. Learn how to build
58+
JSON schemas [here](https://json-schema.org/).
6359
"""
6460
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.
61+
"""Whether to enable strict schema adherence when generating the output. If set to true, the
62+
model will always follow the exact schema defined in the `schema` field.
6963
"""
7064

7165

72-
@dataclass_with_extra
73-
class ChatCompletionInputResponseFormatText(BaseInferenceType):
74-
type: Literal["text"]
66+
ChatCompletionInputGrammarTypeType = Literal["text", "json_schema", "json_object"]
7567

7668

7769
@dataclass_with_extra
78-
class ChatCompletionInputResponseFormatJSONSchema(BaseInferenceType):
79-
type: Literal["json_schema"]
80-
json_schema: ChatCompletionInputJSONSchema
81-
82-
83-
@dataclass_with_extra
84-
class ChatCompletionInputResponseFormatJSONObject(BaseInferenceType):
85-
type: Literal["json_object"]
86-
87-
88-
ChatCompletionInputGrammarType = Union[
89-
ChatCompletionInputResponseFormatText,
90-
ChatCompletionInputResponseFormatJSONSchema,
91-
ChatCompletionInputResponseFormatJSONObject,
92-
]
70+
class ChatCompletionInputGrammarType(BaseInferenceType):
71+
type: "ChatCompletionInputGrammarTypeType"
72+
json_schema: Optional[ChatCompletionInputJSONSchemaConfig] = None
9373

9474

9575
@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)