feat(api): api update

This commit is contained in:
stainless-app[bot] 2025-07-21 23:24:37 +00:00
parent e27c59a26c
commit be1f9d88f0
17 changed files with 426 additions and 11 deletions

View file

@ -2,9 +2,13 @@
from __future__ import annotations
from typing import Iterable
import httpx
from ..types import tui_prompt_params
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._utils import maybe_transform, async_maybe_transform
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import (
@ -14,6 +18,7 @@ from .._response import (
async_to_streamed_response_wrapper,
)
from .._base_client import make_request_options
from ..types.part_param import PartParam
from ..types.tui_prompt_response import TuiPromptResponse
__all__ = ["TuiResource", "AsyncTuiResource"]
@ -42,6 +47,8 @@ class TuiResource(SyncAPIResource):
def prompt(
self,
*,
parts: Iterable[PartParam],
text: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
@ -49,9 +56,27 @@ class TuiResource(SyncAPIResource):
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> TuiPromptResponse:
"""Send a prompt to the TUI"""
"""
Send a prompt to the TUI
Args:
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
"/tui/prompt",
body=maybe_transform(
{
"parts": parts,
"text": text,
},
tui_prompt_params.TuiPromptParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@ -82,6 +107,8 @@ class AsyncTuiResource(AsyncAPIResource):
async def prompt(
self,
*,
parts: Iterable[PartParam],
text: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
@ -89,9 +116,27 @@ class AsyncTuiResource(AsyncAPIResource):
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> TuiPromptResponse:
"""Send a prompt to the TUI"""
"""
Send a prompt to the TUI
Args:
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
"/tui/prompt",
body=await async_maybe_transform(
{
"parts": parts,
"text": text,
},
tui_prompt_params.TuiPromptParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),