Skip to content

Commit 1ae93d2

Browse files
HuggingFaceInfraWauplinhanouticelina
authored
[Bot] Update inference types (#2832)
* Update inference types (automated commit) * fix quality after merging main * another fix * fix tests * Update inference types (automated commit) * Update inference types (automated commit) * fix quality * Update inference types (automated commit) * Update inference types (automated commit) * Update inference types (automated commit) * fix client * activate automatic update for table-question-answering * fix * Update inference types (automated commit) * fix quality * revert generate_kwargs -> generation_parameters renaming * add docstring back * add docstring back * Update inference types (automated commit) * fix * keep generate_kwargs * fix * nit * style * style --------- Co-authored-by: Wauplin <[email protected]> Co-authored-by: Celina Hanouti <[email protected]>
1 parent 17e09ab commit 1ae93d2

File tree

5 files changed

+28
-10
lines changed

5 files changed

+28
-10
lines changed

docs/source/en/package_reference/inference_types.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ This part of the lib is still under development and will be improved in future r
6767

6868
[[autodoc]] huggingface_hub.ChatCompletionInputTool
6969

70+
[[autodoc]] huggingface_hub.ChatCompletionInputToolCall
71+
7072
[[autodoc]] huggingface_hub.ChatCompletionInputToolChoiceClass
7173

7274
[[autodoc]] huggingface_hub.ChatCompletionInputURL

docs/source/ko/package_reference/inference_types.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ rendered properly in your Markdown viewer.
6666

6767
[[autodoc]] huggingface_hub.ChatCompletionInputTool
6868

69+
[[autodoc]] huggingface_hub.ChatCompletionInputToolCall
70+
6971
[[autodoc]] huggingface_hub.ChatCompletionInputToolChoiceClass
7072

7173
[[autodoc]] huggingface_hub.ChatCompletionInputURL

src/huggingface_hub/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@
298298
"ChatCompletionInputMessageChunkType",
299299
"ChatCompletionInputStreamOptions",
300300
"ChatCompletionInputTool",
301+
"ChatCompletionInputToolCall",
301302
"ChatCompletionInputToolChoiceClass",
302303
"ChatCompletionInputToolChoiceEnum",
303304
"ChatCompletionInputURL",
@@ -538,6 +539,7 @@
538539
"ChatCompletionInputMessageChunkType",
539540
"ChatCompletionInputStreamOptions",
540541
"ChatCompletionInputTool",
542+
"ChatCompletionInputToolCall",
541543
"ChatCompletionInputToolChoiceClass",
542544
"ChatCompletionInputToolChoiceEnum",
543545
"ChatCompletionInputURL",
@@ -1242,6 +1244,7 @@ def __dir__():
12421244
ChatCompletionInputMessageChunkType, # noqa: F401
12431245
ChatCompletionInputStreamOptions, # noqa: F401
12441246
ChatCompletionInputTool, # noqa: F401
1247+
ChatCompletionInputToolCall, # noqa: F401
12451248
ChatCompletionInputToolChoiceClass, # noqa: F401
12461249
ChatCompletionInputToolChoiceEnum, # noqa: F401
12471250
ChatCompletionInputURL, # noqa: F401

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
ChatCompletionInputMessageChunkType,
3131
ChatCompletionInputStreamOptions,
3232
ChatCompletionInputTool,
33+
ChatCompletionInputToolCall,
3334
ChatCompletionInputToolChoiceClass,
3435
ChatCompletionInputToolChoiceEnum,
3536
ChatCompletionInputURL,

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

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,26 @@ class ChatCompletionInputMessageChunk(BaseInferenceType):
2323
text: Optional[str] = None
2424

2525

26+
@dataclass_with_extra
27+
class ChatCompletionInputFunctionDefinition(BaseInferenceType):
28+
arguments: Any
29+
name: str
30+
description: Optional[str] = None
31+
32+
33+
@dataclass_with_extra
34+
class ChatCompletionInputToolCall(BaseInferenceType):
35+
function: ChatCompletionInputFunctionDefinition
36+
id: str
37+
type: str
38+
39+
2640
@dataclass_with_extra
2741
class ChatCompletionInputMessage(BaseInferenceType):
28-
content: Union[List[ChatCompletionInputMessageChunk], str]
2942
role: str
43+
content: Optional[Union[List[ChatCompletionInputMessageChunk], str]] = None
3044
name: Optional[str] = None
45+
tool_calls: Optional[List[ChatCompletionInputToolCall]] = None
3146

3247

3348
ChatCompletionInputGrammarTypeType = Literal["json", "regex"]
@@ -45,7 +60,7 @@ class ChatCompletionInputGrammarType(BaseInferenceType):
4560

4661
@dataclass_with_extra
4762
class ChatCompletionInputStreamOptions(BaseInferenceType):
48-
include_usage: bool
63+
include_usage: Optional[bool] = None
4964
"""If set, an additional chunk will be streamed before the data: [DONE] message. The usage
5065
field on this chunk shows the token usage statistics for the entire request, and the
5166
choices field will always be an empty array. All other chunks will also include a usage
@@ -66,13 +81,6 @@ class ChatCompletionInputToolChoiceClass(BaseInferenceType):
6681
ChatCompletionInputToolChoiceEnum = Literal["auto", "none", "required"]
6782

6883

69-
@dataclass_with_extra
70-
class ChatCompletionInputFunctionDefinition(BaseInferenceType):
71-
arguments: Any
72-
name: str
73-
description: Optional[str] = None
74-
75-
7684
@dataclass_with_extra
7785
class ChatCompletionInputTool(BaseInferenceType):
7886
function: ChatCompletionInputFunctionDefinition
@@ -197,6 +205,7 @@ class ChatCompletionOutputToolCall(BaseInferenceType):
197205
class ChatCompletionOutputMessage(BaseInferenceType):
198206
role: str
199207
content: Optional[str] = None
208+
tool_call_id: Optional[str] = None
200209
tool_calls: Optional[List[ChatCompletionOutputToolCall]] = None
201210

202211

@@ -249,7 +258,8 @@ class ChatCompletionStreamOutputDeltaToolCall(BaseInferenceType):
249258
class ChatCompletionStreamOutputDelta(BaseInferenceType):
250259
role: str
251260
content: Optional[str] = None
252-
tool_calls: Optional[ChatCompletionStreamOutputDeltaToolCall] = None
261+
tool_call_id: Optional[str] = None
262+
tool_calls: Optional[List[ChatCompletionStreamOutputDeltaToolCall]] = None
253263

254264

255265
@dataclass_with_extra

0 commit comments

Comments
 (0)