Skip to content

Commit 7501365

Browse files
feat: Add truncation parameter support
1 parent a0f6975 commit 7501365

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 108
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-8b51d3973d2f51c91cf9ca3e4d40fd78ae92ffb1063308828c245f7e3d7ec813.yml
3-
openapi_spec_hash: cb486698ac88370772a873d1fef90968
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-408a03048e7b2e79fd6495e59120ee5fc2ff71503be4a470529efaa88ca911e2.yml
3+
openapi_spec_hash: 24512bdd1c4bf5b8770f6b8ddf0620d0
44
config_hash: 07e70c7f1980785685ea4f2618dfde62

src/llama_stack_client/resources/responses/responses.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def create(
110110
text: Optional[response_create_params.Text] | Omit = omit,
111111
tool_choice: Optional[response_create_params.ToolChoice] | Omit = omit,
112112
tools: Optional[Iterable[response_create_params.Tool]] | Omit = omit,
113+
truncation: Optional[Literal["auto", "disabled"]] | Omit = omit,
113114
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
114115
# The extra values given here take precedence over values defined on the client or passed to this method.
115116
extra_headers: Headers | None = None,
@@ -165,6 +166,9 @@ def create(
165166
166167
tools: List of tools available to the model.
167168
169+
truncation: Controls how the service truncates input when it exceeds the model context
170+
window.
171+
168172
extra_headers: Send extra headers
169173
170174
extra_query: Add additional query parameters to the request
@@ -218,6 +222,7 @@ def create(
218222
text: Optional[response_create_params.Text] | Omit = omit,
219223
tool_choice: Optional[response_create_params.ToolChoice] | Omit = omit,
220224
tools: Optional[Iterable[response_create_params.Tool]] | Omit = omit,
225+
truncation: Optional[Literal["auto", "disabled"]] | Omit = omit,
221226
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
222227
# The extra values given here take precedence over values defined on the client or passed to this method.
223228
extra_headers: Headers | None = None,
@@ -273,6 +278,9 @@ def create(
273278
274279
tools: List of tools available to the model.
275280
281+
truncation: Controls how the service truncates input when it exceeds the model context
282+
window.
283+
276284
extra_headers: Send extra headers
277285
278286
extra_query: Add additional query parameters to the request
@@ -326,6 +334,7 @@ def create(
326334
text: Optional[response_create_params.Text] | Omit = omit,
327335
tool_choice: Optional[response_create_params.ToolChoice] | Omit = omit,
328336
tools: Optional[Iterable[response_create_params.Tool]] | Omit = omit,
337+
truncation: Optional[Literal["auto", "disabled"]] | Omit = omit,
329338
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
330339
# The extra values given here take precedence over values defined on the client or passed to this method.
331340
extra_headers: Headers | None = None,
@@ -381,6 +390,9 @@ def create(
381390
382391
tools: List of tools available to the model.
383392
393+
truncation: Controls how the service truncates input when it exceeds the model context
394+
window.
395+
384396
extra_headers: Send extra headers
385397
386398
extra_query: Add additional query parameters to the request
@@ -434,6 +446,7 @@ def create(
434446
text: Optional[response_create_params.Text] | Omit = omit,
435447
tool_choice: Optional[response_create_params.ToolChoice] | Omit = omit,
436448
tools: Optional[Iterable[response_create_params.Tool]] | Omit = omit,
449+
truncation: Optional[Literal["auto", "disabled"]] | Omit = omit,
437450
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
438451
# The extra values given here take precedence over values defined on the client or passed to this method.
439452
extra_headers: Headers | None = None,
@@ -466,6 +479,7 @@ def create(
466479
"text": text,
467480
"tool_choice": tool_choice,
468481
"tools": tools,
482+
"truncation": truncation,
469483
},
470484
response_create_params.ResponseCreateParamsStreaming
471485
if stream
@@ -672,6 +686,7 @@ async def create(
672686
text: Optional[response_create_params.Text] | Omit = omit,
673687
tool_choice: Optional[response_create_params.ToolChoice] | Omit = omit,
674688
tools: Optional[Iterable[response_create_params.Tool]] | Omit = omit,
689+
truncation: Optional[Literal["auto", "disabled"]] | Omit = omit,
675690
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
676691
# The extra values given here take precedence over values defined on the client or passed to this method.
677692
extra_headers: Headers | None = None,
@@ -727,6 +742,9 @@ async def create(
727742
728743
tools: List of tools available to the model.
729744
745+
truncation: Controls how the service truncates input when it exceeds the model context
746+
window.
747+
730748
extra_headers: Send extra headers
731749
732750
extra_query: Add additional query parameters to the request
@@ -780,6 +798,7 @@ async def create(
780798
text: Optional[response_create_params.Text] | Omit = omit,
781799
tool_choice: Optional[response_create_params.ToolChoice] | Omit = omit,
782800
tools: Optional[Iterable[response_create_params.Tool]] | Omit = omit,
801+
truncation: Optional[Literal["auto", "disabled"]] | Omit = omit,
783802
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
784803
# The extra values given here take precedence over values defined on the client or passed to this method.
785804
extra_headers: Headers | None = None,
@@ -835,6 +854,9 @@ async def create(
835854
836855
tools: List of tools available to the model.
837856
857+
truncation: Controls how the service truncates input when it exceeds the model context
858+
window.
859+
838860
extra_headers: Send extra headers
839861
840862
extra_query: Add additional query parameters to the request
@@ -888,6 +910,7 @@ async def create(
888910
text: Optional[response_create_params.Text] | Omit = omit,
889911
tool_choice: Optional[response_create_params.ToolChoice] | Omit = omit,
890912
tools: Optional[Iterable[response_create_params.Tool]] | Omit = omit,
913+
truncation: Optional[Literal["auto", "disabled"]] | Omit = omit,
891914
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
892915
# The extra values given here take precedence over values defined on the client or passed to this method.
893916
extra_headers: Headers | None = None,
@@ -943,6 +966,9 @@ async def create(
943966
944967
tools: List of tools available to the model.
945968
969+
truncation: Controls how the service truncates input when it exceeds the model context
970+
window.
971+
946972
extra_headers: Send extra headers
947973
948974
extra_query: Add additional query parameters to the request
@@ -996,6 +1022,7 @@ async def create(
9961022
text: Optional[response_create_params.Text] | Omit = omit,
9971023
tool_choice: Optional[response_create_params.ToolChoice] | Omit = omit,
9981024
tools: Optional[Iterable[response_create_params.Tool]] | Omit = omit,
1025+
truncation: Optional[Literal["auto", "disabled"]] | Omit = omit,
9991026
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
10001027
# The extra values given here take precedence over values defined on the client or passed to this method.
10011028
extra_headers: Headers | None = None,
@@ -1028,6 +1055,7 @@ async def create(
10281055
"text": text,
10291056
"tool_choice": tool_choice,
10301057
"tools": tools,
1058+
"truncation": truncation,
10311059
},
10321060
response_create_params.ResponseCreateParamsStreaming
10331061
if stream

src/llama_stack_client/types/response_create_params.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ class ResponseCreateParamsBase(TypedDict, total=False):
158158
tools: Optional[Iterable[Tool]]
159159
"""List of tools available to the model."""
160160

161+
truncation: Optional[Literal["auto", "disabled"]]
162+
"""
163+
Controls how the service truncates input when it exceeds the model context
164+
window.
165+
"""
166+
161167

162168
class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMcpApprovalResponseOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText(
163169
TypedDict, total=False

tests/api_resources/test_responses.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def test_method_create_with_all_params_overload_1(self, client: LlamaStackClient
8282
"type": "web_search",
8383
}
8484
],
85+
truncation="auto",
8586
)
8687
assert_matches_type(ResponseObject, response, path=["response"])
8788

@@ -166,6 +167,7 @@ def test_method_create_with_all_params_overload_2(self, client: LlamaStackClient
166167
"type": "web_search",
167168
}
168169
],
170+
truncation="auto",
169171
)
170172
response_stream.response.close()
171173

@@ -367,6 +369,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn
367369
"type": "web_search",
368370
}
369371
],
372+
truncation="auto",
370373
)
371374
assert_matches_type(ResponseObject, response, path=["response"])
372375

@@ -451,6 +454,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn
451454
"type": "web_search",
452455
}
453456
],
457+
truncation="auto",
454458
)
455459
await response_stream.response.aclose()
456460

0 commit comments

Comments
 (0)