aidial-client 0.15.0.dev4__tar.gz → 0.15.0.dev6__tar.gz

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.
Files changed (75) hide show
  1. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/PKG-INFO +111 -1
  2. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/README.md +110 -0
  3. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/resources/chat/completions.py +92 -18
  4. aidial_client-0.15.0.dev6/aidial_client/types/chat/__init__.py +112 -0
  5. aidial_client-0.15.0.dev6/aidial_client/types/chat/cache.py +5 -0
  6. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/types/chat/function.py +1 -0
  7. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/types/chat/request.py +20 -4
  8. aidial_client-0.15.0.dev6/aidial_client/types/chat/request_param.py +175 -0
  9. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/types/chat/response.py +45 -1
  10. aidial_client-0.15.0.dev6/aidial_client/types/chat/tool.py +42 -0
  11. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/types/toolset.py +2 -2
  12. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/pyproject.toml +1 -1
  13. aidial_client-0.15.0.dev4/aidial_client/types/chat/__init__.py +0 -26
  14. aidial_client-0.15.0.dev4/aidial_client/types/chat/request_param.py +0 -69
  15. aidial_client-0.15.0.dev4/aidial_client/types/chat/tool.py +0 -25
  16. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/LICENSE +0 -0
  17. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/__init__.py +0 -0
  18. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_auth.py +0 -0
  19. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_client.py +0 -0
  20. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_client_pool.py +0 -0
  21. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_compatibility/__init__.py +0 -0
  22. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_compatibility/openai.py +0 -0
  23. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_compatibility/pydantic.py +0 -0
  24. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_compatibility/pydantic_v1.py +0 -0
  25. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_constants.py +0 -0
  26. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_exception.py +0 -0
  27. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_http_client/__init__.py +0 -0
  28. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_http_client/_async.py +0 -0
  29. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_http_client/_base.py +0 -0
  30. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_http_client/_sse.py +0 -0
  31. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_http_client/_sync.py +0 -0
  32. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_internal_types/__init__.py +0 -0
  33. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_internal_types/_defaults.py +0 -0
  34. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_internal_types/_generic.py +0 -0
  35. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_internal_types/_http_request.py +0 -0
  36. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_internal_types/_json_rpc.py +0 -0
  37. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_internal_types/_model.py +0 -0
  38. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_log.py +0 -0
  39. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_utils/__init__.py +0 -0
  40. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_utils/_alias.py +0 -0
  41. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_utils/_dict.py +0 -0
  42. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_utils/_openai.py +0 -0
  43. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_utils/_response_processing.py +0 -0
  44. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/_utils/_type_guard.py +0 -0
  45. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/helpers/__init__.py +0 -0
  46. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/helpers/_url.py +0 -0
  47. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/helpers/storage_resource.py +0 -0
  48. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/py.typed +0 -0
  49. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/resources/__init__.py +0 -0
  50. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/resources/application.py +0 -0
  51. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/resources/base.py +0 -0
  52. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/resources/bucket.py +0 -0
  53. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/resources/chat/__init__.py +0 -0
  54. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/resources/client_channel.py +0 -0
  55. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/resources/deployments.py +0 -0
  56. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/resources/files.py +0 -0
  57. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/resources/metadata.py +0 -0
  58. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/resources/model.py +0 -0
  59. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/resources/prompts.py +0 -0
  60. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/resources/resource_permissions.py +0 -0
  61. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/resources/toolset.py +0 -0
  62. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/resources/user.py +0 -0
  63. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/types/__init__.py +0 -0
  64. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/types/application.py +0 -0
  65. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/types/bucket.py +0 -0
  66. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/types/chat/legacy/__init__.py +0 -0
  67. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/types/chat/legacy/application_request.py +0 -0
  68. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/types/chat/legacy/chat_completion.py +0 -0
  69. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/types/client_channel.py +0 -0
  70. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/types/deployment.py +0 -0
  71. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/types/file.py +0 -0
  72. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/types/metadata.py +0 -0
  73. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/types/model.py +0 -0
  74. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/types/prompt.py +0 -0
  75. {aidial_client-0.15.0.dev4 → aidial_client-0.15.0.dev6}/aidial_client/types/user.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aidial-client
