|
2 | 2 |
|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
| 5 | +from typing import Iterable |
| 6 | + |
5 | 7 | import httpx |
6 | 8 |
|
| 9 | +from ..types import tui_prompt_params |
7 | 10 | from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven |
| 11 | +from .._utils import maybe_transform, async_maybe_transform |
8 | 12 | from .._compat import cached_property |
9 | 13 | from .._resource import SyncAPIResource, AsyncAPIResource |
10 | 14 | from .._response import ( |
|
14 | 18 | async_to_streamed_response_wrapper, |
15 | 19 | ) |
16 | 20 | from .._base_client import make_request_options |
| 21 | +from ..types.part_param import PartParam |
17 | 22 | from ..types.tui_prompt_response import TuiPromptResponse |
18 | 23 |
|
19 | 24 | __all__ = ["TuiResource", "AsyncTuiResource"] |
@@ -42,16 +47,36 @@ def with_streaming_response(self) -> TuiResourceWithStreamingResponse: |
42 | 47 | def prompt( |
43 | 48 | self, |
44 | 49 | *, |
| 50 | + parts: Iterable[PartParam], |
| 51 | + text: str, |
45 | 52 | # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
46 | 53 | # The extra values given here take precedence over values defined on the client or passed to this method. |
47 | 54 | extra_headers: Headers | None = None, |
48 | 55 | extra_query: Query | None = None, |
49 | 56 | extra_body: Body | None = None, |
50 | 57 | timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
51 | 58 | ) -> TuiPromptResponse: |
52 | | - """Send a prompt to the TUI""" |
| 59 | + """ |
| 60 | + Send a prompt to the TUI |
| 61 | +
|
| 62 | + Args: |
| 63 | + extra_headers: Send extra headers |
| 64 | +
|
| 65 | + extra_query: Add additional query parameters to the request |
| 66 | +
|
| 67 | + extra_body: Add additional JSON properties to the request |
| 68 | +
|
| 69 | + timeout: Override the client-level default timeout for this request, in seconds |
| 70 | + """ |
53 | 71 | return self._post( |
54 | 72 | "/tui/prompt", |
| 73 | + body=maybe_transform( |
| 74 | + { |
| 75 | + "parts": parts, |
| 76 | + "text": text, |
| 77 | + }, |
| 78 | + tui_prompt_params.TuiPromptParams, |
| 79 | + ), |
55 | 80 | options=make_request_options( |
56 | 81 | extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
57 | 82 | ), |
@@ -82,16 +107,36 @@ def with_streaming_response(self) -> AsyncTuiResourceWithStreamingResponse: |
82 | 107 | async def prompt( |
83 | 108 | self, |
84 | 109 | *, |
| 110 | + parts: Iterable[PartParam], |
| 111 | + text: str, |
85 | 112 | # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
86 | 113 | # The extra values given here take precedence over values defined on the client or passed to this method. |
87 | 114 | extra_headers: Headers | None = None, |
88 | 115 | extra_query: Query | None = None, |
89 | 116 | extra_body: Body | None = None, |
90 | 117 | timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
91 | 118 | ) -> TuiPromptResponse: |
92 | | - """Send a prompt to the TUI""" |
| 119 | + """ |
| 120 | + Send a prompt to the TUI |
| 121 | +
|
| 122 | + Args: |
| 123 | + extra_headers: Send extra headers |
| 124 | +
|
| 125 | + extra_query: Add additional query parameters to the request |
| 126 | +
|
| 127 | + extra_body: Add additional JSON properties to the request |
| 128 | +
|
| 129 | + timeout: Override the client-level default timeout for this request, in seconds |
| 130 | + """ |
93 | 131 | return await self._post( |
94 | 132 | "/tui/prompt", |
| 133 | + body=await async_maybe_transform( |
| 134 | + { |
| 135 | + "parts": parts, |
| 136 | + "text": text, |
| 137 | + }, |
| 138 | + tui_prompt_params.TuiPromptParams, |
| 139 | + ), |
95 | 140 | options=make_request_options( |
96 | 141 | extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
97 | 142 | ), |
|
0 commit comments