byteplussdk-arkruntime 3.0.64__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- byteplussdk_arkruntime-3.0.64.dist-info/METADATA +36 -0
- byteplussdk_arkruntime-3.0.64.dist-info/RECORD +240 -0
- byteplussdk_arkruntime-3.0.64.dist-info/WHEEL +5 -0
- byteplussdk_arkruntime-3.0.64.dist-info/licenses/LICENSE.txt +203 -0
- byteplussdk_arkruntime-3.0.64.dist-info/top_level.txt +1 -0
- byteplussdkarkruntime/__init__.py +7 -0
- byteplussdkarkruntime/_base_client.py +1439 -0
- byteplussdkarkruntime/_client.py +570 -0
- byteplussdkarkruntime/_compat.py +245 -0
- byteplussdkarkruntime/_constants.py +43 -0
- byteplussdkarkruntime/_exceptions.py +202 -0
- byteplussdkarkruntime/_files.py +149 -0
- byteplussdkarkruntime/_legacy_response.py +451 -0
- byteplussdkarkruntime/_models.py +734 -0
- byteplussdkarkruntime/_qs.py +168 -0
- byteplussdkarkruntime/_request_options.py +117 -0
- byteplussdkarkruntime/_resource.py +47 -0
- byteplussdkarkruntime/_response.py +615 -0
- byteplussdkarkruntime/_streaming.py +470 -0
- byteplussdkarkruntime/_types.py +210 -0
- byteplussdkarkruntime/_utils/__init__.py +58 -0
- byteplussdkarkruntime/_utils/_key_agreement.py +207 -0
- byteplussdkarkruntime/_utils/_logs.py +24 -0
- byteplussdkarkruntime/_utils/_model_breaker.py +83 -0
- byteplussdkarkruntime/_utils/_streams.py +12 -0
- byteplussdkarkruntime/_utils/_transform.py +489 -0
- byteplussdkarkruntime/_utils/_typing.py +171 -0
- byteplussdkarkruntime/_utils/_utils.py +497 -0
- byteplussdkarkruntime/common/__init__.py +14 -0
- byteplussdkarkruntime/common/_parsing/__init__.py +22 -0
- byteplussdkarkruntime/common/_parsing/_completions.py +290 -0
- byteplussdkarkruntime/common/_parsing/_responses.py +189 -0
- byteplussdkarkruntime/common/_pydantic.py +192 -0
- byteplussdkarkruntime/common/_tools.py +67 -0
- byteplussdkarkruntime/common/streaming/__init__.py +12 -0
- byteplussdkarkruntime/common/streaming/_deltas.py +86 -0
- byteplussdkarkruntime/common/streaming/chat/__init__.py +33 -0
- byteplussdkarkruntime/common/streaming/chat/_completions.py +772 -0
- byteplussdkarkruntime/common/streaming/chat/_events.py +103 -0
- byteplussdkarkruntime/common/streaming/chat/_types.py +36 -0
- byteplussdkarkruntime/pagination.py +134 -0
- byteplussdkarkruntime/resources/__init__.py +48 -0
- byteplussdkarkruntime/resources/batch/__init__.py +3 -0
- byteplussdkarkruntime/resources/batch/_utils.py +155 -0
- byteplussdkarkruntime/resources/batch/batch.py +37 -0
- byteplussdkarkruntime/resources/batch/chat/__init__.py +3 -0
- byteplussdkarkruntime/resources/batch/chat/chat.py +19 -0
- byteplussdkarkruntime/resources/batch/chat/completions.py +329 -0
- byteplussdkarkruntime/resources/batch/embeddings.py +105 -0
- byteplussdkarkruntime/resources/batch/multimodal_embeddings.py +111 -0
- byteplussdkarkruntime/resources/batch_chat/__init__.py +3 -0
- byteplussdkarkruntime/resources/batch_chat/chat.py +21 -0
- byteplussdkarkruntime/resources/batch_chat/completions.py +328 -0
- byteplussdkarkruntime/resources/beta/__init__.py +12 -0
- byteplussdkarkruntime/resources/beta/beta.py +81 -0
- byteplussdkarkruntime/resources/beta/chat/__init__.py +21 -0
- byteplussdkarkruntime/resources/beta/chat/chat.py +31 -0
- byteplussdkarkruntime/resources/beta/chat/completions.py +454 -0
- byteplussdkarkruntime/resources/chat/__init__.py +3 -0
- byteplussdkarkruntime/resources/chat/chat.py +21 -0
- byteplussdkarkruntime/resources/chat/completions.py +258 -0
- byteplussdkarkruntime/resources/content_generation/__init__.py +6 -0
- byteplussdkarkruntime/resources/content_generation/content_generation.py +17 -0
- byteplussdkarkruntime/resources/content_generation/tasks.py +348 -0
- byteplussdkarkruntime/resources/context/__init__.py +3 -0
- byteplussdkarkruntime/resources/context/completions.py +221 -0
- byteplussdkarkruntime/resources/context/context.py +98 -0
- byteplussdkarkruntime/resources/embeddings.py +110 -0
- byteplussdkarkruntime/resources/encryption.py +215 -0
- byteplussdkarkruntime/resources/files.py +592 -0
- byteplussdkarkruntime/resources/images/__init__.py +6 -0
- byteplussdkarkruntime/resources/images/images.py +335 -0
- byteplussdkarkruntime/resources/multimodal_embeddings.py +113 -0
- byteplussdkarkruntime/resources/responses/__init__.py +16 -0
- byteplussdkarkruntime/resources/responses/input_items.py +248 -0
- byteplussdkarkruntime/resources/responses/responses.py +417 -0
- byteplussdkarkruntime/types/__init__.py +28 -0
- byteplussdkarkruntime/types/chat/__init__.py +78 -0
- byteplussdkarkruntime/types/chat/chat_completion.py +93 -0
- byteplussdkarkruntime/types/chat/chat_completion_assistant_message_param.py +61 -0
- byteplussdkarkruntime/types/chat/chat_completion_audio.py +22 -0
- byteplussdkarkruntime/types/chat/chat_completion_chunk.py +165 -0
- byteplussdkarkruntime/types/chat/chat_completion_content_part_image_param.py +20 -0
- byteplussdkarkruntime/types/chat/chat_completion_content_part_param.py +30 -0
- byteplussdkarkruntime/types/chat/chat_completion_content_part_text_param.py +13 -0
- byteplussdkarkruntime/types/chat/chat_completion_content_part_video_param.py +32 -0
- byteplussdkarkruntime/types/chat/chat_completion_function_call_option_param.py +10 -0
- byteplussdkarkruntime/types/chat/chat_completion_function_message_param.py +17 -0
- byteplussdkarkruntime/types/chat/chat_completion_message.py +56 -0
- byteplussdkarkruntime/types/chat/chat_completion_message_param.py +19 -0
- byteplussdkarkruntime/types/chat/chat_completion_message_tool_call.py +29 -0
- byteplussdkarkruntime/types/chat/chat_completion_message_tool_call_param.py +29 -0
- byteplussdkarkruntime/types/chat/chat_completion_named_tool_choice_param.py +17 -0
- byteplussdkarkruntime/types/chat/chat_completion_role.py +5 -0
- byteplussdkarkruntime/types/chat/chat_completion_stream_options_param.py +19 -0
- byteplussdkarkruntime/types/chat/chat_completion_system_message_param.py +34 -0
- byteplussdkarkruntime/types/chat/chat_completion_token_logprob.py +55 -0
- byteplussdkarkruntime/types/chat/chat_completion_tool_choice_option_param.py +12 -0
- byteplussdkarkruntime/types/chat/chat_completion_tool_message_param.py +37 -0
- byteplussdkarkruntime/types/chat/chat_completion_tool_param.py +14 -0
- byteplussdkarkruntime/types/chat/chat_completion_user_message_param.py +34 -0
- byteplussdkarkruntime/types/chat/completion_create_params.py +258 -0
- byteplussdkarkruntime/types/chat/parsed_chat_completion.py +52 -0
- byteplussdkarkruntime/types/chat/parsed_function_tool_call.py +34 -0
- byteplussdkarkruntime/types/completion_usage.py +33 -0
- byteplussdkarkruntime/types/content_generation/__init__.py +0 -0
- byteplussdkarkruntime/types/content_generation/content_generation_task.py +106 -0
- byteplussdkarkruntime/types/content_generation/content_generation_task_id.py +11 -0
- byteplussdkarkruntime/types/content_generation/create_task_content_param.py +72 -0
- byteplussdkarkruntime/types/content_generation/list_content_generation_tasks_response.py +24 -0
- byteplussdkarkruntime/types/context/__init__.py +8 -0
- byteplussdkarkruntime/types/context/context_chat_completion.py +33 -0
- byteplussdkarkruntime/types/context/context_chat_completion_chunk.py +41 -0
- byteplussdkarkruntime/types/context/context_create_params.py +37 -0
- byteplussdkarkruntime/types/context/create_context_response.py +25 -0
- byteplussdkarkruntime/types/context/truncation_strategy.py +13 -0
- byteplussdkarkruntime/types/create_embedding_response.py +36 -0
- byteplussdkarkruntime/types/embedding.py +21 -0
- byteplussdkarkruntime/types/file_create_params.py +49 -0
- byteplussdkarkruntime/types/file_deleted.py +24 -0
- byteplussdkarkruntime/types/file_list_params.py +43 -0
- byteplussdkarkruntime/types/file_object.py +69 -0
- byteplussdkarkruntime/types/file_purpose.py +16 -0
- byteplussdkarkruntime/types/images/__init__.py +3 -0
- byteplussdkarkruntime/types/images/image_gen_completed_event.py +59 -0
- byteplussdkarkruntime/types/images/image_gen_generating_event.py +53 -0
- byteplussdkarkruntime/types/images/image_gen_stream_event.py +24 -0
- byteplussdkarkruntime/types/images/images.py +99 -0
- byteplussdkarkruntime/types/multimodal_embedding/__init__.py +15 -0
- byteplussdkarkruntime/types/multimodal_embedding/embedding_content_part_image_param.py +17 -0
- byteplussdkarkruntime/types/multimodal_embedding/embedding_content_part_text_param.py +13 -0
- byteplussdkarkruntime/types/multimodal_embedding/embedding_data.py +15 -0
- byteplussdkarkruntime/types/multimodal_embedding/embedding_input.py +12 -0
- byteplussdkarkruntime/types/multimodal_embedding/embedding_response.py +29 -0
- byteplussdkarkruntime/types/multimodal_embedding/embedding_usage.py +23 -0
- byteplussdkarkruntime/types/responses/__init__.py +133 -0
- byteplussdkarkruntime/types/responses/easy_input_message.py +36 -0
- byteplussdkarkruntime/types/responses/easy_input_message_param.py +37 -0
- byteplussdkarkruntime/types/responses/function_tool.py +35 -0
- byteplussdkarkruntime/types/responses/function_tool_param.py +35 -0
- byteplussdkarkruntime/types/responses/input_item_list_params.py +47 -0
- byteplussdkarkruntime/types/responses/mcp_input_item_param.py +109 -0
- byteplussdkarkruntime/types/responses/mcp_tool.py +80 -0
- byteplussdkarkruntime/types/responses/mcp_tool_param.py +78 -0
- byteplussdkarkruntime/types/responses/response.py +152 -0
- byteplussdkarkruntime/types/responses/response_annotation_added_event.py +36 -0
- byteplussdkarkruntime/types/responses/response_caching.py +25 -0
- byteplussdkarkruntime/types/responses/response_caching_param.py +22 -0
- byteplussdkarkruntime/types/responses/response_completed_event.py +26 -0
- byteplussdkarkruntime/types/responses/response_content_part_added_event.py +39 -0
- byteplussdkarkruntime/types/responses/response_content_part_done_event.py +39 -0
- byteplussdkarkruntime/types/responses/response_create_params.py +26 -0
- byteplussdkarkruntime/types/responses/response_created_event.py +26 -0
- byteplussdkarkruntime/types/responses/response_error.py +25 -0
- byteplussdkarkruntime/types/responses/response_error_event.py +32 -0
- byteplussdkarkruntime/types/responses/response_failed_event.py +26 -0
- byteplussdkarkruntime/types/responses/response_format_text_config.py +25 -0
- byteplussdkarkruntime/types/responses/response_format_text_config_param.py +25 -0
- byteplussdkarkruntime/types/responses/response_function_call_arguments_delta_event.py +33 -0
- byteplussdkarkruntime/types/responses/response_function_call_arguments_done_event.py +30 -0
- byteplussdkarkruntime/types/responses/response_function_tool_call.py +42 -0
- byteplussdkarkruntime/types/responses/response_function_tool_call_item.py +20 -0
- byteplussdkarkruntime/types/responses/response_function_tool_call_output_item.py +39 -0
- byteplussdkarkruntime/types/responses/response_function_tool_call_param.py +31 -0
- byteplussdkarkruntime/types/responses/response_in_progress_event.py +26 -0
- byteplussdkarkruntime/types/responses/response_includable.py +19 -0
- byteplussdkarkruntime/types/responses/response_incomplete_details.py +30 -0
- byteplussdkarkruntime/types/responses/response_incomplete_event.py +26 -0
- byteplussdkarkruntime/types/responses/response_input_content.py +24 -0
- byteplussdkarkruntime/types/responses/response_input_content_param.py +23 -0
- byteplussdkarkruntime/types/responses/response_input_image.py +38 -0
- byteplussdkarkruntime/types/responses/response_input_image_param.py +42 -0
- byteplussdkarkruntime/types/responses/response_input_image_pixel_limit_param.py +29 -0
- byteplussdkarkruntime/types/responses/response_input_message_content_list.py +20 -0
- byteplussdkarkruntime/types/responses/response_input_message_content_list_param.py +26 -0
- byteplussdkarkruntime/types/responses/response_input_message_item.py +43 -0
- byteplussdkarkruntime/types/responses/response_input_param.py +51 -0
- byteplussdkarkruntime/types/responses/response_input_text.py +25 -0
- byteplussdkarkruntime/types/responses/response_input_text_param.py +25 -0
- byteplussdkarkruntime/types/responses/response_input_video_param.py +34 -0
- byteplussdkarkruntime/types/responses/response_item.py +40 -0
- byteplussdkarkruntime/types/responses/response_item_list.py +36 -0
- byteplussdkarkruntime/types/responses/response_mcp_call_arguments_delta_event.py +37 -0
- byteplussdkarkruntime/types/responses/response_mcp_call_arguments_done_event.py +34 -0
- byteplussdkarkruntime/types/responses/response_mcp_call_completed_event.py +31 -0
- byteplussdkarkruntime/types/responses/response_mcp_call_failed_event.py +31 -0
- byteplussdkarkruntime/types/responses/response_mcp_call_in_progress_event.py +31 -0
- byteplussdkarkruntime/types/responses/response_mcp_item.py +110 -0
- byteplussdkarkruntime/types/responses/response_mcp_list_tools_completed_event.py +31 -0
- byteplussdkarkruntime/types/responses/response_mcp_list_tools_failed_event.py +31 -0
- byteplussdkarkruntime/types/responses/response_mcp_list_tools_in_progress_event.py +31 -0
- byteplussdkarkruntime/types/responses/response_output_item.py +36 -0
- byteplussdkarkruntime/types/responses/response_output_item_added_event.py +29 -0
- byteplussdkarkruntime/types/responses/response_output_item_done_event.py +29 -0
- byteplussdkarkruntime/types/responses/response_output_message.py +43 -0
- byteplussdkarkruntime/types/responses/response_output_text.py +61 -0
- byteplussdkarkruntime/types/responses/response_output_text_param.py +77 -0
- byteplussdkarkruntime/types/responses/response_reasoning_item.py +46 -0
- byteplussdkarkruntime/types/responses/response_reasoning_item_param.py +37 -0
- byteplussdkarkruntime/types/responses/response_reasoning_summary_part_added_event.py +42 -0
- byteplussdkarkruntime/types/responses/response_reasoning_summary_part_done_event.py +42 -0
- byteplussdkarkruntime/types/responses/response_reasoning_summary_text_delta_event.py +34 -0
- byteplussdkarkruntime/types/responses/response_reasoning_summary_text_done_event.py +34 -0
- byteplussdkarkruntime/types/responses/response_status.py +17 -0
- byteplussdkarkruntime/types/responses/response_stream_event.py +93 -0
- byteplussdkarkruntime/types/responses/response_text_config.py +28 -0
- byteplussdkarkruntime/types/responses/response_text_config_param.py +31 -0
- byteplussdkarkruntime/types/responses/response_text_delta_event.py +34 -0
- byteplussdkarkruntime/types/responses/response_text_done_event.py +34 -0
- byteplussdkarkruntime/types/responses/response_tool_usage.py +32 -0
- byteplussdkarkruntime/types/responses/response_usage.py +54 -0
- byteplussdkarkruntime/types/responses/response_web_search_call_completed_event.py +29 -0
- byteplussdkarkruntime/types/responses/response_web_search_call_in_progress_event.py +29 -0
- byteplussdkarkruntime/types/responses/response_web_search_call_searching_event.py +29 -0
- byteplussdkarkruntime/types/responses/response_web_search_item.py +43 -0
- byteplussdkarkruntime/types/responses/tool.py +25 -0
- byteplussdkarkruntime/types/responses/tool_choice_function.py +25 -0
- byteplussdkarkruntime/types/responses/tool_choice_function_param.py +25 -0
- byteplussdkarkruntime/types/responses/tool_choice_mcp_param.py +29 -0
- byteplussdkarkruntime/types/responses/tool_choice_options.py +17 -0
- byteplussdkarkruntime/types/responses/tool_param.py +24 -0
- byteplussdkarkruntime/types/responses/web_search_tool.py +49 -0
- byteplussdkarkruntime/types/responses/web_search_tool_param.py +46 -0
- byteplussdkarkruntime/types/shared/__init__.py +21 -0
- byteplussdkarkruntime/types/shared/reasoning.py +10 -0
- byteplussdkarkruntime/types/shared/reasoning_effort.py +16 -0
- byteplussdkarkruntime/types/shared/response_format_json_object.py +22 -0
- byteplussdkarkruntime/types/shared/response_format_json_schema.py +56 -0
- byteplussdkarkruntime/types/shared/response_format_text.py +22 -0
- byteplussdkarkruntime/types/shared/thinking.py +25 -0
- byteplussdkarkruntime/types/shared_params/__init__.py +13 -0
- byteplussdkarkruntime/types/shared_params/function_definition.py +34 -0
- byteplussdkarkruntime/types/shared_params/function_parameters.py +9 -0
- byteplussdkarkruntime/types/shared_params/metadata.py +20 -0
- byteplussdkarkruntime/types/shared_params/reasoning.py +12 -0
- byteplussdkarkruntime/types/shared_params/reasoning_effort.py +8 -0
- byteplussdkarkruntime/types/shared_params/response_format_json_object.py +22 -0
- byteplussdkarkruntime/types/shared_params/response_format_json_schema.py +54 -0
- byteplussdkarkruntime/types/shared_params/response_format_text.py +22 -0
- byteplussdkarkruntime/types/shared_params/thinking.py +22 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Copyright (c) [2025] [OpenAI]
|
|
2
|
+
# Copyright (c) [2025] [ByteDance Ltd. and/or its affiliates.]
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
#
|
|
5
|
+
# This file has been modified by [ByteDance Ltd. and/or its affiliates.] on 2025.7
|
|
6
|
+
#
|
|
7
|
+
# Original file was released under Apache License Version 2.0, with the full license text
|
|
8
|
+
# available at https://github.com/openai/openai-python/blob/main/LICENSE.
|
|
9
|
+
#
|
|
10
|
+
# This modified file is released under the same license.
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
from .chat_completion import ChatCompletion as ChatCompletion
|
|
15
|
+
from .chat_completion_role import ChatCompletionRole as ChatCompletionRole
|
|
16
|
+
from .chat_completion_chunk import ChatCompletionChunk as ChatCompletionChunk
|
|
17
|
+
from .chat_completion_message import ChatCompletionMessage as ChatCompletionMessage
|
|
18
|
+
from .completion_create_params import CompletionCreateParams as CompletionCreateParams
|
|
19
|
+
from .parsed_chat_completion import (
|
|
20
|
+
ParsedChoice as ParsedChoice,
|
|
21
|
+
ParsedChatCompletion as ParsedChatCompletion,
|
|
22
|
+
ParsedChatCompletionMessage as ParsedChatCompletionMessage,
|
|
23
|
+
)
|
|
24
|
+
from .parsed_function_tool_call import (
|
|
25
|
+
ParsedFunction as ParsedFunction,
|
|
26
|
+
ParsedFunctionToolCall as ParsedFunctionToolCall,
|
|
27
|
+
)
|
|
28
|
+
from .chat_completion_stream_options_param import (
|
|
29
|
+
ChatCompletionStreamOptionsParam as ChatCompletionStreamOptionsParam,
|
|
30
|
+
)
|
|
31
|
+
from .chat_completion_tool_param import (
|
|
32
|
+
ChatCompletionToolParam as ChatCompletionToolParam,
|
|
33
|
+
)
|
|
34
|
+
from .chat_completion_message_param import (
|
|
35
|
+
ChatCompletionMessageParam as ChatCompletionMessageParam,
|
|
36
|
+
)
|
|
37
|
+
from .chat_completion_token_logprob import (
|
|
38
|
+
ChatCompletionTokenLogprob as ChatCompletionTokenLogprob,
|
|
39
|
+
)
|
|
40
|
+
from .chat_completion_message_tool_call import (
|
|
41
|
+
ChatCompletionMessageToolCall as ChatCompletionMessageToolCall,
|
|
42
|
+
)
|
|
43
|
+
from .chat_completion_content_part_param import (
|
|
44
|
+
ChatCompletionContentPartParam as ChatCompletionContentPartParam,
|
|
45
|
+
)
|
|
46
|
+
from .chat_completion_tool_message_param import (
|
|
47
|
+
ChatCompletionToolMessageParam as ChatCompletionToolMessageParam,
|
|
48
|
+
)
|
|
49
|
+
from .chat_completion_user_message_param import (
|
|
50
|
+
ChatCompletionUserMessageParam as ChatCompletionUserMessageParam,
|
|
51
|
+
)
|
|
52
|
+
from .chat_completion_system_message_param import (
|
|
53
|
+
ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam,
|
|
54
|
+
)
|
|
55
|
+
from .chat_completion_function_message_param import (
|
|
56
|
+
ChatCompletionFunctionMessageParam as ChatCompletionFunctionMessageParam,
|
|
57
|
+
)
|
|
58
|
+
from .chat_completion_assistant_message_param import (
|
|
59
|
+
ChatCompletionAssistantMessageParam as ChatCompletionAssistantMessageParam,
|
|
60
|
+
)
|
|
61
|
+
from .chat_completion_content_part_text_param import (
|
|
62
|
+
ChatCompletionContentPartTextParam as ChatCompletionContentPartTextParam,
|
|
63
|
+
)
|
|
64
|
+
from .chat_completion_message_tool_call_param import (
|
|
65
|
+
ChatCompletionMessageToolCallParam as ChatCompletionMessageToolCallParam,
|
|
66
|
+
)
|
|
67
|
+
from .chat_completion_named_tool_choice_param import (
|
|
68
|
+
ChatCompletionNamedToolChoiceParam as ChatCompletionNamedToolChoiceParam,
|
|
69
|
+
)
|
|
70
|
+
from .chat_completion_content_part_image_param import (
|
|
71
|
+
ChatCompletionContentPartImageParam as ChatCompletionContentPartImageParam,
|
|
72
|
+
)
|
|
73
|
+
from .chat_completion_tool_choice_option_param import (
|
|
74
|
+
ChatCompletionToolChoiceOptionParam as ChatCompletionToolChoiceOptionParam,
|
|
75
|
+
)
|
|
76
|
+
from .chat_completion_function_call_option_param import (
|
|
77
|
+
ChatCompletionFunctionCallOptionParam as ChatCompletionFunctionCallOptionParam,
|
|
78
|
+
)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Copyright (c) [2025] [OpenAI]
|
|
2
|
+
# Copyright (c) [2025] [ByteDance Ltd. and/or its affiliates.]
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
#
|
|
5
|
+
# This file has been modified by [ByteDance Ltd. and/or its affiliates.] on 2025.7
|
|
6
|
+
#
|
|
7
|
+
# Original file was released under Apache License Version 2.0, with the full license text
|
|
8
|
+
# available at https://github.com/openai/openai-python/blob/main/LICENSE.
|
|
9
|
+
#
|
|
10
|
+
# This modified file is released under the same license.
|
|
11
|
+
|
|
12
|
+
from typing import List, Optional
|
|
13
|
+
|
|
14
|
+
from typing_extensions import Literal
|
|
15
|
+
|
|
16
|
+
from .chat_completion_message import ChatCompletionMessage
|
|
17
|
+
from .chat_completion_token_logprob import ChatCompletionTokenLogprob
|
|
18
|
+
from ..completion_usage import CompletionUsage
|
|
19
|
+
from ..._models import BaseModel
|
|
20
|
+
|
|
21
|
+
__all__ = ["ChatCompletion", "Choice", "ChoiceLogprobs"]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ChoiceLogprobs(BaseModel):
|
|
25
|
+
content: Optional[List[ChatCompletionTokenLogprob]] = None
|
|
26
|
+
"""A list of message content tokens with log probability information."""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class Choice(BaseModel):
|
|
30
|
+
finish_reason: Literal[
|
|
31
|
+
"stop", "length", "tool_calls", "content_filter", "function_call"
|
|
32
|
+
]
|
|
33
|
+
"""The reason the model stopped generating tokens.
|
|
34
|
+
|
|
35
|
+
This will be `stop` if the model hit a natural stop point or a provided stop
|
|
36
|
+
sequence, `length` if the maximum number of tokens specified in the request was
|
|
37
|
+
reached, `content_filter` if content was omitted due to a flag from our content
|
|
38
|
+
filters, `tool_calls` if the model called a tool, or `function_call`
|
|
39
|
+
(deprecated) if the model called a function.
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
moderation_hit_type: Optional[Literal["violence", "severe_violation"]] = None
|
|
43
|
+
"""The type of content moderation service hit."""
|
|
44
|
+
|
|
45
|
+
index: int
|
|
46
|
+
"""The index of the choice in the list of choices."""
|
|
47
|
+
|
|
48
|
+
logprobs: Optional[ChoiceLogprobs] = None
|
|
49
|
+
"""Log probability information for the choice."""
|
|
50
|
+
|
|
51
|
+
message: ChatCompletionMessage
|
|
52
|
+
"""A chat completion message generated by the model."""
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class ChatCompletion(BaseModel):
|
|
56
|
+
id: str
|
|
57
|
+
"""A unique identifier for the chat completion."""
|
|
58
|
+
|
|
59
|
+
choices: List[Choice]
|
|
60
|
+
"""A list of chat completion choices.
|
|
61
|
+
|
|
62
|
+
Can be more than one if `n` is greater than 1.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
created: int
|
|
66
|
+
"""The Unix timestamp (in seconds) of when the chat completion was created."""
|
|
67
|
+
|
|
68
|
+
model: str
|
|
69
|
+
"""The model used for the chat completion."""
|
|
70
|
+
|
|
71
|
+
service_tier: Optional[Literal["auto", "default"]]
|
|
72
|
+
"""Specifies the latency tier to use for processing the request.
|
|
73
|
+
|
|
74
|
+
This parameter is relevant for customers subscribed to the scale tier service:
|
|
75
|
+
|
|
76
|
+
- If set to 'auto', and the endpoint is Scale tier enabled, the system will
|
|
77
|
+
utilize scale tier credits until they are exhausted.
|
|
78
|
+
- If set to 'auto', and the endpoint is not Scale tier enabled, the request will
|
|
79
|
+
be processed using the default service tier with a lower uptime SLA and no
|
|
80
|
+
latency guarentee.
|
|
81
|
+
- If set to 'default', the request will be processed using the default service
|
|
82
|
+
tier with a lower uptime SLA and no latency guarentee.
|
|
83
|
+
- When not set, the default behavior is 'auto'.
|
|
84
|
+
|
|
85
|
+
When this parameter is set, the response body will include the `service_tier`
|
|
86
|
+
utilized.
|
|
87
|
+
"""
|
|
88
|
+
|
|
89
|
+
object: Literal["chat.completion"]
|
|
90
|
+
"""The object type, which is always `chat.completion`."""
|
|
91
|
+
|
|
92
|
+
usage: Optional[CompletionUsage] = None
|
|
93
|
+
"""Usage statistics for the completion request."""
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Copyright (c) [2025] [OpenAI]
|
|
2
|
+
# Copyright (c) [2025] [ByteDance Ltd. and/or its affiliates.]
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
#
|
|
5
|
+
# This file has been modified by [ByteDance Ltd. and/or its affiliates.] on 2025.7
|
|
6
|
+
#
|
|
7
|
+
# Original file was released under Apache License Version 2.0, with the full license text
|
|
8
|
+
# available at https://github.com/openai/openai-python/blob/main/LICENSE.
|
|
9
|
+
#
|
|
10
|
+
# This modified file is released under the same license.
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
from typing import Union, Iterable, Optional
|
|
15
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
16
|
+
|
|
17
|
+
from .chat_completion_message_tool_call_param import ChatCompletionMessageToolCallParam
|
|
18
|
+
from .chat_completion_content_part_param import ChatCompletionContentPartParam
|
|
19
|
+
|
|
20
|
+
__all__ = ["ChatCompletionAssistantMessageParam", "FunctionCall"]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class FunctionCall(TypedDict, total=False):
|
|
24
|
+
arguments: Required[str]
|
|
25
|
+
"""
|
|
26
|
+
The arguments to call the function with, as generated by the model in JSON
|
|
27
|
+
format. Note that the model does not always generate valid JSON, and may
|
|
28
|
+
hallucinate parameters not defined by your function schema. Validate the
|
|
29
|
+
arguments in your code before calling your function.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
name: Required[str]
|
|
33
|
+
"""The name of the function to call."""
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class ChatCompletionAssistantMessageParam(TypedDict, total=False):
|
|
37
|
+
role: Required[Literal["assistant"]]
|
|
38
|
+
"""The role of the messages author, in this case `assistant`."""
|
|
39
|
+
|
|
40
|
+
content: Optional[Union[str, Iterable[ChatCompletionContentPartParam]]]
|
|
41
|
+
"""The contents of the assistant message.
|
|
42
|
+
|
|
43
|
+
Required unless `tool_calls` or `function_call` is specified.
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
name: Optional[str]
|
|
47
|
+
"""An optional name for the participant.
|
|
48
|
+
|
|
49
|
+
Provides the model information to differentiate between participants of the same
|
|
50
|
+
role.
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
function_call: FunctionCall
|
|
54
|
+
"""Deprecated and replaced by `tool_calls`.
|
|
55
|
+
|
|
56
|
+
The name and arguments of a function that should be called, as generated by the
|
|
57
|
+
model.
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
tool_calls: Iterable[ChatCompletionMessageToolCallParam]
|
|
61
|
+
"""The tool calls generated by the model, such as function calls."""
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from ..._models import BaseModel
|
|
2
|
+
|
|
3
|
+
__all__ = ["ChatCompletionAudio"]
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ChatCompletionAudio(BaseModel):
|
|
7
|
+
id: str
|
|
8
|
+
"""Unique identifier for this audio response."""
|
|
9
|
+
|
|
10
|
+
data: str
|
|
11
|
+
"""
|
|
12
|
+
Base64 encoded audio bytes generated by the model.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
expires_at: int
|
|
16
|
+
"""
|
|
17
|
+
The Unix timestamp (in seconds) for when this audio response will no longer be
|
|
18
|
+
accessible on the server for use in multi-turn conversations.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
transcript: str
|
|
22
|
+
"""Transcript of the audio generated by the model."""
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Copyright (c) [2025] [OpenAI]
|
|
2
|
+
# Copyright (c) [2025] [ByteDance Ltd. and/or its affiliates.]
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
#
|
|
5
|
+
# This file has been modified by [ByteDance Ltd. and/or its affiliates.] on 2025.7
|
|
6
|
+
#
|
|
7
|
+
# Original file was released under Apache License Version 2.0, with the full license text
|
|
8
|
+
# available at https://github.com/openai/openai-python/blob/main/LICENSE.
|
|
9
|
+
#
|
|
10
|
+
# This modified file is released under the same license.
|
|
11
|
+
|
|
12
|
+
from typing import List, Optional
|
|
13
|
+
from typing_extensions import Literal
|
|
14
|
+
|
|
15
|
+
from ..._models import BaseModel
|
|
16
|
+
from ..completion_usage import CompletionUsage
|
|
17
|
+
from .chat_completion_token_logprob import ChatCompletionTokenLogprob
|
|
18
|
+
|
|
19
|
+
__all__ = [
|
|
20
|
+
"ChatCompletionChunk",
|
|
21
|
+
"Choice",
|
|
22
|
+
"ChoiceDelta",
|
|
23
|
+
"ChoiceDeltaFunctionCall",
|
|
24
|
+
"ChoiceDeltaToolCall",
|
|
25
|
+
"ChoiceDeltaToolCallFunction",
|
|
26
|
+
"ChoiceLogprobs",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ChoiceDeltaFunctionCall(BaseModel):
|
|
31
|
+
arguments: Optional[str] = None
|
|
32
|
+
"""
|
|
33
|
+
The arguments to call the function with, as generated by the model in JSON
|
|
34
|
+
format. Note that the model does not always generate valid JSON, and may
|
|
35
|
+
hallucinate parameters not defined by your function schema. Validate the
|
|
36
|
+
arguments in your code before calling your function.
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
name: Optional[str] = None
|
|
40
|
+
"""The name of the function to call."""
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class ChoiceDeltaToolCallFunction(BaseModel):
|
|
44
|
+
arguments: Optional[str] = None
|
|
45
|
+
"""
|
|
46
|
+
The arguments to call the function with, as generated by the model in JSON
|
|
47
|
+
format. Note that the model does not always generate valid JSON, and may
|
|
48
|
+
hallucinate parameters not defined by your function schema. Validate the
|
|
49
|
+
arguments in your code before calling your function.
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
name: Optional[str] = None
|
|
53
|
+
"""The name of the function to call."""
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class ChoiceDeltaToolCall(BaseModel):
|
|
57
|
+
index: int
|
|
58
|
+
|
|
59
|
+
id: Optional[str] = None
|
|
60
|
+
"""The ID of the tool call."""
|
|
61
|
+
|
|
62
|
+
function: Optional[ChoiceDeltaToolCallFunction] = None
|
|
63
|
+
|
|
64
|
+
type: Optional[Literal["function"]] = None
|
|
65
|
+
"""The type of the tool. Currently, only `function` is supported."""
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class ChoiceDelta(BaseModel):
|
|
69
|
+
content: Optional[str] = None
|
|
70
|
+
"""The contents of the chunk message."""
|
|
71
|
+
|
|
72
|
+
function_call: Optional[ChoiceDeltaFunctionCall] = None
|
|
73
|
+
"""Deprecated and replaced by `tool_calls`.
|
|
74
|
+
|
|
75
|
+
The name and arguments of a function that should be called, as generated by the
|
|
76
|
+
model.
|
|
77
|
+
"""
|
|
78
|
+
|
|
79
|
+
role: Optional[Literal["system", "user", "assistant", "tool"]] = None
|
|
80
|
+
"""The role of the author of this message."""
|
|
81
|
+
|
|
82
|
+
tool_calls: Optional[List[ChoiceDeltaToolCall]] = None
|
|
83
|
+
|
|
84
|
+
reasoning_content: Optional[str] = None
|
|
85
|
+
"""The reasoning content of the message."""
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class ChoiceLogprobs(BaseModel):
|
|
89
|
+
content: Optional[List[ChatCompletionTokenLogprob]] = None
|
|
90
|
+
"""A list of message content tokens with log probability information."""
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class Choice(BaseModel):
|
|
94
|
+
delta: ChoiceDelta
|
|
95
|
+
"""A chat completion delta generated by streamed model responses."""
|
|
96
|
+
|
|
97
|
+
finish_reason: Optional[
|
|
98
|
+
Literal["stop", "length", "tool_calls", "content_filter", "function_call"]
|
|
99
|
+
] = None
|
|
100
|
+
"""The reason the model stopped generating tokens.
|
|
101
|
+
|
|
102
|
+
This will be `stop` if the model hit a natural stop point or a provided stop
|
|
103
|
+
sequence, `length` if the maximum number of tokens specified in the request was
|
|
104
|
+
reached, `content_filter` if content was omitted due to a flag from our content
|
|
105
|
+
filters, `tool_calls` if the model called a tool, or `function_call`
|
|
106
|
+
(deprecated) if the model called a function.
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
moderation_hit_type: Optional[Literal["violence", "severe_violation"]] = None
|
|
110
|
+
"""The type of content moderation service hit."""
|
|
111
|
+
|
|
112
|
+
index: int
|
|
113
|
+
"""The index of the choice in the list of choices."""
|
|
114
|
+
|
|
115
|
+
logprobs: Optional[ChoiceLogprobs] = None
|
|
116
|
+
"""Log probability information for the choice."""
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class ChatCompletionChunk(BaseModel):
|
|
120
|
+
id: str
|
|
121
|
+
"""A unique identifier for the chat completion. Each chunk has the same ID."""
|
|
122
|
+
|
|
123
|
+
choices: List[Choice]
|
|
124
|
+
"""A list of chat completion choices.
|
|
125
|
+
|
|
126
|
+
Can be more than one if `n` is greater than 1.
|
|
127
|
+
"""
|
|
128
|
+
|
|
129
|
+
created: int
|
|
130
|
+
"""The Unix timestamp (in seconds) of when the chat completion was created.
|
|
131
|
+
|
|
132
|
+
Each chunk has the same timestamp.
|
|
133
|
+
"""
|
|
134
|
+
|
|
135
|
+
model: str
|
|
136
|
+
"""The model to generate the completion."""
|
|
137
|
+
|
|
138
|
+
service_tier: Optional[Literal["auto", "default"]]
|
|
139
|
+
"""Specifies the latency tier to use for processing the request.
|
|
140
|
+
|
|
141
|
+
This parameter is relevant for customers subscribed to the scale tier service:
|
|
142
|
+
|
|
143
|
+
- If set to 'auto', and the endpoint is Scale tier enabled, the system will
|
|
144
|
+
utilize scale tier credits until they are exhausted.
|
|
145
|
+
- If set to 'auto', and the endpoint is not Scale tier enabled, the request will
|
|
146
|
+
be processed using the default service tier with a lower uptime SLA and no
|
|
147
|
+
latency guarentee.
|
|
148
|
+
- If set to 'default', the request will be processed using the default service
|
|
149
|
+
tier with a lower uptime SLA and no latency guarentee.
|
|
150
|
+
- When not set, the default behavior is 'auto'.
|
|
151
|
+
|
|
152
|
+
When this parameter is set, the response body will include the `service_tier`
|
|
153
|
+
utilized.
|
|
154
|
+
"""
|
|
155
|
+
|
|
156
|
+
object: Literal["chat.completion.chunk"]
|
|
157
|
+
"""The object type, which is always `chat.completion.chunk`."""
|
|
158
|
+
|
|
159
|
+
usage: Optional[CompletionUsage] = None
|
|
160
|
+
"""
|
|
161
|
+
An optional field that will only be present when you set
|
|
162
|
+
`stream_options: {"include_usage": true}` in your request. When present, it
|
|
163
|
+
contains a null value except for the last chunk which contains the token usage
|
|
164
|
+
statistics for the entire request.
|
|
165
|
+
"""
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
4
|
+
|
|
5
|
+
__all__ = ["ChatCompletionContentPartImageParam", "ImageURL"]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ImageURL(TypedDict, total=False):
|
|
9
|
+
url: Required[str]
|
|
10
|
+
"""Either a URL of the image or the base64 encoded image data."""
|
|
11
|
+
|
|
12
|
+
detail: Literal["auto", "low", "high"]
|
|
13
|
+
"""Specifies the detail level of the image."""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ChatCompletionContentPartImageParam(TypedDict, total=False):
|
|
17
|
+
image_url: Required[ImageURL]
|
|
18
|
+
|
|
19
|
+
type: Required[Literal["image_url"]]
|
|
20
|
+
"""The type of the content part."""
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Copyright (c) [2025] [OpenAI]
|
|
2
|
+
# Copyright (c) [2025] [ByteDance Ltd. and/or its affiliates.]
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
#
|
|
5
|
+
# This file has been modified by [ByteDance Ltd. and/or its affiliates.] on 2025.7
|
|
6
|
+
#
|
|
7
|
+
# Original file was released under Apache License Version 2.0, with the full license text
|
|
8
|
+
# available at https://github.com/openai/openai-python/blob/main/LICENSE.
|
|
9
|
+
#
|
|
10
|
+
# This modified file is released under the same license.
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
from typing import Union
|
|
15
|
+
|
|
16
|
+
from .chat_completion_content_part_text_param import ChatCompletionContentPartTextParam
|
|
17
|
+
from .chat_completion_content_part_image_param import (
|
|
18
|
+
ChatCompletionContentPartImageParam,
|
|
19
|
+
)
|
|
20
|
+
from .chat_completion_content_part_video_param import (
|
|
21
|
+
ChatCompletionContentPartVideoParam,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
__all__ = ["ChatCompletionContentPartParam"]
|
|
25
|
+
|
|
26
|
+
ChatCompletionContentPartParam = Union[
|
|
27
|
+
ChatCompletionContentPartTextParam,
|
|
28
|
+
ChatCompletionContentPartImageParam,
|
|
29
|
+
ChatCompletionContentPartVideoParam,
|
|
30
|
+
]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
4
|
+
|
|
5
|
+
__all__ = ["ChatCompletionContentPartTextParam"]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ChatCompletionContentPartTextParam(TypedDict, total=False):
|
|
9
|
+
text: Required[str]
|
|
10
|
+
"""The text content."""
|
|
11
|
+
|
|
12
|
+
type: Required[Literal["text"]]
|
|
13
|
+
"""The type of the content part."""
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
# Copyright (c) [2025] [OpenAI]
|
|
3
|
+
# Copyright (c) [2025] [ByteDance Ltd. and/or its affiliates.]
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
#
|
|
6
|
+
# This file has been modified by [ByteDance Ltd. and/or its affiliates.] on 2025.7
|
|
7
|
+
#
|
|
8
|
+
# Original file was released under Apache License Version 2.0, with the full license text
|
|
9
|
+
# available at https://github.com/openai/openai-python/blob/main/LICENSE.
|
|
10
|
+
#
|
|
11
|
+
# This modified file is released under the same license.
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
16
|
+
|
|
17
|
+
__all__ = ["ChatCompletionContentPartVideoParam", "VideoURL"]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class VideoURL(TypedDict, total=False):
|
|
21
|
+
url: Required[str]
|
|
22
|
+
"""Either a URL of the video or the base64 encoded video data."""
|
|
23
|
+
|
|
24
|
+
fps: float
|
|
25
|
+
"""The sampling fps of the video."""
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ChatCompletionContentPartVideoParam(TypedDict, total=False):
|
|
29
|
+
video_url: Required[VideoURL]
|
|
30
|
+
|
|
31
|
+
type: Required[Literal["video_url"]]
|
|
32
|
+
"""The type of the content part."""
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing_extensions import Required, TypedDict
|
|
4
|
+
|
|
5
|
+
__all__ = ["ChatCompletionFunctionCallOptionParam"]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ChatCompletionFunctionCallOptionParam(TypedDict, total=False):
|
|
9
|
+
name: Required[str]
|
|
10
|
+
"""The name of the function to call."""
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
5
|
+
|
|
6
|
+
__all__ = ["ChatCompletionFunctionMessageParam"]
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ChatCompletionFunctionMessageParam(TypedDict, total=False):
|
|
10
|
+
content: Required[Optional[str]]
|
|
11
|
+
"""The contents of the function message."""
|
|
12
|
+
|
|
13
|
+
name: Required[str]
|
|
14
|
+
"""The name of the function to call."""
|
|
15
|
+
|
|
16
|
+
role: Required[Literal["function"]]
|
|
17
|
+
"""The role of the messages author, in this case `function`."""
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Copyright (c) [2025] [OpenAI]
|
|
2
|
+
# Copyright (c) [2025] [ByteDance Ltd. and/or its affiliates.]
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
#
|
|
5
|
+
# This file has been modified by [ByteDance Ltd. and/or its affiliates.] on 2025.7
|
|
6
|
+
#
|
|
7
|
+
# Original file was released under Apache License Version 2.0, with the full license text
|
|
8
|
+
# available at https://github.com/openai/openai-python/blob/main/LICENSE.
|
|
9
|
+
#
|
|
10
|
+
# This modified file is released under the same license.
|
|
11
|
+
|
|
12
|
+
from typing import List, Optional
|
|
13
|
+
from typing_extensions import Literal
|
|
14
|
+
|
|
15
|
+
from ..._models import BaseModel
|
|
16
|
+
from .chat_completion_message_tool_call import ChatCompletionMessageToolCall
|
|
17
|
+
from .chat_completion_audio import ChatCompletionAudio
|
|
18
|
+
|
|
19
|
+
__all__ = ["ChatCompletionMessage", "FunctionCall"]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class FunctionCall(BaseModel):
|
|
23
|
+
arguments: str
|
|
24
|
+
"""
|
|
25
|
+
The arguments to call the function with, as generated by the model in JSON
|
|
26
|
+
format. Note that the model does not always generate valid JSON, and may
|
|
27
|
+
hallucinate parameters not defined by your function schema. Validate the
|
|
28
|
+
arguments in your code before calling your function.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
name: str
|
|
32
|
+
"""The name of the function to call."""
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class ChatCompletionMessage(BaseModel):
|
|
36
|
+
content: Optional[str] = None
|
|
37
|
+
"""The contents of the message."""
|
|
38
|
+
|
|
39
|
+
role: Literal["assistant"]
|
|
40
|
+
"""The role of the author of this message."""
|
|
41
|
+
|
|
42
|
+
function_call: Optional[FunctionCall] = None
|
|
43
|
+
"""Deprecated and replaced by `tool_calls`.
|
|
44
|
+
|
|
45
|
+
The name and arguments of a function that should be called, as generated by the
|
|
46
|
+
model.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
tool_calls: Optional[List[ChatCompletionMessageToolCall]] = None
|
|
50
|
+
"""The tool calls generated by the model, such as function calls."""
|
|
51
|
+
|
|
52
|
+
audio: Optional[ChatCompletionAudio] = None
|
|
53
|
+
"""Audio response from the model."""
|
|
54
|
+
|
|
55
|
+
reasoning_content: Optional[str] = None
|
|
56
|
+
"""The reasoning content of the message."""
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Union
|
|
4
|
+
|
|
5
|
+
from .chat_completion_tool_message_param import ChatCompletionToolMessageParam
|
|
6
|
+
from .chat_completion_user_message_param import ChatCompletionUserMessageParam
|
|
7
|
+
from .chat_completion_system_message_param import ChatCompletionSystemMessageParam
|
|
8
|
+
from .chat_completion_function_message_param import ChatCompletionFunctionMessageParam
|
|
9
|
+
from .chat_completion_assistant_message_param import ChatCompletionAssistantMessageParam
|
|
10
|
+
|
|
11
|
+
__all__ = ["ChatCompletionMessageParam"]
|
|
12
|
+
|
|
13
|
+
ChatCompletionMessageParam = Union[
|
|
14
|
+
ChatCompletionSystemMessageParam,
|
|
15
|
+
ChatCompletionUserMessageParam,
|
|
16
|
+
ChatCompletionAssistantMessageParam,
|
|
17
|
+
ChatCompletionToolMessageParam,
|
|
18
|
+
ChatCompletionFunctionMessageParam,
|
|
19
|
+
]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from typing_extensions import Literal
|
|
2
|
+
|
|
3
|
+
from ..._models import BaseModel
|
|
4
|
+
|
|
5
|
+
__all__ = ["ChatCompletionMessageToolCall", "Function"]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Function(BaseModel):
|
|
9
|
+
arguments: str
|
|
10
|
+
"""
|
|
11
|
+
The arguments to call the function with, as generated by the model in JSON
|
|
12
|
+
format. Note that the model does not always generate valid JSON, and may
|
|
13
|
+
hallucinate parameters not defined by your function schema. Validate the
|
|
14
|
+
arguments in your code before calling your function.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
name: str
|
|
18
|
+
"""The name of the function to call."""
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ChatCompletionMessageToolCall(BaseModel):
|
|
22
|
+
id: str
|
|
23
|
+
"""The ID of the tool call."""
|
|
24
|
+
|
|
25
|
+
function: Function
|
|
26
|
+
"""The function that the model called."""
|
|
27
|
+
|
|
28
|
+
type: Literal["function"]
|
|
29
|
+
"""The type of the tool. Currently, only `function` is supported."""
|