Skip to content

Commit 17e38ac

Browse files
stainless-app[bot]Sean Smith
andauthored
release: 0.5.0 (#62)
Signed-off-by: Sean Smith <[email protected]> Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> Co-authored-by: Sean Smith <[email protected]>
1 parent 5fd7c89 commit 17e38ac

27 files changed

+488
-160
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.4.0"
2+
".": "0.5.0"
33
}

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 46
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-f43814080090927ee22816c5c7f517d8a7eb7f346329ada67915608e32124321.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-194878b194cd507d7c5418ff38cc0fc53441ef618f991990d334b4b75775cd8f.yml

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## 0.5.0 (2025-03-11)
4+
5+
Full Changelog: [v0.4.0...v0.5.0](https://github.com/ContextualAI/contextual-client-python/compare/v0.4.0...v0.5.0)
6+
7+
### Features
8+
9+
* Add to_dataframe method to BinaryAPIReponse ([#56](https://github.com/ContextualAI/contextual-client-python/issues/56)) ([39b862e](https://github.com/ContextualAI/contextual-client-python/commit/39b862eca8d7443c2c86063123d8dfdc484a3c53))
10+
* **api:** update via SDK Studio ([#63](https://github.com/ContextualAI/contextual-client-python/issues/63)) ([59bb1ab](https://github.com/ContextualAI/contextual-client-python/commit/59bb1ab3d790ee7e3d73b2b6a85e67a905d0ca22))
11+
12+
13+
### Chores
14+
15+
* **internal:** remove unused http client options forwarding ([#61](https://github.com/ContextualAI/contextual-client-python/issues/61)) ([40d345d](https://github.com/ContextualAI/contextual-client-python/commit/40d345dd52af82e31e8fa34e5b0b1eebad006684))
16+
317
## 0.4.0 (2025-03-03)
418

519
Full Changelog: [v0.3.0...v0.4.0](https://github.com/ContextualAI/contextual-client-python/compare/v0.3.0...v0.4.0)

api.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# ContextualAI
2+
3+
Types:
4+
5+
```python
6+
from contextual.types import CompositeMetadataFilter
7+
```
8+
19
# Datastores
210

311
Types:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "contextual-client"
3-
version = "0.4.0"
3+
version = "0.5.0"
44
description = "The official Python library for the Contextual AI API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/contextual/_base_client.py

Lines changed: 1 addition & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import inspect
1010
import logging
1111
import platform
12-
import warnings
1312
import email.utils
1413
from types import TracebackType
1514
from random import random
@@ -36,7 +35,7 @@
3635
import httpx
3736
import distro
3837
import pydantic
39-
from httpx import URL, Limits
38+
from httpx import URL
4039
from pydantic import PrivateAttr
4140

4241
from . import _exceptions
@@ -51,13 +50,10 @@
5150
Timeout,
5251
NotGiven,
5352
ResponseT,
54-
Transport,
5553
AnyMapping,
5654
PostParser,
57-
ProxiesTypes,
5855
RequestFiles,
5956
HttpxSendArgs,
60-
AsyncTransport,
6157
RequestOptions,
6258
HttpxRequestFiles,
6359
ModelBuilderProtocol,
@@ -337,9 +333,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
337333
_base_url: URL
338334
max_retries: int
339335
timeout: Union[float, Timeout, None]
340-
_limits: httpx.Limits
341-
_proxies: ProxiesTypes | None
342-
_transport: Transport | AsyncTransport | None
343336
_strict_response_validation: bool
344337
_idempotency_header: str | None
345338
_default_stream_cls: type[_DefaultStreamT] | None = None
@@ -352,19 +345,13 @@ def __init__(
352345
_strict_response_validation: bool,
353346
max_retries: int = DEFAULT_MAX_RETRIES,
354347
timeout: float | Timeout | None = DEFAULT_TIMEOUT,
355-
limits: httpx.Limits,
356-
transport: Transport | AsyncTransport | None,
357-
proxies: ProxiesTypes | None,
358348
custom_headers: Mapping[str, str] | None = None,
359349
custom_query: Mapping[str, object] | None = None,
360350
) -> None:
361351
self._version = version
362352
self._base_url = self._enforce_trailing_slash(URL(base_url))
363353
self.max_retries = max_retries
364354
self.timeout = timeout
365-
self._limits = limits
366-
self._proxies = proxies
367-
self._transport = transport
368355
self._custom_headers = custom_headers or {}
369356
self._custom_query = custom_query or {}
370357
self._strict_response_validation = _strict_response_validation
@@ -800,46 +787,11 @@ def __init__(
800787
base_url: str | URL,
801788
max_retries: int = DEFAULT_MAX_RETRIES,
802789
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
803-
transport: Transport | None = None,
804-
proxies: ProxiesTypes | None = None,
805-
limits: Limits | None = None,
806790
http_client: httpx.Client | None = None,
807791
custom_headers: Mapping[str, str] | None = None,
808792
custom_query: Mapping[str, object] | None = None,
809793
_strict_response_validation: bool,
810794
) -> None:
811-
kwargs: dict[str, Any] = {}
812-
if limits is not None:
813-
warnings.warn(
814-
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
815-
category=DeprecationWarning,
816-
stacklevel=3,
817-
)
818-
if http_client is not None:
819-
raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
820-
else:
821-
limits = DEFAULT_CONNECTION_LIMITS
822-
823-
if transport is not None:
824-
kwargs["transport"] = transport
825-
warnings.warn(
826-
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
827-
category=DeprecationWarning,
828-
stacklevel=3,
829-
)
830-
if http_client is not None:
831-
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")
832-
833-
if proxies is not None:
834-
kwargs["proxies"] = proxies
835-
warnings.warn(
836-
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
837-
category=DeprecationWarning,
838-
stacklevel=3,
839-
)
840-
if http_client is not None:
841-
raise ValueError("The `http_client` argument is mutually exclusive with `proxies`")
842-
843795
if not is_given(timeout):
844796
# if the user passed in a custom http client with a non-default
845797
# timeout set then we use that timeout.
@@ -860,12 +812,9 @@ def __init__(
860812

861813
super().__init__(
862814
version=version,
863-
limits=limits,
864815
# cast to a valid type because mypy doesn't understand our type narrowing
865816
timeout=cast(Timeout, timeout),
866-
proxies=proxies,
867817
base_url=base_url,
868-
transport=transport,
869818
max_retries=max_retries,
870819
custom_query=custom_query,
871820
custom_headers=custom_headers,
@@ -875,9 +824,6 @@ def __init__(
875824
base_url=base_url,
876825
# cast to a valid type because mypy doesn't understand our type narrowing
877826
timeout=cast(Timeout, timeout),
878-
limits=limits,
879-
follow_redirects=True,
880-
**kwargs, # type: ignore
881827
)
882828

883829
def is_closed(self) -> bool:
@@ -1372,45 +1318,10 @@ def __init__(
13721318
_strict_response_validation: bool,
13731319
max_retries: int = DEFAULT_MAX_RETRIES,
13741320
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
1375-
transport: AsyncTransport | None = None,
1376-
proxies: ProxiesTypes | None = None,
1377-
limits: Limits | None = None,
13781321
http_client: httpx.AsyncClient | None = None,
13791322
custom_headers: Mapping[str, str] | None = None,
13801323
custom_query: Mapping[str, object] | None = None,
13811324
) -> None:
1382-
kwargs: dict[str, Any] = {}
1383-
if limits is not None:
1384-
warnings.warn(
1385-
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
1386-
category=DeprecationWarning,
1387-
stacklevel=3,
1388-
)
1389-
if http_client is not None:
1390-
raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
1391-
else:
1392-
limits = DEFAULT_CONNECTION_LIMITS
1393-
1394-
if transport is not None:
1395-
kwargs["transport"] = transport
1396-
warnings.warn(
1397-
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
1398-
category=DeprecationWarning,
1399-
stacklevel=3,
1400-
)
1401-
if http_client is not None:
1402-
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")
1403-
1404-
if proxies is not None:
1405-
kwargs["proxies"] = proxies
1406-
warnings.warn(
1407-
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
1408-
category=DeprecationWarning,
1409-
stacklevel=3,
1410-
)
1411-
if http_client is not None:
1412-
raise ValueError("The `http_client` argument is mutually exclusive with `proxies`")
1413-
14141325
if not is_given(timeout):
14151326
# if the user passed in a custom http client with a non-default
14161327
# timeout set then we use that timeout.
@@ -1432,11 +1343,8 @@ def __init__(
14321343
super().__init__(
14331344
version=version,
14341345
base_url=base_url,
1435-
limits=limits,
14361346
# cast to a valid type because mypy doesn't understand our type narrowing
14371347
timeout=cast(Timeout, timeout),
1438-
proxies=proxies,
1439-
transport=transport,
14401348
max_retries=max_retries,
14411349
custom_query=custom_query,
14421350
custom_headers=custom_headers,
@@ -1446,9 +1354,6 @@ def __init__(
14461354
base_url=base_url,
14471355
# cast to a valid type because mypy doesn't understand our type narrowing
14481356
timeout=cast(Timeout, timeout),
1449-
limits=limits,
1450-
follow_redirects=True,
1451-
**kwargs, # type: ignore
14521357
)
14531358

14541359
def is_closed(self) -> bool:

src/contextual/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "contextual"
4-
__version__ = "0.4.0" # x-release-please-version
4+
__version__ = "0.5.0" # x-release-please-version

src/contextual/resources/agents/agents.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def create(
104104
agent_configs: agent_create_params.AgentConfigs | NotGiven = NOT_GIVEN,
105105
datastore_ids: List[str] | NotGiven = NOT_GIVEN,
106106
description: str | NotGiven = NOT_GIVEN,
107+
filter_prompt: str | NotGiven = NOT_GIVEN,
107108
suggested_queries: List[str] | NotGiven = NOT_GIVEN,
108109
system_prompt: str | NotGiven = NOT_GIVEN,
109110
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -126,6 +127,11 @@ def create(
126127
creates an empty `Datastore` and configures the `Agent` to use the newly created
127128
`Datastore`.
128129
130+
> Note that self-serve users are currently required to create agents through our
131+
> UI. Otherwise, they will receive the following message: "This endpoint is
132+
> disabled as you need to go through checkout. Please use the UI to make this
133+
> request."
134+
129135
Args:
130136
name: Name of the agent
131137
@@ -135,6 +141,9 @@ def create(
135141
136142
description: Description of the agent
137143
144+
filter_prompt: The prompt to an LLM which determines whether retrieved chunks are relevant to a
145+
given query and filters out irrelevant chunks.
146+
138147
suggested_queries: These queries will show up as suggestions in the Contextual UI when users load
139148
the agent. We recommend including common queries that users will ask, as well as
140149
complex queries so users understand the types of complex queries the system can
@@ -159,6 +168,7 @@ def create(
159168
"agent_configs": agent_configs,
160169
"datastore_ids": datastore_ids,
161170
"description": description,
171+
"filter_prompt": filter_prompt,
162172
"suggested_queries": suggested_queries,
163173
"system_prompt": system_prompt,
164174
},
@@ -176,6 +186,7 @@ def update(
176186
*,
177187
agent_configs: agent_update_params.AgentConfigs | NotGiven = NOT_GIVEN,
178188
datastore_ids: List[str] | NotGiven = NOT_GIVEN,
189+
filter_prompt: str | NotGiven = NOT_GIVEN,
179190
llm_model_id: str | NotGiven = NOT_GIVEN,
180191
suggested_queries: List[str] | NotGiven = NOT_GIVEN,
181192
system_prompt: str | NotGiven = NOT_GIVEN,
@@ -198,6 +209,9 @@ def update(
198209
199210
datastore_ids: IDs of the datastore to associate with the agent.
200211
212+
filter_prompt: The prompt to an LLM which determines whether retrieved chunks are relevant to a
213+
given query and filters out irrelevant chunks.
214+
201215
llm_model_id: The model ID to use for generation. Tuned models can only be used for the agents
202216
on which they were tuned. If no model is specified, the default model is used.
203217
Set to `default` to switch from a tuned model to the default model.
@@ -226,6 +240,7 @@ def update(
226240
{
227241
"agent_configs": agent_configs,
228242
"datastore_ids": datastore_ids,
243+
"filter_prompt": filter_prompt,
229244
"llm_model_id": llm_model_id,
230245
"suggested_queries": suggested_queries,
231246
"system_prompt": system_prompt,
@@ -405,6 +420,7 @@ async def create(
405420
agent_configs: agent_create_params.AgentConfigs | NotGiven = NOT_GIVEN,
406421
datastore_ids: List[str] | NotGiven = NOT_GIVEN,
407422
description: str | NotGiven = NOT_GIVEN,
423+
filter_prompt: str | NotGiven = NOT_GIVEN,
408424
suggested_queries: List[str] | NotGiven = NOT_GIVEN,
409425
system_prompt: str | NotGiven = NOT_GIVEN,
410426
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -427,6 +443,11 @@ async def create(
427443
creates an empty `Datastore` and configures the `Agent` to use the newly created
428444
`Datastore`.
429445
446+
> Note that self-serve users are currently required to create agents through our
447+
> UI. Otherwise, they will receive the following message: "This endpoint is
448+
> disabled as you need to go through checkout. Please use the UI to make this
449+
> request."
450+
430451
Args:
431452
name: Name of the agent
432453
@@ -436,6 +457,9 @@ async def create(
436457
437458
description: Description of the agent
438459
460+
filter_prompt: The prompt to an LLM which determines whether retrieved chunks are relevant to a
461+
given query and filters out irrelevant chunks.
462+
439463
suggested_queries: These queries will show up as suggestions in the Contextual UI when users load
440464
the agent. We recommend including common queries that users will ask, as well as
441465
complex queries so users understand the types of complex queries the system can
@@ -460,6 +484,7 @@ async def create(
460484
"agent_configs": agent_configs,
461485
"datastore_ids": datastore_ids,
462486
"description": description,
487+
"filter_prompt": filter_prompt,
463488
"suggested_queries": suggested_queries,
464489
"system_prompt": system_prompt,
465490
},
@@ -477,6 +502,7 @@ async def update(
477502
*,
478503
agent_configs: agent_update_params.AgentConfigs | NotGiven = NOT_GIVEN,
479504
datastore_ids: List[str] | NotGiven = NOT_GIVEN,
505+
filter_prompt: str | NotGiven = NOT_GIVEN,
480506
llm_model_id: str | NotGiven = NOT_GIVEN,
481507
suggested_queries: List[str] | NotGiven = NOT_GIVEN,
482508
system_prompt: str | NotGiven = NOT_GIVEN,
@@ -499,6 +525,9 @@ async def update(
499525
500526
datastore_ids: IDs of the datastore to associate with the agent.
501527
528+
filter_prompt: The prompt to an LLM which determines whether retrieved chunks are relevant to a
529+
given query and filters out irrelevant chunks.
530+
502531
llm_model_id: The model ID to use for generation. Tuned models can only be used for the agents
503532
on which they were tuned. If no model is specified, the default model is used.
504533
Set to `default` to switch from a tuned model to the default model.
@@ -527,6 +556,7 @@ async def update(
527556
{
528557
"agent_configs": agent_configs,
529558
"datastore_ids": datastore_ids,
559+
"filter_prompt": filter_prompt,
530560
"llm_model_id": llm_model_id,
531561
"suggested_queries": suggested_queries,
532562
"system_prompt": system_prompt,

0 commit comments

Comments
 (0)