Skip to content

Commit 7f293e7

Browse files
Wauplingithub-actions[bot]
authored andcommitted
Update inference types (automated commit)
1 parent 92619e4 commit 7f293e7

File tree

4 files changed

+12
-61
lines changed

4 files changed

+12
-61
lines changed

docs/source/en/package_reference/inference_types.md

Lines changed: 1 addition & 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

docs/source/ko/package_reference/inference_types.md

Lines changed: 1 addition & 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

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

Lines changed: 1 addition & 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,

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

0 commit comments

Comments
 (0)