Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.1"
".": "0.1.0-alpha.2"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 39
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-478f305e228bf07625e8d1166c8a8d2a38c532d27012ce7ed906d0a3728f26f9.yml
configured_endpoints: 33
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-4ed32c3243ce7a772e55bb1ba204736fc3fb1d712d8ca0eb91bac0c7ac626938.yml
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 0.1.0-alpha.2 (2025-01-15)

Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/ContextualAI/contextual-client-python/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)

### Features

* **api:** update via SDK Studio ([#16](https://github.com/ContextualAI/contextual-client-python/issues/16)) ([eef8a87](https://github.com/ContextualAI/contextual-client-python/commit/eef8a87c1f4d1c57fce697103d07c8510fcc4520))
* **api:** update via SDK Studio ([#18](https://github.com/ContextualAI/contextual-client-python/issues/18)) ([990c359](https://github.com/ContextualAI/contextual-client-python/commit/990c359ab3f2e6c3f29fc07e158c895159e8cc94))
* **api:** update via SDK Studio ([#19](https://github.com/ContextualAI/contextual-client-python/issues/19)) ([4eeaea9](https://github.com/ContextualAI/contextual-client-python/commit/4eeaea95542c416d4dfa0d00e0304c3f88c2be79))

## 0.1.0-alpha.1 (2025-01-15)

Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/ContextualAI/contextual-client-python/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ first_page = await client.agents.list()
if first_page.has_next_page():
print(f"will fetch next page using these details: {first_page.next_page_info()}")
next_page = await first_page.get_next_page()
print(f"number of items we just fetched: {len(next_page.data)}")
print(f"number of items we just fetched: {len(next_page.agents)}")

# Remove `await` for non-async usage.
```
Expand All @@ -132,7 +132,7 @@ Or just work directly with the returned data:
first_page = await client.agents.list()

print(f"next page cursor: {first_page.next_cursor}") # => "next page cursor: ..."
for agent in first_page.data:
for agent in first_page.agents:
print(agent.id)

# Remove `await` for non-async usage.
Expand Down
17 changes: 0 additions & 17 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,6 @@ Types:
from contextual.types.agents import CreateDatasetResponse, DatasetMetadata, ListDatasetsResponse
```

### Tune

Types:

```python
from contextual.types.agents.datasets import TuneDeleteResponse
```

Methods:

- <code title="post /agents/{agent_id}/datasets/tune">client.agents.datasets.tune.<a href="./src/contextual/resources/agents/datasets/tune.py">create</a>(agent_id, \*\*<a href="src/contextual/types/agents/datasets/tune_create_params.py">params</a>) -> <a href="./src/contextual/types/agents/create_dataset_response.py">CreateDatasetResponse</a></code>
- <code title="get /agents/{agent_id}/datasets/tune/{dataset_name}">client.agents.datasets.tune.<a href="./src/contextual/resources/agents/datasets/tune.py">retrieve</a>(dataset_name, \*, agent_id, \*\*<a href="src/contextual/types/agents/datasets/tune_retrieve_params.py">params</a>) -> BinaryAPIResponse</code>
- <code title="put /agents/{agent_id}/datasets/tune/{dataset_name}">client.agents.datasets.tune.<a href="./src/contextual/resources/agents/datasets/tune.py">update</a>(dataset_name, \*, agent_id, \*\*<a href="src/contextual/types/agents/datasets/tune_update_params.py">params</a>) -> <a href="./src/contextual/types/agents/create_dataset_response.py">CreateDatasetResponse</a></code>
- <code title="get /agents/{agent_id}/datasets/tune">client.agents.datasets.tune.<a href="./src/contextual/resources/agents/datasets/tune.py">list</a>(agent_id, \*\*<a href="src/contextual/types/agents/datasets/tune_list_params.py">params</a>) -> <a href="./src/contextual/types/agents/list_datasets_response.py">ListDatasetsResponse</a></code>
- <code title="delete /agents/{agent_id}/datasets/tune/{dataset_name}">client.agents.datasets.tune.<a href="./src/contextual/resources/agents/datasets/tune.py">delete</a>(dataset_name, \*, agent_id) -> <a href="./src/contextual/types/agents/datasets/tune_delete_response.py">object</a></code>
- <code title="get /agents/{agent_id}/datasets/tune/{dataset_name}/metadata">client.agents.datasets.tune.<a href="./src/contextual/resources/agents/datasets/tune.py">metadata</a>(dataset_name, \*, agent_id, \*\*<a href="src/contextual/types/agents/datasets/tune_metadata_params.py">params</a>) -> <a href="./src/contextual/types/agents/dataset_metadata.py">DatasetMetadata</a></code>

### Evaluate

Types:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "contextual-client"
version = "0.1.0-alpha.1"
version = "0.1.0-alpha.2"
description = "The official Python library for the Contextual AI API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/contextual/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "contextual"
__version__ = "0.1.0-alpha.1" # x-release-please-version
__version__ = "0.1.0-alpha.2" # x-release-please-version
16 changes: 8 additions & 8 deletions src/contextual/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ def next_page_info(self) -> Optional[PageInfo]:


class SyncPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
data: List[_T]
agents: List[_T]
next_cursor: Optional[str] = None

@override
def _get_page_items(self) -> List[_T]:
data = self.data
if not data:
agents = self.agents
if not agents:
return []
return data
return agents

@override
def next_page_info(self) -> Optional[PageInfo]:
Expand All @@ -118,15 +118,15 @@ def next_page_info(self) -> Optional[PageInfo]:


class AsyncPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
data: List[_T]
agents: List[_T]
next_cursor: Optional[str] = None

@override
def _get_page_items(self) -> List[_T]:
data = self.data
if not data:
agents = self.agents
if not agents:
return []
return data
return agents

@override
def next_page_info(self) -> Optional[PageInfo]:
Expand Down
34 changes: 16 additions & 18 deletions src/contextual/resources/agents/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ def create(
"""
Create a new `Agent` with a specific configuration.

This creates a specialized RAG `Agent` which queries over a `Datastore` to
retrieve relevant data on which its generations are grounded.
This creates a specialized RAG `Agent` which queries over one or multiple
`Datastores` to retrieve relevant data on which its generations are grounded.

Retrieval and generation parameters are defined in the provided `Agent`
configuration.
Expand Down Expand Up @@ -188,14 +188,13 @@ def update(
Fields not included in the request body will not be modified.

Args:
agent_id: Agent ID of the agent to edit
agent_id: ID of the agent to edit

datastore_ids: IDs of the datastore to associate with the agent.

llm_model_id: Optional model ID of a tuned model to use for generation. Model must have been
tuned on this agent; tuned models cannot be used across agents. Uses default
model if none is specified. Set to `default` to deactivate the tuned model and
use the default model.
llm_model_id: The model ID to use for generation. Tuned models can only be used for the agents
on which they were tuned. If no model is specified, the default model is used.
Set to `default` to switch from a tuned model to the default model.

suggested_queries: These queries will show up as suggestions in the Contextual UI when users load
the agent. We recommend including common queries that users will ask, as well as
Expand Down Expand Up @@ -300,7 +299,7 @@ def delete(
`DELETE /datastores/{datastore_id}` API.

Args:
agent_id: Agent ID of the agent to delete
agent_id: ID of the agent to delete

extra_headers: Send extra headers

Expand Down Expand Up @@ -335,7 +334,7 @@ def metadata(
Get metadata and configuration of a given `Agent`.

Args:
agent_id: Agent ID of the agent to retrieve details for
agent_id: ID of the agent for which to retrieve details

extra_headers: Send extra headers

Expand Down Expand Up @@ -410,8 +409,8 @@ async def create(
"""
Create a new `Agent` with a specific configuration.

This creates a specialized RAG `Agent` which queries over a `Datastore` to
retrieve relevant data on which its generations are grounded.
This creates a specialized RAG `Agent` which queries over one or multiple
`Datastores` to retrieve relevant data on which its generations are grounded.

Retrieval and generation parameters are defined in the provided `Agent`
configuration.
Expand Down Expand Up @@ -483,14 +482,13 @@ async def update(
Fields not included in the request body will not be modified.

Args:
agent_id: Agent ID of the agent to edit
agent_id: ID of the agent to edit

datastore_ids: IDs of the datastore to associate with the agent.

llm_model_id: Optional model ID of a tuned model to use for generation. Model must have been
tuned on this agent; tuned models cannot be used across agents. Uses default
model if none is specified. Set to `default` to deactivate the tuned model and
use the default model.
llm_model_id: The model ID to use for generation. Tuned models can only be used for the agents
on which they were tuned. If no model is specified, the default model is used.
Set to `default` to switch from a tuned model to the default model.

suggested_queries: These queries will show up as suggestions in the Contextual UI when users load
the agent. We recommend including common queries that users will ask, as well as
Expand Down Expand Up @@ -595,7 +593,7 @@ async def delete(
`DELETE /datastores/{datastore_id}` API.

Args:
agent_id: Agent ID of the agent to delete
agent_id: ID of the agent to delete

extra_headers: Send extra headers

Expand Down Expand Up @@ -630,7 +628,7 @@ async def metadata(
Get metadata and configuration of a given `Agent`.

Args:
agent_id: Agent ID of the agent to retrieve details for
agent_id: ID of the agent for which to retrieve details

extra_headers: Send extra headers

Expand Down
14 changes: 0 additions & 14 deletions src/contextual/resources/agents/datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from .tune import (
TuneResource,
AsyncTuneResource,
TuneResourceWithRawResponse,
AsyncTuneResourceWithRawResponse,
TuneResourceWithStreamingResponse,
AsyncTuneResourceWithStreamingResponse,
)
from .datasets import (
DatasetsResource,
AsyncDatasetsResource,
Expand All @@ -26,12 +18,6 @@
)

__all__ = [
"TuneResource",
"AsyncTuneResource",
"TuneResourceWithRawResponse",
"AsyncTuneResourceWithRawResponse",
"TuneResourceWithStreamingResponse",
"AsyncTuneResourceWithStreamingResponse",
"EvaluateResource",
"AsyncEvaluateResource",
"EvaluateResourceWithRawResponse",
Expand Down
32 changes: 0 additions & 32 deletions src/contextual/resources/agents/datasets/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@

from __future__ import annotations

from .tune import (
TuneResource,
AsyncTuneResource,
TuneResourceWithRawResponse,
AsyncTuneResourceWithRawResponse,
TuneResourceWithStreamingResponse,
AsyncTuneResourceWithStreamingResponse,
)
from .evaluate import (
EvaluateResource,
AsyncEvaluateResource,
Expand All @@ -25,10 +17,6 @@


class DatasetsResource(SyncAPIResource):
@cached_property
def tune(self) -> TuneResource:
return TuneResource(self._client)

@cached_property
def evaluate(self) -> EvaluateResource:
return EvaluateResource(self._client)
Expand All @@ -54,10 +42,6 @@ def with_streaming_response(self) -> DatasetsResourceWithStreamingResponse:


class AsyncDatasetsResource(AsyncAPIResource):
@cached_property
def tune(self) -> AsyncTuneResource:
return AsyncTuneResource(self._client)

@cached_property
def evaluate(self) -> AsyncEvaluateResource:
return AsyncEvaluateResource(self._client)
Expand Down Expand Up @@ -86,10 +70,6 @@ class DatasetsResourceWithRawResponse:
def __init__(self, datasets: DatasetsResource) -> None:
self._datasets = datasets

@cached_property
def tune(self) -> TuneResourceWithRawResponse:
return TuneResourceWithRawResponse(self._datasets.tune)

@cached_property
def evaluate(self) -> EvaluateResourceWithRawResponse:
return EvaluateResourceWithRawResponse(self._datasets.evaluate)
Expand All @@ -99,10 +79,6 @@ class AsyncDatasetsResourceWithRawResponse:
def __init__(self, datasets: AsyncDatasetsResource) -> None:
self._datasets = datasets

@cached_property
def tune(self) -> AsyncTuneResourceWithRawResponse:
return AsyncTuneResourceWithRawResponse(self._datasets.tune)

@cached_property
def evaluate(self) -> AsyncEvaluateResourceWithRawResponse:
return AsyncEvaluateResourceWithRawResponse(self._datasets.evaluate)
Expand All @@ -112,10 +88,6 @@ class DatasetsResourceWithStreamingResponse:
def __init__(self, datasets: DatasetsResource) -> None:
self._datasets = datasets

@cached_property
def tune(self) -> TuneResourceWithStreamingResponse:
return TuneResourceWithStreamingResponse(self._datasets.tune)

@cached_property
def evaluate(self) -> EvaluateResourceWithStreamingResponse:
return EvaluateResourceWithStreamingResponse(self._datasets.evaluate)
Expand All @@ -125,10 +97,6 @@ class AsyncDatasetsResourceWithStreamingResponse:
def __init__(self, datasets: AsyncDatasetsResource) -> None:
self._datasets = datasets

@cached_property
def tune(self) -> AsyncTuneResourceWithStreamingResponse:
return AsyncTuneResourceWithStreamingResponse(self._datasets.tune)

@cached_property
def evaluate(self) -> AsyncEvaluateResourceWithStreamingResponse:
return AsyncEvaluateResourceWithStreamingResponse(self._datasets.evaluate)
Loading
Loading