3
- Version: 0.15.0.dev4
3
+ Version: 0.15.0.dev6
4
4
  Summary: A Python client library for the AI DIAL API
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE
@@ -47,6 +47,7 @@ Description-Content-Type: text/markdown
47
47
  - [Make Chat Completions Requests](#make-chat-completions-requests)
48
48
  - [Without Streaming](#without-streaming)
49
49
  - [With Streaming](#with-streaming)
50
+ - [DIAL-specific and Extended Parameters](#dial-specific-and-extended-parameters)
50
51
  - [Working with Files](#working-with-files)
51
52
  - [Working with URLs](#working-with-urls)
52
53
  - [Uploading Files](#uploading-files)
@@ -486,6 +487,115 @@ ChatCompletionChunk(
486
487
  )
487
488
  ```
488
489
 
490
+ #### DIAL-specific and Extended Parameters
491
+
492
+ Along with the standard OpenAI parameters, `chat.completions.create` accepts
493
+ the DIAL extensions and the newer OpenAI parameters:
494
+
495
+ ```python
496
+ completion = client.chat.completions.create(
497
+ deployment_name="gpt-4o",
498
+ stream=False,
499
+ messages=[
500
+ # Messages support multi-modal content parts,
501
+ # the "developer" role and per-message cache breakpoints
502
+ {
503
+ "role": "developer",
504
+ "content": "Be brief",
505
+ "custom_fields": {"cache_breakpoint": {"expire_at": "1h"}},
506
+ },
507
+ {
508
+ "role": "user",
509
+ "content": [
510
+ {"type": "text", "text": "What is on the picture?"},
511
+ {
512
+ "type": "image_url",
513
+ "image_url": {"url": "https://example.com/image.png"},
514
+ },
515
+ ],
516
+ # DIAL attachments, stages and forms
517
+ "custom_content": {
518
+ "attachments": [
519
+ {"type": "image/png", "url": "files/bucket/image.png"}
520
+ ]
521
+ },
522
+ },
523
+ ],
524
+ tools=[
525
+ {
526
+ "type": "function",
527
+ "function": {"name": "get_weather", "parameters": {}, "strict": True},
528
+ "custom_fields": {"cache_breakpoint": {}},
529
+ },
530
+ # DIAL static tools, resolved by DIAL Core itself
531
+ {
532
+ "type": "static_function",
533
+ "static_function": {"name": "search", "configuration": {}},
534
+ },
535
+ ],
536
+ tool_choice="required",
537
+ parallel_tool_calls=False,
538
+ reasoning_effort="high",
539
+ max_completion_tokens=1000,
540
+ response_format={
541
+ "type": "json_schema",
542
+ "json_schema": {"name": "answer", "schema": {"type": "object"}},
543
+ },
544
+ stream_options={"include_usage": True},
545
+ # DIAL-specific parameters
546
+ max_prompt_tokens=8000,
547
+ custom_fields={
548
+ "configuration": {},
549
+ "cache_breakpoint": {"expire_at": "5m"},
550
+ },
551
+ )
552
+ ```
553
+
554
+ The response models cover the DIAL extensions as well:
555
+
556
+ ```pycon
557
+ >>> completion.choices[0].message.custom_content
558
+ CustomContent(
559
+ stages=[
560
+ Stage(
561
+ index=None,
562
+ name='Thinking',
563
+ status='completed',
564
+ content='...',
565
+ attachments=None
566
+ )
567
+ ],
568
+ attachments=None,
569
+ state=None,
570
+ form_value=None,
571
+ form_schema=None
572
+ )
573
+ >>> completion.usage
574
+ CompletionUsage(
575
+ prompt_tokens=11,
576
+ completion_tokens=1,
577
+ total_tokens=12,
578
+ prompt_tokens_details=PromptTokensDetails(
579
+ cached_tokens=8,
580
+ cache_write_tokens=3
581
+ ),
582
+ completion_tokens_details=CompletionTokensDetails(reasoning_tokens=1)
583
+ )
584
+ >>> completion.statistics
585
+ Statistics(
586
+ usage_per_model=[
587
+ UsagePerModel(
588
+ index=0,
589
+ model='gpt-4o',
590
+ prompt_tokens=11,
591
+ completion_tokens=1,
592
+ total_tokens=12
593
+ )
594
+ ],
595
+ discarded_messages=[0, 1]
596
+ )
597
+ ```
598
+
489
599
  ### Working with Files
490
600
 
491
601
  #### Working with URLs
@@ -25,6 +25,7 @@
25
25
  - [Make Chat Completions Requests](#make-chat-completions-requests)
26
26
  - [Without Streaming](#without-streaming)
27
27
  - [With Streaming](#with-streaming)
28
+ - [DIAL-specific and Extended Parameters](#dial-specific-and-extended-parameters)
28
29
  - [Working with Files](#working-with-files)
29
30
  - [Working with URLs](#working-with-urls)
30
31
  - [Uploading Files](#uploading-files)
@@ -464,6 +465,115 @@ ChatCompletionChunk(
464
465
  )
465
466
  ```
466
467
 
468
+ #### DIAL-specific and Extended Parameters
469
+
470
+ Along with the standard OpenAI parameters, `chat.completions.create` accepts
471
+ the DIAL extensions and the newer OpenAI parameters:
472
+
473
+ ```python
474
+ completion = client.chat.completions.create(
475
+ deployment_name="gpt-4o",
476
+ stream=False,
477
+ messages=[
478
+ # Messages support multi-modal content parts,
479
+ # the "developer" role and per-message cache breakpoints
480
+ {
481
+ "role": "developer",
482
+ "content": "Be brief",
483
+ "custom_fields": {"cache_breakpoint": {"expire_at": "1h"}},
484
+ },
485
+ {
486
+ "role": "user",
487
+ "content": [
488
+ {"type": "text", "text": "What is on the picture?"},
489
+ {
490
+ "type": "image_url",
491
+ "image_url": {"url": "https://example.com/image.png"},
492
+ },
493
+ ],
494
+ # DIAL attachments, stages and forms
495
+ "custom_content": {
496
+ "attachments": [
497
+ {"type": "image/png", "url": "files/bucket/image.png"}
498
+ ]
499
+ },
500
+ },
501
+ ],
502
+ tools=[
503
+ {
504
+ "type": "function",
505
+ "function": {"name": "get_weather", "parameters": {}, "strict": True},
506
+ "custom_fields": {"cache_breakpoint": {}},
507
+ },
508
+ # DIAL static tools, resolved by DIAL Core itself
509
+ {
510
+ "type": "static_function",
511
+ "static_function": {"name": "search", "configuration": {}},
512
+ },
513
+ ],
514
+ tool_choice="required",
515
+ parallel_tool_calls=False,
516
+ reasoning_effort="high",
517
+ max_completion_tokens=1000,
518
+ response_format={
519
+ "type": "json_schema",
520
+ "json_schema": {"name": "answer", "schema": {"type": "object"}},
521
+ },
522
+ stream_options={"include_usage": True},
523
+ # DIAL-specific parameters
524
+ max_prompt_tokens=8000,
525
+ custom_fields={
526
+ "configuration": {},
527
+ "cache_breakpoint": {"expire_at": "5m"},
528
+ },
529
+ )
530
+ ```
531
+
532
+ The response models cover the DIAL extensions as well:
533
+
534
+ ```pycon
535
+ >>> completion.choices[0].message.custom_content
536
+ CustomContent(
537
+ stages=[
538
+ Stage(
539
+ index=None,
540
+ name='Thinking',
541
+ status='completed',
542
+ content='...',
543
+ attachments=None
544
+ )
545
+ ],
546
+ attachments=None,
547
+ state=None,
548
+ form_value=None,
549
+ form_schema=None
550
+ )
551
+ >>> completion.usage
552
+ CompletionUsage(
553
+ prompt_tokens=11,
554
+ completion_tokens=1,
555
+ total_tokens=12,
556
+ prompt_tokens_details=PromptTokensDetails(
557
+ cached_tokens=8,
558
+ cache_write_tokens=3
559
+ ),
560
+ completion_tokens_details=CompletionTokensDetails(reasoning_tokens=1)
561
+ )
562
+ >>> completion.statistics
563
+ Statistics(
564
+ usage_per_model=[
565
+ UsagePerModel(
566
+ index=0,
567
+ model='gpt-4o',
568
+ prompt_tokens=11,
569
+ completion_tokens=1,
570
+ total_tokens=12
571
+ )
572
+ ],
573
+ discarded_messages=[0, 1]
574
+ )
575
+ ```
576
+
467
577
  ### Working with Files
468
578
 
469
579
  #### Working with URLs
@@ -28,6 +28,10 @@ from aidial_client.types.chat import (
28
28
  FunctionCallSpecParam,
29
29
  FunctionParam,
30
30
  Message,
31
+ ReasoningEffort,
32
+ ResponseFormat,
33
+ StaticToolParam,
34
+ StreamOptions,
31
35
  ToolCallSpecParam,
32
36
  ToolParam,
33
37
  )
@@ -51,19 +55,26 @@ class ChatCompletions(Resource):
51
55
  function_call: Literal["none", "auto"]
52
56
  | FunctionCallSpecParam
53
57
  | None = None,
54
- tools: list[ToolParam] | None = None,
55
- tool_choice: Literal["none", "auto"] | ToolCallSpecParam | None = None,
58
+ tools: list[ToolParam | StaticToolParam] | None = None,
59
+ tool_choice: Literal["none", "auto", "required"]
60
+ | ToolCallSpecParam
61
+ | None = None,
62
+ parallel_tool_calls: bool | None = None,
56
63
  temperature: float | None = None,
57
64
  top_p: float | None = None,
58
65
  n: int | None = None,
59
66
  stop: str | list[str] | None = None,
60
67
  max_tokens: int | None = None,
68
+ max_completion_tokens: int | None = None,
61
69
  max_prompt_tokens: Literal["infinity"] | int | None = None,
62
70
  presence_penalty: float | None = None,
63
71
  frequency_penalty: float | None = None,
64
72
  logit_bias: dict | None = None,
65
73
  seed: int | None = None,
66
74
  user: str | None = None,
75
+ reasoning_effort: ReasoningEffort | None = None,
76
+ response_format: ResponseFormat | None = None,
77
+ stream_options: StreamOptions | None = None,
67
78
  custom_fields: ChatCompletionRequestCustomFields | None = None,
68
79
  logprobs: bool | None = None,
69
80
  top_logprobs: int | None = None,
@@ -86,19 +97,26 @@ class ChatCompletions(Resource):
86
97
  function_call: Literal["none", "auto"]
87
98
  | FunctionCallSpecParam
88
99
  | None = None,
89
- tools: list[ToolParam] | None = None,
90
- tool_choice: Literal["none", "auto"] | ToolCallSpecParam | None = None,
100
+ tools: list[ToolParam | StaticToolParam] | None = None,
101
+ tool_choice: Literal["none", "auto", "required"]
102
+ | ToolCallSpecParam
103
+ | None = None,
104
+ parallel_tool_calls: bool | None = None,
91
105
  temperature: float | None = None,
92
106
  top_p: float | None = None,
93
107
  n: int | None = None,
94
108
  stop: str | list[str] | None = None,
95
109
  max_tokens: int | None = None,
110
+ max_completion_tokens: int | None = None,
96
111
  max_prompt_tokens: Literal["infinity"] | int | None = None,
97
112
  presence_penalty: float | None = None,
98
113
  frequency_penalty: float | None = None,
99
114
  logit_bias: dict | None = None,
100
115
  seed: int | None = None,
101
116
  user: str | None = None,
117
+ reasoning_effort: ReasoningEffort | None = None,
118
+ response_format: ResponseFormat | None = None,
119
+ stream_options: StreamOptions | None = None,
102
120
  custom_fields: ChatCompletionRequestCustomFields | None = None,
103
121
  logprobs: bool | None = None,
104
122
  top_logprobs: int | None = None,
@@ -120,19 +138,26 @@ class ChatCompletions(Resource):
120
138
  function_call: Literal["none", "auto"]
121
139
  | FunctionCallSpecParam
122
140
  | None = None,
123
- tools: list[ToolParam] | None = None,
124
- tool_choice: Literal["none", "auto"] | ToolCallSpecParam | None = None,
141
+ tools: list[ToolParam | StaticToolParam] | None = None,
142
+ tool_choice: Literal["none", "auto", "required"]
143
+ | ToolCallSpecParam
144
+ | None = None,
145
+ parallel_tool_calls: bool | None = None,
125
146
  temperature: float | None = None,
126
147
  top_p: float | None = None,
127
148
  n: int | None = None,
128
149
  stop: str | list[str] | None = None,
129
150
  max_tokens: int | None = None,
151
+ max_completion_tokens: int | None = None,
130
152
  max_prompt_tokens: Literal["infinity"] | int | None = None,
131
153
  presence_penalty: float | None = None,
132
154
  frequency_penalty: float | None = None,
133
155
  logit_bias: dict | None = None,
134
156
  seed: int | None = None,
135
157
  user: str | None = None,
158
+ reasoning_effort: ReasoningEffort | None = None,
159
+ response_format: ResponseFormat | None = None,
160
+ stream_options: StreamOptions | None = None,
136
161
  custom_fields: ChatCompletionRequestCustomFields | None = None,
137
162
  logprobs: bool | None = None,
138
163
  top_logprobs: int | None = None,
@@ -165,11 +190,24 @@ class ChatCompletions(Resource):
165
190
  "tools": tools,
166
191
  "top_p": top_p,
167
192
  "user": user,
168
- "max_prompt_tokens": max_prompt_tokens,
169
- "custom_fields": custom_fields,
170
193
  "logprobs": logprobs,
171
194
  "top_logprobs": top_logprobs,
172
- "extra_body": extra_body,
195
+ # DIAL-specific parameters and the ones which aren't supported
196
+ # by every openai version are sent in the request body directly
197
+ "extra_body": {
198
+ **remove_none(
199
+ {
200
+ "max_prompt_tokens": max_prompt_tokens,
201
+ "custom_fields": custom_fields,
202
+ "max_completion_tokens": max_completion_tokens,
203
+ "parallel_tool_calls": parallel_tool_calls,
204
+ "reasoning_effort": reasoning_effort,
205
+ "response_format": response_format,
206
+ "stream_options": stream_options,
207
+ }
208
+ ),
209
+ **extra_body,
210
+ },
173
211
  "extra_query": {
174
212
  "api-version": (
175
213
  api_version or self.default_api_version or Omit()
@@ -217,20 +255,29 @@ class AsyncChatCompletions(AsyncResource):
217
255
  function_call: Literal["none", "auto"]
218
256
  | FunctionCallSpecParam
219
257
  | None = None,
220
- tools: list[ToolParam] | None = None,
221
- tool_choice: Literal["none", "auto"] | ToolCallSpecParam | None = None,
258
+ tools: list[ToolParam | StaticToolParam] | None = None,
259
+ tool_choice: Literal["none", "auto", "required"]
260
+ | ToolCallSpecParam
261
+ | None = None,
262
+ parallel_tool_calls: bool | None = None,
222
263
  temperature: float | None = None,
223
264
  top_p: float | None = None,
224
265
  n: int | None = None,
225
266
  stop: str | list[str] | None = None,
226
267
  max_tokens: int | None = None,
268
+ max_completion_tokens: int | None = None,
227
269
  max_prompt_tokens: Literal["infinity"] | int | None = None,
228
270
  presence_penalty: float | None = None,
229
271
  frequency_penalty: float | None = None,
230
272
  logit_bias: dict | None = None,
231
273
  seed: int | None = None,
232
274
  user: str | None = None,
275
+ reasoning_effort: ReasoningEffort | None = None,
276
+ response_format: ResponseFormat | None = None,
277
+ stream_options: StreamOptions | None = None,
233
278
  custom_fields: ChatCompletionRequestCustomFields | None = None,
279
+ logprobs: bool | None = None,
280
+ top_logprobs: int | None = None,
234
281
  # Extra params
235
282
  extra_body: dict[str, Any] | None = None,
236
283
  extra_headers: Mapping[StrictStr, StrictStr] | None = None,
@@ -250,19 +297,26 @@ class AsyncChatCompletions(AsyncResource):
250
297
  function_call: Literal["none", "auto"]
251
298
  | FunctionCallSpecParam
252
299
  | None = None,
253
- tools: list[ToolParam] | None = None,
254
- tool_choice: Literal["none", "auto"] | ToolCallSpecParam | None = None,
300
+ tools: list[ToolParam | StaticToolParam] | None = None,
301
+ tool_choice: Literal["none", "auto", "required"]
302
+ | ToolCallSpecParam
303
+ | None = None,
304
+ parallel_tool_calls: bool | None = None,
255
305
  temperature: float | None = None,
256
306
  top_p: float | None = None,
257
307
  n: int | None = None,
258
308
  stop: str | list[str] | None = None,
259
309
  max_tokens: int | None = None,
310
+ max_completion_tokens: int | None = None,
260
311
  max_prompt_tokens: Literal["infinity"] | int | None = None,
261
312
  presence_penalty: float | None = None,
262
313
  frequency_penalty: float | None = None,
263
314
  logit_bias: dict | None = None,
264
315
  seed: int | None = None,
265
316
  user: str | None = None,
317
+ reasoning_effort: ReasoningEffort | None = None,
318
+ response_format: ResponseFormat | None = None,
319
+ stream_options: StreamOptions | None = None,
266
320
  custom_fields: ChatCompletionRequestCustomFields | None = None,
267
321
  logprobs: bool | None = None,
268
322
  top_logprobs: int | None = None,
@@ -284,19 +338,26 @@ class AsyncChatCompletions(AsyncResource):
284
338
  function_call: Literal["none", "auto"]
285
339
  | FunctionCallSpecParam
286
340
  | None = None,
287
- tools: list[ToolParam] | None = None,
288
- tool_choice: Literal["none", "auto"] | ToolCallSpecParam | None = None,
341
+ tools: list[ToolParam | StaticToolParam] | None = None,
342
+ tool_choice: Literal["none", "auto", "required"]
343
+ | ToolCallSpecParam
344
+ | None = None,
345
+ parallel_tool_calls: bool | None = None,
289
346
  temperature: float | None = None,
290
347
  top_p: float | None = None,
291
348
  n: int | None = None,
292
349
  stop: str | list[str] | None = None,
293
350
  max_tokens: int | None = None,
351
+ max_completion_tokens: int | None = None,
294
352
  max_prompt_tokens: Literal["infinity"] | int | None = None,
295
353
  presence_penalty: float | None = None,
296
354
  frequency_penalty: float | None = None,
297
355
  logit_bias: dict | None = None,
298
356
  seed: int | None = None,
299
357
  user: str | None = None,
358
+ reasoning_effort: ReasoningEffort | None = None,
359
+ response_format: ResponseFormat | None = None,
360
+ stream_options: StreamOptions | None = None,
300
361
  custom_fields: ChatCompletionRequestCustomFields | None = None,
301
362
  logprobs: bool | None = None,
302
363
  top_logprobs: int | None = None,
@@ -329,11 +390,24 @@ class AsyncChatCompletions(AsyncResource):
329
390
  "tools": tools,
330
391
  "top_p": top_p,
331
392
  "user": user,
332
- "max_prompt_tokens": max_prompt_tokens,
333
- "custom_fields": custom_fields,
334
393
  "logprobs": logprobs,
335
394
  "top_logprobs": top_logprobs,
336
- "extra_body": extra_body,
395
+ # DIAL-specific parameters and the ones which aren't supported
396
+ # by every openai version are sent in the request body directly
397
+ "extra_body": {
398
+ **remove_none(
399
+ {
400
+ "max_prompt_tokens": max_prompt_tokens,
401
+ "custom_fields": custom_fields,
402
+ "max_completion_tokens": max_completion_tokens,
403
+ "parallel_tool_calls": parallel_tool_calls,
404
+ "reasoning_effort": reasoning_effort,
405
+ "response_format": response_format,
406
+ "stream_options": stream_options,
407
+ }
408
+ ),
409
+ **extra_body,
410
+ },
337
411
  "extra_query": {
338
412
  "api-version": (
339
413
  api_version or self.default_api_version or Omit()
@@ -0,0 +1,112 @@
1
+ from .cache import CacheBreakpointParam
2
+ from .function import FunctionCallSpecParam, FunctionParam
3
+ from .request import (
4
+ ChatCompletionRequest,
5
+ ChatCompletionRequestCustomFields,
6
+ ReasoningEffort,
7
+ StreamOptions,
8
+ )
9
+ from .request_param import (
10
+ AssistantMessageParam,
11
+ AttachmentParam,
12
+ CustomContentParam,
13
+ DeveloperMessageParam,
14
+ FunctionMessageParam,
15
+ ImageURLParam,
16
+ InputAudioParam,
17
+ InputFileParam,
18
+ Message,
19
+ MessageContentAudioPartParam,
20
+ MessageContentFilePartParam,
21
+ MessageContentImagePartParam,
22
+ MessageContentPartParam,
23
+ MessageContentRefusalPartParam,
24
+ MessageContentTextPartParam,
25
+ MessageCustomFieldsParam,
26
+ ResponseFormat,
27
+ ResponseFormatJsonObject,
28
+ ResponseFormatJsonSchema,
29
+ ResponseFormatJsonSchemaObject,
30
+ ResponseFormatText,
31
+ StageParam,
32
+ SystemMessageParam,
33
+ ToolMessageParam,
34
+ UserMessageParam,
35
+ )
36
+ from .response import (
37
+ Attachment,
38
+ ChatCompletionChunk,
39
+ ChatCompletionMessage,
40
+ ChatCompletionMessageDelta,
41
+ ChatCompletionResponse,
42
+ Choice,
43
+ ChoiceDelta,
44
+ CompletionTokensDetails,
45
+ CompletionUsage,
46
+ CustomContent,
47
+ PromptTokensDetails,
48
+ Stage,
49
+ Statistics,
50
+ UsagePerModel,
51
+ )
52
+ from .tool import (
53
+ StaticFunctionParam,
54
+ StaticToolParam,
55
+ ToolCallSpecParam,
56
+ ToolCustomFieldsParam,
57
+ ToolParam,
58
+ )
59
+
60
+ __all__ = [
61
+ "AssistantMessageParam",
62
+ "Attachment",
63
+ "AttachmentParam",
64
+ "CacheBreakpointParam",
65
+ "ChatCompletionChunk",
66
+ "ChatCompletionMessage",
67
+ "ChatCompletionMessageDelta",
68
+ "ChatCompletionRequest",
69
+ "ChatCompletionRequestCustomFields",
70
+ "ChatCompletionResponse",
71
+ "Choice",
72
+ "ChoiceDelta",
73
+ "CompletionTokensDetails",
74
+ "CompletionUsage",
75
+ "CustomContent",
76
+ "CustomContentParam",
77
+ "DeveloperMessageParam",
78
+ "FunctionCallSpecParam",
79
+ "FunctionMessageParam",
80
+ "FunctionParam",
81
+ "ImageURLParam",
82
+ "InputAudioParam",
83
+ "InputFileParam",
84
+ "Message",
85
+ "MessageContentAudioPartParam",
86
+ "MessageContentFilePartParam",
87
+ "MessageContentImagePartParam",
88
+ "MessageContentPartParam",
89
+ "MessageContentRefusalPartParam",
90
+ "MessageContentTextPartParam",
91
+ "MessageCustomFieldsParam",
92
+ "PromptTokensDetails",
93
+ "ReasoningEffort",
94
+ "ResponseFormat",
95
+ "ResponseFormatJsonObject",
96
+ "ResponseFormatJsonSchema",
97
+ "ResponseFormatJsonSchemaObject",
98
+ "ResponseFormatText",
99
+ "Stage",
100
+ "StageParam",
101
+ "StaticFunctionParam",
102
+ "StaticToolParam",
103
+ "Statistics",
104
+ "StreamOptions",
105
+ "SystemMessageParam",
106
+ "ToolCallSpecParam",
107
+ "ToolCustomFieldsParam",
108
+ "ToolMessageParam",
109
+ "ToolParam",
110
+ "UsagePerModel",
111
+ "UserMessageParam",
112
+ ]
@@ -0,0 +1,5 @@
1
+ from typing_extensions import TypedDict
2
+
3
+
4
+ class CacheBreakpointParam(TypedDict, total=False):
5
+ expire_at: str | None
@@ -5,6 +5,7 @@ class FunctionParam(TypedDict, total=False):
5
5
  name: Required[str]
6
6
  description: str | None
7
7
  parameters: dict | None
8
+ strict: bool | None
8
9
 
9
10
 
10
11
  class FunctionCallParam(TypedDict):
@@ -2,16 +2,28 @@ from typing import Any, Literal
2
2
 
3
3
  from typing_extensions import TypedDict
4
4
 
5
+ from aidial_client.types.chat.cache import CacheBreakpointParam
5
6
  from aidial_client.types.chat.function import (
6
7
  FunctionCallSpecParam,
7
8
  FunctionParam,
8
9
  )
9
10
  from aidial_client.types.chat.request_param import Message, ResponseFormat
10
- from aidial_client.types.chat.tool import ToolCallSpecParam, ToolParam
11
+ from aidial_client.types.chat.tool import (
12
+ StaticToolParam,
13
+ ToolCallSpecParam,
14
+ ToolParam,
15
+ )
16
+
17
+ ReasoningEffort = Literal["none", "minimal", "low", "medium", "high"]
18
+
19
+
20
+ class StreamOptions(TypedDict, total=False):
21
+ include_usage: bool | None
11
22
 
12
23
 
13
24
  class ChatCompletionRequestCustomFields(TypedDict, total=False):
14
25
  configuration: dict[str, Any] | None
26
+ cache_breakpoint: CacheBreakpointParam | None
15
27
 
16
28
 
17
29
  class ChatCompletionRequest(TypedDict, total=False):
@@ -19,8 +31,10 @@ class ChatCompletionRequest(TypedDict, total=False):
19
31
  temperature: float | None
20
32
  top_p: float | None
21
33
  stream: bool | None
34
+ stream_options: StreamOptions | None
22
35
  stop: str | list[str] | None
23
36
  max_tokens: int | None
37
+ max_completion_tokens: int | None
24
38
  presence_penalty: float | None
25
39
  frequency_penalty: float | None
26
40
  logit_bias: dict | None
@@ -30,10 +44,12 @@ class ChatCompletionRequest(TypedDict, total=False):
30
44
  n: int | None
31
45
  seed: int | None
32
46
  logprobs: bool | None
33
- top_logprobs: float | None
47
+ top_logprobs: int | None
48
+ reasoning_effort: ReasoningEffort | None
34
49
  response_format: ResponseFormat | None
35
- tools: list[ToolParam] | None
36
- tool_choice: Literal["none", "auto"] | ToolCallSpecParam | None
50
+ tools: list[ToolParam | StaticToolParam] | None
51
+ tool_choice: Literal["none", "auto", "required"] | ToolCallSpecParam | None
52
+ parallel_tool_calls: bool | None
37
53
  functions: list[FunctionParam] | None
38
54
  function_call: Literal["none", "auto"] | FunctionCallSpecParam | None
39
55
  max_prompt_tokens: Literal["infinity"] | int | None