From 8285c8fa1a2c193c6ced1a5bd9ea4ac1380737f5 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 15 Jan 2025 08:33:21 +0000
Subject: [PATCH] feat(api): update via SDK Studio
---
api.md | 2 +-
src/contextual/pagination.py | 8 ++++----
src/contextual/resources/agents/agents.py | 10 +++++-----
tests/api_resources/test_agents.py | 18 +++++++++---------
4 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/api.md b/api.md
index e479a2d..6e65bff 100644
--- a/api.md
+++ b/api.md
@@ -58,7 +58,7 @@ Methods:
- client.agents.create(\*\*params) -> CreateAgentOutput
- client.agents.update(agent_id, \*\*params) -> object
-- client.agents.list(\*\*params) -> SyncAgentsPage[Agent]
+- client.agents.list(\*\*params) -> SyncPage[Agent]
- client.agents.delete(agent_id) -> object
- client.agents.metadata(agent_id) -> AgentMetadata
diff --git a/src/contextual/pagination.py b/src/contextual/pagination.py
index dbe57c8..44d93fc 100644
--- a/src/contextual/pagination.py
+++ b/src/contextual/pagination.py
@@ -10,8 +10,8 @@
"AsyncDatastoresPage",
"SyncDocumentsPage",
"AsyncDocumentsPage",
- "SyncAgentsPage",
- "AsyncAgentsPage",
+ "SyncPage",
+ "AsyncPage",
]
_T = TypeVar("_T")
@@ -97,7 +97,7 @@ def next_page_info(self) -> Optional[PageInfo]:
return PageInfo(params={"cursor": next_cursor})
-class SyncAgentsPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
+class SyncPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
agents: List[_T]
next_cursor: Optional[str] = None
@@ -117,7 +117,7 @@ def next_page_info(self) -> Optional[PageInfo]:
return PageInfo(params={"cursor": next_cursor})
-class AsyncAgentsPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
+class AsyncPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
agents: List[_T]
next_cursor: Optional[str] = None
diff --git a/src/contextual/resources/agents/agents.py b/src/contextual/resources/agents/agents.py
index bea8eda..e662b69 100644
--- a/src/contextual/resources/agents/agents.py
+++ b/src/contextual/resources/agents/agents.py
@@ -36,7 +36,7 @@
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
-from ...pagination import SyncAgentsPage, AsyncAgentsPage
+from ...pagination import SyncPage, AsyncPage
from ...types.agent import Agent
from ..._base_client import AsyncPaginator, make_request_options
from .datasets.datasets import (
@@ -242,7 +242,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> SyncAgentsPage[Agent]:
+ ) -> SyncPage[Agent]:
"""
Retrieve a list of all `Agents`.
@@ -262,7 +262,7 @@ def list(
"""
return self._get_api_list(
"/agents",
- page=SyncAgentsPage[Agent],
+ page=SyncPage[Agent],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -536,7 +536,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> AsyncPaginator[Agent, AsyncAgentsPage[Agent]]:
+ ) -> AsyncPaginator[Agent, AsyncPage[Agent]]:
"""
Retrieve a list of all `Agents`.
@@ -556,7 +556,7 @@ def list(
"""
return self._get_api_list(
"/agents",
- page=AsyncAgentsPage[Agent],
+ page=AsyncPage[Agent],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/tests/api_resources/test_agents.py b/tests/api_resources/test_agents.py
index adb73a6..30eb7db 100644
--- a/tests/api_resources/test_agents.py
+++ b/tests/api_resources/test_agents.py
@@ -14,7 +14,7 @@
AgentMetadata,
CreateAgentOutput,
)
-from contextual.pagination import SyncAgentsPage, AsyncAgentsPage
+from contextual.pagination import SyncPage, AsyncPage
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -116,7 +116,7 @@ def test_path_params_update(self, client: ContextualAI) -> None:
@parametrize
def test_method_list(self, client: ContextualAI) -> None:
agent = client.agents.list()
- assert_matches_type(SyncAgentsPage[Agent], agent, path=["response"])
+ assert_matches_type(SyncPage[Agent], agent, path=["response"])
@parametrize
def test_method_list_with_all_params(self, client: ContextualAI) -> None:
@@ -124,7 +124,7 @@ def test_method_list_with_all_params(self, client: ContextualAI) -> None:
cursor="cursor",
limit=1,
)
- assert_matches_type(SyncAgentsPage[Agent], agent, path=["response"])
+ assert_matches_type(SyncPage[Agent], agent, path=["response"])
@parametrize
def test_raw_response_list(self, client: ContextualAI) -> None:
@@ -133,7 +133,7 @@ def test_raw_response_list(self, client: ContextualAI) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
agent = response.parse()
- assert_matches_type(SyncAgentsPage[Agent], agent, path=["response"])
+ assert_matches_type(SyncPage[Agent], agent, path=["response"])
@parametrize
def test_streaming_response_list(self, client: ContextualAI) -> None:
@@ -142,7 +142,7 @@ def test_streaming_response_list(self, client: ContextualAI) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
agent = response.parse()
- assert_matches_type(SyncAgentsPage[Agent], agent, path=["response"])
+ assert_matches_type(SyncPage[Agent], agent, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -320,7 +320,7 @@ async def test_path_params_update(self, async_client: AsyncContextualAI) -> None
@parametrize
async def test_method_list(self, async_client: AsyncContextualAI) -> None:
agent = await async_client.agents.list()
- assert_matches_type(AsyncAgentsPage[Agent], agent, path=["response"])
+ assert_matches_type(AsyncPage[Agent], agent, path=["response"])
@parametrize
async def test_method_list_with_all_params(self, async_client: AsyncContextualAI) -> None:
@@ -328,7 +328,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncContextualAI
cursor="cursor",
limit=1,
)
- assert_matches_type(AsyncAgentsPage[Agent], agent, path=["response"])
+ assert_matches_type(AsyncPage[Agent], agent, path=["response"])
@parametrize
async def test_raw_response_list(self, async_client: AsyncContextualAI) -> None:
@@ -337,7 +337,7 @@ async def test_raw_response_list(self, async_client: AsyncContextualAI) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
agent = await response.parse()
- assert_matches_type(AsyncAgentsPage[Agent], agent, path=["response"])
+ assert_matches_type(AsyncPage[Agent], agent, path=["response"])
@parametrize
async def test_streaming_response_list(self, async_client: AsyncContextualAI) -> None:
@@ -346,7 +346,7 @@ async def test_streaming_response_list(self, async_client: AsyncContextualAI) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
agent = await response.parse()
- assert_matches_type(AsyncAgentsPage[Agent], agent, path=["response"])
+ assert_matches_type(AsyncPage[Agent], agent, path=["response"])
assert cast(Any, response.is_closed) is True